From: Luke Kenneth Casson Leighton Date: Tue, 16 Jun 2020 17:18:20 +0000 (+0100) Subject: set up a TestIssuer class with a FSM for doing instruction issue to simple core X-Git-Tag: div_pipeline~360 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28629aed1960c51f073f24a066a93201343a6ca1;p=soc.git set up a TestIssuer class with a FSM for doing instruction issue to simple core --- diff --git a/src/soc/experiment/testmem.py b/src/soc/experiment/testmem.py index 4821e21d..5a1165de 100644 --- a/src/soc/experiment/testmem.py +++ b/src/soc/experiment/testmem.py @@ -21,7 +21,7 @@ class TestMemory(Elaboratable): def __iter__(self): yield self.rdport.addr yield self.rdport.data - yield self.rdport.en + #yield self.rdport.en yield self.wrport.addr yield self.wrport.data yield self.wrport.en diff --git a/src/soc/simple/core.py b/src/soc/simple/core.py index 545bd519..92b97319 100644 --- a/src/soc/simple/core.py +++ b/src/soc/simple/core.py @@ -32,6 +32,7 @@ from soc.decoder.power_decoder2 import PowerDecode2 from soc.decoder.decode2execute1 import Data from soc.experiment.l0_cache import TstL0CacheBuffer # test only from soc.experiment.testmem import TestMemory # test only for instructions +from soc.regfile.regfiles import FastRegs import operator @@ -58,9 +59,6 @@ class NonProductionCore(Elaboratable): self.l0 = TstL0CacheBuffer(n_units=1, regwid=64, addrwid=addrwid) pi = self.l0.l0.dports[0].pi - # Test Instruction memory - #self.imem = TestMemory(32, idepth) - # function units (only one each) self.fus = AllFunctionUnits(pilist=[pi], addrwid=addrwid) @@ -86,7 +84,6 @@ class NonProductionCore(Elaboratable): m.submodules.pdecode2 = dec2 = self.pdecode2 m.submodules.fus = self.fus m.submodules.l0 = l0 = self.l0 - #m.submodules.imem = imem = self.imem self.regs.elaborate_into(m, platform) regs = self.regs fus = self.fus.fus @@ -324,7 +321,7 @@ class TestIssuer(Elaboratable): # Test Instruction memory self.imem = TestMemory(32, idepth) - self.i_rd = self.imem.read_port() + self.i_rd = self.imem.rdport #self.i_wr = self.imem.write_port() errr... # instruction go/monitor @@ -332,18 +329,96 @@ class TestIssuer(Elaboratable): self.pc_o = Signal(64, reset_less=True) self.pc_i = Data(64, "pc") # set "ok" to indicate "please change me" self.busy_o = core.busy_o + self.memerr_o = Signal(reset_less=True) + + # FAST regfile read /write ports + self.fast_rd1 = self.core.regs.rf['fast'].r_ports['d_rd1'] + self.fast_wr1 = self.core.regs.rf['fast'].w_ports['d_wr1'] def elaborate(self, platform): m = Module() + comb, sync = m.d.comb, m.d.sync m.submodules.core = core = self.core m.submodules.imem = imem = self.imem - current_pc = Signal(64, reset_less=True) + # PC and instruction from I-Memory + current_pc = Signal(64) # current PC (note it is reset/sync) + current_insn = Signal(32) # current fetched instruction (note sync) + + # next instruction (+4 on current) + nia = Signal(64, reset_less=True) + comb += nia.eq(current_insn + 4) + + # temporaries + core_busy_o = core.busy_o # core is busy + core_ivalid_i = core.ivalid_i # instruction is valid + core_issue_i = core.issue_i # instruction is issued + core_be_i = core.bigendian_i # bigendian mode + core_opcode_i = core.raw_opcode_i # raw opcode + + # actually use a nmigen FSM for the first time (w00t) + with m.FSM() as fsm: + + # waiting (zzz) + with m.State("IDLE"): + with m.If(self.go_insn_i): + # instruction allowed to go: start by reading the PC + pc = Signal(64, reset_less=True) + comb += self.fast_rd1.ren.eq(1<