From 92a83d55d055b38546968cf5babc90e5db7f3733 Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Fri, 5 Mar 2021 09:01:34 -0300 Subject: [PATCH] Move writing of the PC state register to the issue FSM Before fetch, update the PC state register with the NIA, unless PC was modified in execute. --- src/soc/simple/issuer.py | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/soc/simple/issuer.py b/src/soc/simple/issuer.py index 86d37a48..07a460e3 100644 --- a/src/soc/simple/issuer.py +++ b/src/soc/simple/issuer.py @@ -147,7 +147,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, pc, svstate, pc_changed, insn_done, + def fetch_fsm(self, m, core, pc, svstate, nia, fetch_pc_ready_o, fetch_pc_valid_i, fetch_insn_valid_o, fetch_insn_ready_i): """fetch FSM @@ -168,10 +168,6 @@ class TestIssuerInternal(Elaboratable): msr_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,18 +240,7 @@ class TestIssuerInternal(Elaboratable): with m.If(fetch_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<