From 6f4e3156d81ada756435651f40ae4f74bb59072b Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 26 Jun 2019 05:22:09 +0000 Subject: [PATCH] back.pysim: fix scope screwup. --- nmigen/back/pysim.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nmigen/back/pysim.py b/nmigen/back/pysim.py index c07677f..42f9954 100644 --- a/nmigen/back/pysim.py +++ b/nmigen/back/pysim.py @@ -329,7 +329,9 @@ class _StatementCompiler(StatementVisitor): mask = "1" * len(value) mask = int(mask, 2) value = int(value, 2) - check = lambda test: test & mask == value + def make_check(mask, value): + return lambda test: test & mask == value + check = make_check(mask, value) cases.append((check, self.on_statements(stmts))) def run(state): test_value = test(state) -- 2.30.2