From 5fa7f7414f1d8b445aa1452d3f0ade7bd3347c44 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 12 Sep 2015 16:01:53 +0800 Subject: [PATCH] sim: support eval of nested lists --- migen/sim.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/migen/sim.py b/migen/sim.py index 36bbcfe31..8862fcdf6 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