From 2bbcc218f36afe5d598b6e24158557183ac016fa Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 20 Oct 2015 17:18:33 +0800 Subject: [PATCH] sim: fix case break --- migen/sim/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/migen/sim/core.py b/migen/sim/core.py index fc750833c..f89cd02c3 100644 --- a/migen/sim/core.py +++ b/migen/sim/core.py @@ -196,11 +196,13 @@ class Evaluator: 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)