sim: fix case break
This commit is contained in:
parent
60ae9dce0d
commit
2bbcc218f3
|
@ -196,11 +196,13 @@ class Evaluator:
|
||||||
elif isinstance(s, Case):
|
elif isinstance(s, Case):
|
||||||
nbits, signed = value_bits_sign(s.test)
|
nbits, signed = value_bits_sign(s.test)
|
||||||
test = _truncate(self.eval(s.test), nbits, signed)
|
test = _truncate(self.eval(s.test), nbits, signed)
|
||||||
|
found = False
|
||||||
for k, v in s.cases.items():
|
for k, v in s.cases.items():
|
||||||
if isinstance(k, Constant) and k.value == test:
|
if isinstance(k, Constant) and k.value == test:
|
||||||
self.execute(v)
|
self.execute(v)
|
||||||
return
|
found = True
|
||||||
if "default" in s.cases:
|
break
|
||||||
|
if not found and "default" in s.cases:
|
||||||
self.execute(s.cases["default"])
|
self.execute(s.cases["default"])
|
||||||
elif isinstance(s, collections.Iterable):
|
elif isinstance(s, collections.Iterable):
|
||||||
self.execute(s)
|
self.execute(s)
|
||||||
|
|
Loading…
Reference in New Issue