# 3 bits, unary: return the port
if regfile == 'XER':
return port
- # 3 bits, unary: return the port
- if regfile == 'SVSTATE':
+ # 5 bits, unary: return the port
+ if regfile == 'STATE':
return port
# 9 bits (9 entries), might be unary already
if regfile == 'FAST':
# hack method of keeping an eye on whether branch/trap set the PC
self.state_nia = self.core.regs.rf['state'].w_ports['nia']
self.state_nia.wen.name = 'state_nia_wen'
+ # and whether SPR pipeline sets DEC or TB
+ self.state_spr = self.core.regs.rf['state'].w_ports['state1']
# pulse to synchronize the simulator at instruction end
self.insn_done = Signal()
m.submodules["sram4k_%d" % i] = csd(sram)
comb += sram.enable.eq(self.wb_sram_en)
- # terrible hack to stop a potential race condition. if core
- # is doing any operation (at all) pause the DEC/TB FSM
- comb += self.pause_dec_tb.eq(core.pause_dec_tb)
-
# XICS interrupt handler
if self.xics:
m.submodules.xics_icp = icp = csd(self.xics_icp)
# instruction started: must wait till it finishes
with m.State("INSN_ACTIVE"):
- # note changes to MSR, PC and SVSTATE
- # XXX oops, really must monitor *all* State Regfile write
- # ports looking for changes!
+ # note changes to MSR, PC and SVSTATE, and DEC/TB
+ # these last two are done together, and passed to the
+ # DEC/TB FSM
with m.If(self.state_nia.wen & (1 << StateRegs.SVSTATE)):
sync += self.sv_changed.eq(1)
with m.If(self.state_nia.wen & (1 << StateRegs.MSR)):
sync += self.msr_changed.eq(1)
with m.If(self.state_nia.wen & (1 << StateRegs.PC)):
sync += self.pc_changed.eq(1)
+ with m.If((self.state_spr.wen &
+ ((1 << StateRegs.DEC) | (1 << StateRegs.TB))).bool()):
+ comb += self.pause_dec_tb.eq(1)
with m.If(~core_busy_o): # instruction done!
comb += exec_pc_o_valid.eq(1)
with m.If(exec_pc_i_ready):