From 4ed5531a9acf65c7f17abb168f4c43ee84cdb57b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 21 Aug 2020 12:41:42 +0100 Subject: [PATCH] add in WishboneDownConvert into LoadStoreUnitInterface --- src/soc/bus/test/test_minerva.py | 2 +- src/soc/minerva/units/loadstore.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/soc/bus/test/test_minerva.py b/src/soc/bus/test/test_minerva.py index 8e581b5e..d70655ff 100644 --- a/src/soc/bus/test/test_minerva.py +++ b/src/soc/bus/test/test_minerva.py @@ -22,7 +22,7 @@ class TestSRAMBareLoadStoreUnit(BareLoadStoreUnit): comb = m.d.comb m.submodules.sram = sram = SRAM(memory=self.mem, granularity=8, features={'cti', 'bte', 'err'}) - dbus = self.dbus + dbus = self.slavebus # directly connect the wishbone bus of LoadStoreUnitInterface to SRAM # note: SRAM is a target (slave), dbus is initiator (master) diff --git a/src/soc/minerva/units/loadstore.py b/src/soc/minerva/units/loadstore.py index db05c300..de3246e9 100644 --- a/src/soc/minerva/units/loadstore.py +++ b/src/soc/minerva/units/loadstore.py @@ -4,7 +4,9 @@ from nmigen.lib.fifo import SyncFIFO from soc.minerva.cache import L1Cache from soc.minerva.wishbone import make_wb_layout, WishboneArbiter, Cycle +from soc.bus.wb_downconvert import WishboneDownConvert +from copy import deepcopy __all__ = ["LoadStoreUnitInterface", "BareLoadStoreUnit", "CachedLoadStoreUnit"] @@ -13,8 +15,13 @@ __all__ = ["LoadStoreUnitInterface", "BareLoadStoreUnit", class LoadStoreUnitInterface: def __init__(self, pspec): self.pspec = pspec - self.dbus = Record(make_wb_layout(pspec)) + self.dbus = self.slavebus = Record(make_wb_layout(pspec)) print(self.dbus.sel.shape()) + if isinstance(pspec.wb_data_wid, int): + pspecslave = deepcopy(pspec) + pspecslave.data_wid = pspec.wb_data_wid + self.slavebus = Record(make_wb_layout(pspecslave)) + self.cvt = WishboneDownConvert(self.dbus, self.slavebus) self.mask_wid = mask_wid = pspec.mask_wid self.addr_wid = addr_wid = pspec.addr_wid self.data_wid = data_wid = pspec.reg_wid @@ -80,6 +87,9 @@ class BareLoadStoreUnit(LoadStoreUnitInterface, Elaboratable): def elaborate(self, platform): m = Module() + if hasattr(self, "cvt"): + m.submodules.cvt = cvt + with m.If(self.dbus.cyc): with m.If(self.dbus.ack | self.dbus.err | ~self.m_valid_i): m.d.sync += [ -- 2.30.2