From: Luke Kenneth Casson Leighton Date: Mon, 22 Feb 2021 16:21:26 +0000 (+0000) Subject: move setting of NIA into fetch FSM in TestIssuer X-Git-Tag: convert-csv-opcode-to-binary~167 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e64b53d2cb965f1fb4aa0943f127620d221a811b;p=soc.git move setting of NIA into fetch FSM in TestIssuer --- diff --git a/src/soc/simple/issuer.py b/src/soc/simple/issuer.py index f6daa834..22ecb2a7 100644 --- a/src/soc/simple/issuer.py +++ b/src/soc/simple/issuer.py @@ -146,7 +146,7 @@ class TestIssuerInternal(Elaboratable): self.state_nia = self.core.regs.rf['state'].w_ports['nia'] self.state_nia.wen.name = 'state_nia_wen' - def fetch_fsm(self, m, core, dbg, pc, nia, + def fetch_fsm(self, m, core, dbg, pc, pc_changed, insn_done, core_rst, cur_state, fetch_pc_ready_o, fetch_pc_valid_i, exec_insn_valid_o, exec_insn_ready_i, @@ -164,6 +164,10 @@ class TestIssuerInternal(Elaboratable): msr_read = Signal(reset=1) sv_read = Signal(reset=1) + # address of the next instruction, in the absence of a branch + # depends on the instruction size + nia = Signal(64, reset_less=True) + with m.FSM(name='fetch_fsm'): # waiting (zzz) @@ -244,6 +248,17 @@ class TestIssuerInternal(Elaboratable): with m.If(exec_insn_ready_i): m.next = "IDLE" + # code-morph: moving the actual PC-setting out of "execute" + # so that it's easier to move this into an "issue" FSM. + + # ok here we are not reading the branch unit. TODO + # this just blithely overwrites whatever pipeline + # updated the PC + core_busy_o = core.busy_o # core is busy + with m.If(insn_done & (~pc_changed) & (~core_busy_o)): + comb += self.state_w_pc.wen.eq(1<