From e12187aa807a724f5ba60ff5bf4ad4b32170cc15 Mon Sep 17 00:00:00 2001 From: Nina Engelhardt Date: Sun, 11 Aug 2013 23:11:30 +0200 Subject: [PATCH] add += operator to fragment --- migen/fhdl/structure.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 2be1a640..9ef2cb32 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -275,3 +275,16 @@ class _Fragment: self.specials | other.specials, self.clock_domains + other.clock_domains, self.sim + other.sim) + + def __iadd__(self, other): + newsync = defaultdict(list) + for k, v in self.sync.items(): + newsync[k] = v[:] + for k, v in other.sync.items(): + newsync[k].extend(v) + self.comb += other.comb + self.sync = newsync + self.specials |= other.specials + self.clock_domains += other.clock_domains + self.sim += other.sim + return self -- 2.30.2