From: Sebastien Bourdeauducq Date: Tue, 6 Mar 2012 12:58:22 +0000 (+0100) Subject: fhdl: add simulation functions in fragment X-Git-Tag: 24jan2021_ls180~2099^2~998 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d16fde48cb8476d8ec4853496dee88d24589b68;p=litex.git fhdl: add simulation functions in fragment --- 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)