From: Sebastien Bourdeauducq Date: Thu, 17 Sep 2015 09:25:06 +0000 (+0800) Subject: sim: support Case X-Git-Tag: 24jan2021_ls180~2099^2~3^2~74 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec1d4edf848c4a8f38b7f3a5635983248dc65b92;p=litex.git sim: support Case --- diff --git a/migen/sim.py b/migen/sim.py index c6ddea55..ed40963d 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