Skip to content

Commit add71d8

Browse files
authored
Merge pull request #241 from alwilson/fix_enum_solve_order_240
Add enums to solve-order expand visitor; Fix #240
2 parents a82c2bf + ca2e35a commit add71d8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/vsc/model/solvegroup_swizzler_partsel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def swizzle(self,
4141

4242
if rs.rand_order_l is not None:
4343
# Perform an ordered randomization
44+
if self.debug > 0: print(" following solve-order constraints")
4445
for ro_l in rs.rand_order_l:
4546
swizzled_field |= self.swizzle_field_l(ro_l, rs, bound_m, btor)
4647
else:
48+
if self.debug > 0: print(" following random field order")
4749
swizzled_field |= self.swizzle_field_l(rs.rand_fields(), rs, bound_m, btor)
4850

4951
if not swizzled_field:

src/vsc/visitors/expand_solve_order_visitor.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'''
66
from vsc.model.field_array_model import FieldArrayModel
77
from vsc.model.field_scalar_model import FieldScalarModel
8+
from vsc.model.enum_field_model import EnumFieldModel
89
from vsc.model.model_visitor import ModelVisitor
910

1011

@@ -27,12 +28,18 @@ def expand(self, a, b):
2728
else:
2829
b.accept(self)
2930

30-
def visit_scalar_field(self, f:FieldScalarModel):
31+
def visit_field(self, f:list[FieldScalarModel, EnumFieldModel]):
3132
if self.lhs:
3233
# Now, visit rhs
3334
ExpandSolveOrderVisitor(self.order_m, lhs=False).expand(f, self.b)
3435
else:
3536
if not self.a in self.order_m.keys():
3637
self.order_m[self.a] = set()
3738
self.order_m[self.a].add(f)
38-
39+
40+
def visit_scalar_field(self, f:FieldScalarModel):
41+
self.visit_field(f)
42+
43+
def visit_enum_field(self, f:EnumFieldModel):
44+
self.visit_field(f)
45+

0 commit comments

Comments
 (0)