add pause_dec_tb signal (not very sophisticated) to Core
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 17 Jan 2022 11:59:56 +0000 (11:59 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 17 Jan 2022 11:59:56 +0000 (11:59 +0000)
TODO, detect MTSPR and DEC/TB SPR being written to, but for now just
detect an entire SPR pipeline

src/soc/simple/core.py

index 74d96a87b26b2144c78a7e38aa45b71c0cb802ee..8df7e17ad1d1525233404694cb7602e708227b4d 100644 (file)
@@ -218,6 +218,10 @@ class NonProductionCore(ControlBase):
         if "mmu0" in self.decoders:
             self.decoders["mmu0"].mmu0_spr_dec = self.decoders["spr0"]
 
+        # allow pausing of the DEC/TB FSM back in Issuer, by spotting
+        # if there is an MTSPR instruction
+        self.pause_dec_tb = Signal()
+
     # next 3 functions are Stage API Compliance
     def setup(self, m, i):
         pass
@@ -511,6 +515,13 @@ class NonProductionCore(ControlBase):
                     funame.lower().startswith('trap')):
                     with m.If(fu.busy_o):
                         comb += busy_o.eq(1)
+                # for SPR pipeline pause dec/tb FSM to avoid race condition
+                # TODO: really this should be much more sophisticated,
+                # spot MTSPR, spot that DEC/TB is what is to be updated.
+                # a job for PowerDecoder2, there
+                if funame.lower().startswith('spr'):
+                    with m.If(fu.busy_o):
+                        comb += self.pause_dec_tb.eq(1)
 
         # return both the function unit "enable" dict as well as the "busy".
         # the "busy-or-issued" can be passed in to the Read/Write port