projects
/
nmigen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6aefd0c
)
back.pysim: fix completely broken codegen for Switch.
author
whitequark
<whitequark@whitequark.org>
Fri, 14 Dec 2018 08:51:36 +0000
(08:51 +0000)
committer
whitequark
<whitequark@whitequark.org>
Fri, 14 Dec 2018 08:51:36 +0000
(08:51 +0000)
nmigen/back/pysim.py
patch
|
blob
|
history
diff --git
a/nmigen/back/pysim.py
b/nmigen/back/pysim.py
index 0a9afecfb692636f9570201db09f4867b48698eb..d740ebd26cc0777031d0e1ee2094919009679b3b 100644
(file)
--- a/
nmigen/back/pysim.py
+++ b/
nmigen/back/pysim.py
@@
-169,14
+169,15
@@
class _StatementCompiler(StatementTransformer):
mask = "1" * len(value)
mask = int(mask, 2)
value = int(value, 2)
- cases.append((lambda test: test & mask == value,
- self.on_statements(stmts)))
+ def make_test(mask, value):
+ return lambda test: test & mask == value
+ cases.append((make_test(mask, value), self.on_statements(stmts)))
def run(state):
test_value = test(state)
for check, body in cases:
if check(test_value):
body(state)
- return
+
return
return run
def on_statements(self, stmts):