class TestSRAMBareLoadStoreUnit(BareLoadStoreUnit):
def __init__(self, pspec):
super().__init__(pspec)
+ pspec = self.pspecslave
# small 32-entry Memory
if (hasattr(pspec, "dmem_test_depth") and
isinstance(pspec.dmem_test_depth, int)):
depth = pspec.dmem_test_depth
else:
- depth = 64
+ depth = 32
print("TestSRAMBareLoadStoreUnit depth", depth)
- self.mem = Memory(width=self.data_wid, depth=depth)
+ self.mem = Memory(width=pspec.reg_wid, depth=depth)
def elaborate(self, platform):
m = super().elaborate(platform)
yield dut.x_stall_i.eq(0)
yield
+ yield
yield dut.x_st_i.eq(0)
while (yield dut.x_busy_o):
yield
pspec = TestMemPspec(ldst_ifacetype=ifacetype,
imem_ifacetype='', addr_wid=64,
mask_wid=4,
- wb_data_wid=32,
- reg_wid=64)
+ wb_data_wid=16,
+ reg_wid=32)
dut = ConfigLoadStoreUnit(pspec).lsi
vl = rtlil.convert(dut, ports=[]) # TODOdut.ports())
with open("test_loadstore_%s.il" % ifacetype, "w") as f:
def process():
- values = [random.randint(0, 255) for x in range(16*4)]
+ values = [random.randint(0, 255) for x in range(0)]
for addr, val in enumerate(values):
yield from write_byte(dut, addr, val)
x = yield from read_from_addr(dut, addr << 2)
class LoadStoreUnitInterface:
def __init__(self, pspec):
self.pspec = pspec
+ self.pspecslave = pspec
self.dbus = self.slavebus = Record(make_wb_layout(pspec))
print(self.dbus.sel.shape())
- if isinstance(pspec.wb_data_wid, int):
+ self.needs_cvt = False
+ if (hasattr(pspec, "dmem_test_depth") and
+ isinstance(pspec.wb_data_wid, int) and
+ pspec.wb_data_wid != pspec.reg_wid):
pspecslave = deepcopy(pspec)
pspecslave.reg_wid = pspec.wb_data_wid
+ mask_ratio = (pspec.reg_wid // pspec.wb_data_wid)
+ pspecslave.mask_wid = pspec.mask_wid // mask_ratio
+ self.pspecslave = pspecslave
self.slavebus = Record(make_wb_layout(pspecslave))
- self.cvt = WishboneDownConvert(self.dbus, self.slavebus)
+ self.needs_cvt = True
self.mask_wid = mask_wid = pspec.mask_wid
self.addr_wid = addr_wid = pspec.addr_wid
self.data_wid = data_wid = pspec.reg_wid
def elaborate(self, platform):
m = Module()
- if hasattr(self, "cvt"):
+ if self.needs_cvt:
+ self.cvt = WishboneDownConvert(self.dbus, self.slavebus)
m.submodules.cvt = self.cvt
with m.If(self.dbus.cyc):