From 8d16fde48cb8476d8ec4853496dee88d24589b68 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 6 Mar 2012 13:58:22 +0100 Subject: [PATCH] fhdl: add simulation functions in fragment --- migen/fhdl/structure.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 0ca04b13..45f97705 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -255,20 +255,27 @@ class Memory: self.init = init class Fragment: - def __init__(self, comb=None, sync=None, instances=None, memories=None, pads=set()): + def __init__(self, comb=None, sync=None, instances=None, memories=None, pads=set(), sim=None): if comb is None: comb = [] if sync is None: sync = [] if instances is None: instances = [] if memories is None: memories = [] + if sim is None: sim = [] self.comb = _sl(comb) self.sync = _sl(sync) self.instances = instances self.memories = memories self.pads = pads + self.sim = sim def __add__(self, other): return Fragment(self.comb.l + other.comb.l, self.sync.l + other.sync.l, self.instances + other.instances, self.memories + other.memories, - self.pads | other.pads) + self.pads | other.pads, + self.sim + other.sim) + + def call_sim(self, simulator, cycle): + for s in self.sim: + s(simulator, cycle) -- 2.30.2