move "exception happened" detection from TestIssuer to Core
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 8 Nov 2021 14:19:14 +0000 (14:19 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 8 Nov 2021 14:19:14 +0000 (14:19 +0000)
src/soc/simple/core.py
src/soc/simple/issuer.py

index a36fc92ac480e4ed01fd5eb82c9ac9a65c9511c3..9343081c5516c0fee8c0410241943f648c2005d4 100644 (file)
@@ -113,9 +113,11 @@ class CoreOutput:
     def __init__(self):
         # start/stop and terminated signalling
         self.core_terminate_o = Signal(reset=0)  # indicates stopped
+        self.exc_happened = Signal()             # exception happened
 
     def eq(self, i):
         self.core_terminate_o.eq(i.core_terminate_o)
+        self.exc_happened.eq(i.exc_happened)
 
 
 # derive from ControlBase rather than have a separate Stage instance,
@@ -236,6 +238,14 @@ class NonProductionCore(ControlBase):
         self.connect_rdports(m, fu_bitdict)
         self.connect_wrports(m, fu_bitdict)
 
+        # note if an exception happened.  in a pipelined or OoO design
+        # this needs to be accompanied by "shadowing" (or stalling)
+        el = []
+        for exc in self.fus.excs.values():
+            el.append(exc.happened)
+        if len(el) > 0: # at least one exception
+            comb += self.o.exc_happened.eq(Cat(*el).bool())
+
         return m
 
     def connect_instruction(self, m):
index e917756e187bf7150e291994f7c8c2a66c266f45..b5dc3784c69f5cbbf04fc75d5ae181291cb8a510 100644 (file)
@@ -604,12 +604,7 @@ class TestIssuerInternal(Elaboratable):
 
         # note if an exception happened.  in a pipelined or OoO design
         # this needs to be accompanied by "shadowing" (or stalling)
-        el = []
-        for exc in core.fus.excs.values():
-            el.append(exc.happened)
-        exc_happened = Signal()
-        if len(el) > 0: # at least one exception
-            comb += exc_happened.eq(Cat(*el).bool())
+        exc_happened = self.core.o.exc_happened
 
         with m.FSM(name="issue_fsm"):