add signal for resetting trap internal state (kaivb cache)
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 4 Jul 2022 15:12:46 +0000 (16:12 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 4 Jul 2022 15:12:46 +0000 (16:12 +0100)
src/soc/fu/trap/main_stage.py

index 2498cfd1cf6bed2b66e5bf05b6dbb3fe238b9df4..8127e226e34afaf5cf87489bb86fa04a39a544e1 100644 (file)
@@ -59,6 +59,7 @@ class TrapMainStage(PipeModBase):
         self.fields = DecodeFields(SignalBitRange, [self.i.ctx.op.insn])
         self.fields.create_specs()
         self.kaivb = Signal(64) # KAIVB SPR
+        self.state_reset = Signal() # raise high to reset KAIVB cache
 
     def trap(self, m, trap_addr, return_addr):
         """trap.  sets new PC, stores MSR and old PC in SRR1 and SRR0
@@ -153,6 +154,10 @@ class TrapMainStage(PipeModBase):
         srr0_o, srr1_o, svsrr0_o = self.o.srr0, self.o.srr1, self.o.svsrr0
         traptype, trapaddr = op.traptype, op.trapaddr
 
+        # hard reset of KAIVB
+        with m.If(self.state_reset):
+            sync += self.kaivb.eq(0)
+
         # take copy of D-Form TO field
         i_fields = self.fields.FormD
         to = Signal(i_fields.TO[0:-1].shape())