def elaborate(self, platform):
m = Module()
comb = m.d.comb
- m.submodules.mem = memory = Memory(width=addr_wid, depth=16)
+ # small 32-entry Memory
+ memory = Memory(width=self.addr_wid, depth=32)
m.submodules.sram = sram = SRAM(memory=memory, granularity=8,
- features=set('cti', 'bte', 'err'))
+ features={'cti', 'bte', 'err'})
dbus = self.dbus
# directly connect the wishbone bus of LoadStoreUnitInterface to SRAM
fanouts = ['adr', 'dat_w', 'sel', 'cyc', 'stb', 'we', 'cti', 'bte']
fanins = ['dat_r', 'ack', 'err']
for fanout in fanouts:
- comb += getattr(sram.bus, fanout).eq(getattr(dbus))
+ comb += getattr(sram.bus, fanout).eq(getattr(dbus, fanout))
for fanin in fanins:
- comb += getattr(dbus, fanin).eq(getattr(sram.bus))
+ comb += getattr(dbus, fanin).eq(getattr(sram.bus, fanin))
+ return m
return (val >> (offset * 8)) & 0xff
-if __name__ == '__main__':
+def tst_lsmemtype(ifacetype):
m = Module()
Pspec = namedtuple('Pspec', ['ldst_ifacetype',
'addr_wid', 'mask_wid', 'reg_wid'])
- pspec = Pspec(ldst_ifacetype='testmem', addr_wid=64, mask_wid=3, reg_wid=64)
+ pspec = Pspec(ldst_ifacetype=ifacetype, addr_wid=64, mask_wid=4, reg_wid=64)
dut = ConfigLoadStoreUnit(pspec).lsi
m.submodules.dut = dut
assert x == val
sim.add_sync_process(process)
- with sim.write_vcd("test_loadstore_tm.vcd", traces=[]):
+ with sim.write_vcd("test_loadstore_%s.vcd" % ifacetype, traces=[]):
sim.run()
+if __name__ == '__main__':
+ tst_lsmemtype('testmem')
+ tst_lsmemtype('test_bare_wb')