with m.If(idx_l.q):
comb += self.pimem.connect_port(port)
- with m.If(~self.pimem.pi.pi.busy_o):
+ with m.If(~self.pimem.pi.busy_o):
comb += reset_l.s.eq(1) # reset when no longer busy
# ugly hack, due to simultaneous addr req-go acknowledge
m.submodules.pimem = self.pimem
m.submodules.l0 = self.l0
if hasattr(self.cmpi, 'lsmem'): # hmmm not happy about this
- dut.submodules.lsmem = self.cmpi.lsmem.lsi
+ m.submodules.lsmem = self.cmpi.lsmem.lsi
return m
# can go straight to reset.
yield port1.is_st_i.eq(0) # end
yield port1.addr.ok.eq(0) # set !ok
- # yield from wait_busy(port1, False) # wait until not busy
+ yield from wait_busy(port1, False) # wait until not busy
def l0_cache_ld(dut, addr, datalen, expected):
# cleanup
yield port1.is_ld_i.eq(0) # end
yield port1.addr.ok.eq(0) # set !ok
- # yield from wait_busy(port1, no=False) # wait until not busy
+ yield from wait_busy(port1, no=False) # wait until not busy
return data
"""
return addr[:self.addrbits], addr[self.addrbits:]
+ def connect_port(self, inport):
+ return self.pi.connect_port(inport)
+
def elaborate(self, platform):
m = Module()
pi, lsui, addrbits = self.pi, self.lsui, self.addrbits
self.ld = Data(regwid, "ld_data_o") # ok to be set by L0 Cache/Buf
self.st = Data(regwid, "st_data_i") # ok to be set by CompUnit
+ def connect_port(self, inport):
+ print ("connect_port", self, inport)
+ return [self.is_ld_i.eq(inport.is_ld_i),
+ self.is_st_i.eq(inport.is_st_i),
+ self.data_len.eq(inport.data_len),
+ self.go_die_i.eq(inport.go_die_i),
+ self.addr.data.eq(inport.addr.data),
+ self.addr.ok.eq(inport.addr.ok),
+ self.st.eq(inport.st),
+ inport.ld.eq(self.ld),
+ inport.busy_o.eq(self.busy_o),
+ inport.addr_ok_o.eq(self.addr_ok_o),
+ inport.addr_exc_o.eq(self.addr_exc_o),
+ ]
+
class LDSTPort(Elaboratable):
def __init__(self, idx, regwid=64, addrwid=48):
init=False)
self.regwid = regwid
self.addrwid = addrwid
- self.pi = LDSTPort(0, regwid, addrwid)
+ self.lpi = LDSTPort(0, regwid, addrwid)
+ self.pi = self.lpi.pi
@property
def addrbits(self):
return addr[:self.addrbits], addr[self.addrbits:]
def connect_port(self, inport):
- return self.pi.connect_port(inport)
+ return self.lpi.connect_port(inport)
def elaborate(self, platform):
m = Module()
m.submodules.mem = self.mem
# connect the ports as modules
- m.submodules.port0 = self.pi
+ m.submodules.port0 = self.lpi
# state-machine latches
m.submodules.st_active = st_active = SRLatch(False, name="st_active")
lds = Signal(reset_less=True)
sts = Signal(reset_less=True)
- pi = self.pi.pi
+ pi = self.pi
comb += lds.eq(pi.is_ld_i & pi.busy_o) # ld-req signals
comb += sts.eq(pi.is_st_i & pi.busy_o) # st-req signals
class NonProductionCore(Elaboratable):
- def __init__(self, addrwid=6, idepth=16):
+ def __init__(self, addrwid=6, idepth=16, ifacetype='testpi'):
# single LD/ST funnel for memory access
- self.l0 = TstL0CacheBuffer(n_units=1, regwid=64, addrwid=addrwid)
+ self.l0 = TstL0CacheBuffer(n_units=1, regwid=64,
+ addrwid=addrwid, ifacetype=ifacetype)
pi = self.l0.l0.dports[0]
# function units (only one each)
efficiency and speed is not the main goal here: functional correctness is.
"""
- def __init__(self, addrwid=6, idepth=6):
+ def __init__(self, addrwid=6, idepth=6, ifacetype='testpi'):
# main instruction core
- self.core = core = NonProductionCore(addrwid)
+ self.core = core = NonProductionCore(addrwid, ifacetype=ifacetype)
# Test Instruction memory
self.imem = TestMemory(32, idepth)
go_insn_i = Signal()
pc_i = Signal(32)
- m.submodules.issuer = issuer = TestIssuer()
+ m.submodules.issuer = issuer = TestIssuer(ifacetype="test_bare_wb")
imem = issuer.imem.mem
core = issuer.core
pdecode2 = core.pdecode2