From: Luke Kenneth Casson Leighton Date: Fri, 19 Mar 2021 14:04:23 +0000 (+0000) Subject: move duplicated code to a function in TestIssuer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f02bf3ecdaea89029e9c6016c4aa5e477e676b9;p=soc.git move duplicated code to a function in TestIssuer --- diff --git a/src/soc/simple/issuer.py b/src/soc/simple/issuer.py index 3e7cd22b..872e2e95 100644 --- a/src/soc/simple/issuer.py +++ b/src/soc/simple/issuer.py @@ -52,6 +52,25 @@ def get_insn(f_instr_o, pc): # 64-bit: bit 2 of pc decides which word to select return f_instr_o.word_select(pc[2], 32) +# gets state input or reads from state regfile +def state_get(m, state_i, name, regfile, regnum): + comb = m.d.comb + sync = m.d.sync + # read the PC + res = Signal(64, reset_less=True, name=name) + res_ok_delay = Signal(name="%s_ok_delay" % name) + sync += res_ok_delay.eq(~state_i.ok) + with m.If(state_i.ok): + # incoming override (start from pc_i) + comb += res.eq(state_i.data) + with m.Else(): + # otherwise read StateRegs regfile for PC... + comb += regfile.ren.eq(1<