reserve writes in Issue Phase, add comment
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 2 May 2023 18:49:50 +0000 (19:49 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 2 May 2023 18:49:50 +0000 (19:49 +0100)
src/openpower/cyclemodel/inorder.py

index 525d81c604597b16cafb82388d76dd1d413b872e..c1f8c0576ccd2e75933e85bc2bc4b89de5a856d2 100644 (file)
@@ -4,6 +4,16 @@
 # Funded by NLnet
 #
 # Bugs: https://bugs.libre-soc.org/show_bug.cgi?id=1039
+"""
+    CPU:   Fetch   <- log file
+            |
+           Decode  <- works out read/write regs
+            |
+           Issue   <- checks read-regs, sets write-regs
+            |
+           Execute  -> stages (countdown) clears write-regs
+
+"""
 
 class RegisterWrite(set):
     """RegisterWrite: contains the set of Read-after-Write Hazards.
@@ -91,12 +101,15 @@ class Decode:
 
     def process_instructions(self, stall):
         if stall: return stall
-        insn, writeregs, readregs = self.stages[0] # get current instruction
+        # get current instruction
+        insn, writeregs, readregs = self.stages[0]
         # check that the readregs are all available
         reads_possible = self.cpu.reads_possible(readregs):
         stall = reads_possible != readregs
         # perform the "reads" that are possible in this cycle
         readregs.difference_update(reads_possible)
+        # and "Reserves" the writes
+        self.cpu.expect_write(writeregs)
         return stall