Skip to content

Commit

Permalink
sim: fix case break
Browse files Browse the repository at this point in the history
sbourdeauducq committed Oct 20, 2015
1 parent 60ae9dc commit 2bbcc21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions migen/sim/core.py
Original file line number Diff line number Diff line change
@@ -196,11 +196,13 @@ def execute(self, statements):
elif isinstance(s, Case):
nbits, signed = value_bits_sign(s.test)
test = _truncate(self.eval(s.test), nbits, signed)
found = False
for k, v in s.cases.items():
if isinstance(k, Constant) and k.value == test:
self.execute(v)
return
if "default" in s.cases:
found = True
break
if not found and "default" in s.cases:
self.execute(s.cases["default"])
elif isinstance(s, collections.Iterable):
self.execute(s)

0 comments on commit 2bbcc21

Please sign in to comment.