From f3efd74dfde7606975340e7ca8b1dea6845f8ffd Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 23 Nov 2012 16:23:24 +0100 Subject: [PATCH] uio: support memories --- migen/pytholite/io.py | 2 +- migen/uio/ioo.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migen/pytholite/io.py b/migen/pytholite/io.py index bf40a70d3..766f8a2b3 100644 --- a/migen/pytholite/io.py +++ b/migen/pytholite/io.py @@ -11,7 +11,7 @@ from migen.pytholite.expr import ExprCompiler class Pytholite(UnifiedIOObject): def get_fragment(self): - return self.fragment + return super().get_fragment() + self.fragment class _TokenPullExprCompiler(ExprCompiler): def __init__(self, symdict, modelname, ep): diff --git a/migen/uio/ioo.py b/migen/uio/ioo.py index 67472e21a..907d85e90 100644 --- a/migen/uio/ioo.py +++ b/migen/uio/ioo.py @@ -1,7 +1,7 @@ from migen.fhdl.structure import * from migen.flow.actor import * from migen.actorlib.sim import TokenExchanger, Token -from migen.bus import wishbone +from migen.bus import wishbone, memory from migen.bus.transactions import * from migen.uio.trampoline import Trampoline @@ -10,6 +10,11 @@ class UnifiedIOObject(Actor): if dataflow is not None: super().__init__(*dataflow) self.buses = buses + + self._memories = set(v for v in self.buses.values() if isinstance(v, Memory)) + + def get_fragment(self): + return Fragment(memories=list(self._memories)) (_WAIT_COMPLETE, _WAIT_POLL) = range(2) @@ -28,6 +33,8 @@ class UnifiedIOSimulation(UnifiedIOObject): g = self.dispatch_g(caller_id) if isinstance(v, wishbone.Interface): caller = wishbone.Initiator(g, v) + elif isinstance(v, Memory): + caller = memory.Initiator(g, v) else: raise NotImplementedError self.callers.append(caller) @@ -69,4 +76,5 @@ class UnifiedIOSimulation(UnifiedIOObject): yield None def get_fragment(self): - return sum([c.get_fragment() for c in self.callers], Fragment()) + f = super().get_fragment() + return sum([c.get_fragment() for c in self.callers], f)