X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fsoc%2Fsimple%2Fissuer.py;h=a273fd1656d2c393116d5c4485ac0c2c7b7591ca;hb=006e364df732d4cff95ddcf948889d5fda8a561a;hp=d0d1c5e2350263207e41e7b22bcfd2c79e798fbb;hpb=9111ba8618e5945892dc0e2f6ec764bfe7ffbe71;p=soc.git diff --git a/src/soc/simple/issuer.py b/src/soc/simple/issuer.py index d0d1c5e2..a273fd16 100644 --- a/src/soc/simple/issuer.py +++ b/src/soc/simple/issuer.py @@ -17,6 +17,8 @@ improved. from nmigen import Elaboratable, Module, Signal from nmigen.cli import rtlil +from nmigen.cli import main +import sys from soc.decoder.decode2execute1 import Data from soc.experiment.testmem import TestMemory # test only for instructions @@ -24,6 +26,7 @@ from soc.regfile.regfiles import FastRegs from soc.simple.core import NonProductionCore from soc.config.test.test_loadstore import TestMemPspec from soc.config.ifetch import ConfigFetchUnit +from soc.decoder.power_enums import MicrOp class TestIssuer(Elaboratable): @@ -42,15 +45,21 @@ class TestIssuer(Elaboratable): self.iprev_adr = Signal(64) # previous address: if different, do read # instruction go/monitor - self.go_insn_i = Signal(reset_less=True) + self.go_insn_i = Signal() 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.pc_i = Data(64, "pc_i") # set "ok" to indicate "please change me" + self.core_start_i = Signal() + self.core_stop_i = Signal() + self.core_bigendian_i = Signal() + self.busy_o = Signal(reset_less=True) + self.halted_o = Signal(reset_less=True) 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'] + # FAST regfile read /write ports for PC and MSR + self.fast_r_pc = self.core.regs.rf['fast'].r_ports['cia'] # PC rd + self.fast_w_pc = self.core.regs.rf['fast'].w_ports['d_wr1'] # PC wr + self.fast_r_msr = self.core.regs.rf['fast'].r_ports['msr'] # MSR rd + # hack method of keeping an eye on whether branch/trap set the PC self.fast_nia = self.core.regs.rf['fast'].w_ports['nia'] self.fast_nia.wen.name = 'fast_nia_wen' @@ -62,11 +71,18 @@ class TestIssuer(Elaboratable): m.submodules.core = core = self.core m.submodules.imem = imem = self.imem + # busy/halted signals from core + comb += self.busy_o.eq(core.busy_o) + comb += self.halted_o.eq(core.core_terminated_o) + comb += core.core_start_i.eq(self.core_start_i) + comb += core.core_stop_i.eq(self.core_stop_i) + comb += core.bigendian_i.eq(self.core_bigendian_i) + # temporary hack: says "go" immediately for both address gen and ST l0 = core.l0 ldst = core.fus.fus['ldst0'] - m.d.comb += ldst.ad.go.eq(ldst.ad.rel) # link addr-go direct to rel - m.d.comb += ldst.st.go.eq(ldst.st.rel) # link store-go direct to rel + m.d.comb += ldst.ad.go_i.eq(ldst.ad.rel_o) # link addr-go direct to rel + m.d.comb += ldst.st.go_i.eq(ldst.st.rel_o) # link store-go direct to rel # PC and instruction from I-Memory current_insn = Signal(32) # current fetched instruction (note sync) @@ -75,6 +91,10 @@ class TestIssuer(Elaboratable): comb += self.pc_o.eq(cur_pc) ilatch = Signal(32) + # MSR (temp and latched) + cur_msr = Signal(64) # current MSR (note it is reset/sync) + msr = Signal(64, reset_less=True) + # next instruction (+4 on current) nia = Signal(64, reset_less=True) comb += nia.eq(cur_pc + 4) @@ -86,10 +106,18 @@ class TestIssuer(Elaboratable): core_be_i = core.bigendian_i # bigendian mode core_opcode_i = core.raw_opcode_i # raw opcode + insn_type = core.pdecode2.e.do.insn_type + insn_msr = core.pdecode2.msr + insn_cia = core.pdecode2.cia + # only run if not in halted state with m.If(~core.core_terminated_o): # actually use a nmigen FSM for the first time (w00t) + # this FSM is perhaps unusual in that it detects conditions + # then "holds" information, combinatorially, for the core + # (as opposed to using sync - which would be on a clock's delay) + # this includes the actual opcode, valid flags and so on. with m.FSM() as fsm: # waiting (zzz) @@ -103,8 +131,8 @@ class TestIssuer(Elaboratable): comb += pc.eq(self.pc_i.data) with m.Else(): # otherwise read FastRegs regfile for PC - comb += self.fast_rd1.ren.eq(1<