sim: support Case
authorSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Sep 2015 09:25:06 +0000 (17:25 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Sep 2015 09:25:06 +0000 (17:25 +0800)
migen/sim.py

index c6ddea55bc2a496cb8d30eefa4fbb893b541e96a..ed40963dd3730bcc6c7179bad7da49a4bb8a6fc4 100644 (file)
@@ -130,8 +130,15 @@ class Evaluator:
                     self.execute(s.t)
                 else:
                     self.execute(s.f)
+            elif isinstance(s, Case):
+                test = self.eval(s.test)
+                for k, v in s.cases.items():
+                    if isinstance(k, Constant) and k.value == test:
+                        self.execute(v)
+                        return
+                if "default" in s.cases:
+                    self.execute(s.cases["default"])
             else:
-                # TODO: Case
                 raise NotImplementedError