From: Sebastien Bourdeauducq Date: Sat, 12 Sep 2015 08:01:53 +0000 (+0800) Subject: sim: support eval of nested lists X-Git-Tag: 24jan2021_ls180~2099^2~3^2~100 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5fa7f7414f1d8b445aa1452d3f0ade7bd3347c44;p=litex.git sim: support eval of nested lists --- diff --git a/migen/sim.py b/migen/sim.py index 36bbcfe3..8862fcdf 100644 --- a/migen/sim.py +++ b/migen/sim.py @@ -147,6 +147,14 @@ class Simulator: self.evaluator.execute(self.comb_dependent_statements[signal]) modified = self.evaluator.commit() + def _eval_nested_lists(self, x): + if isinstance(x, list): + return [self._eval_nested_lists(e) for e in x] + elif isinstance(x, Signal): + return self.evaluator.eval(x) + else: + raise ValueError + def _process_generators(self, cd): exhausted = [] for generator in self.generators[cd]: @@ -159,7 +167,7 @@ class Simulator: elif isinstance(request, tuple): self.evaluator.assign(*request) else: - reply = self.evaluator.eval(request) + reply = self._eval_nested_lists(request) except StopIteration: exhausted.append(generator) break