sim/core: truncate evaluated values before test in If
authorSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 19 Oct 2015 07:58:21 +0000 (15:58 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 19 Oct 2015 07:58:21 +0000 (15:58 +0800)
migen/sim/core.py

index 0de231f294da24d30f72bf2114993a22f853f837..af3f3734f97debc4bb3184c97ee78af32c9e75fb 100644 (file)
@@ -181,7 +181,7 @@ class Evaluator:
             if isinstance(s, _Assign):
                 self.assign(s.l, self.eval(s.r))
             elif isinstance(s, If):
-                if self.eval(s.cond):
+                if self.eval(s.cond) & (2**len(s.cond) - 1):
                     self.execute(s.t)
                 else:
                     self.execute(s.f)