From ec1d4edf848c4a8f38b7f3a5635983248dc65b92 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 17 Sep 2015 17:25:06 +0800 Subject: [PATCH] sim: support Case --- migen/sim.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/migen/sim.py b/migen/sim.py index c6ddea55b..ed40963dd 100644 --- a/migen/sim.py +++ b/migen/sim.py @@ -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