From d2c61e6a904d70d94acdf72f708b24d7d8f7ac55 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 23 Nov 2012 23:07:25 +0100 Subject: [PATCH] sim/generic/multiread: do not return spurious items --- migen/sim/generic.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/migen/sim/generic.py b/migen/sim/generic.py index b4bd0ab0d..373740eee 100644 --- a/migen/sim/generic.py +++ b/migen/sim/generic.py @@ -146,9 +146,19 @@ class Simulator: if isinstance(obj, Signal): return self.rd(obj) elif isinstance(obj, list): - return [self.multiread(item) for item in obj] + r = [] + for item in obj: + rd = self.multiread(item) + if isinstance(item, Signal) or rd: + r.append(rd) + return r elif hasattr(obj, "__dict__"): - return dict([(k, self.multiread(v)) for k, v in obj.__dict__.items()]) + r = {} + for k, v in obj.__dict__.items(): + rd = self.multiread(v) + if isinstance(v, Signal) or rd: + r[k] = rd + return r def multiwrite(self, obj, value): if isinstance(obj, Signal):