cleanup, docstrings
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 May 2019 06:55:06 +0000 (07:55 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 May 2019 06:55:06 +0000 (07:55 +0100)
src/experiment/cscore.py
src/experiment/score6600.py
src/scoreboard/shadow.py

index ff66b91e229010a9242602f37653b56a97e5d3f9..18b71c80c757afeea0b8d0dfc8dd8549cebe5c0f 100644 (file)
@@ -161,8 +161,6 @@ class Scoreboard(Elaboratable):
         # connect Function Units
         #---------
 
-        # XXX sync, again to avoid an infinite loop.  is it the right thing???
-
         # Group Picker... done manually for now.  TODO: cat array of pick sigs
         m.d.comb += if_l[0].go_rd_i.eq(intpick1.go_rd_o[0]) # add rd
         m.d.comb += if_l[0].go_wr_i.eq(intpick1.go_wr_o[0]) # add wr
index d67325cbf402c49dcf414eb975cf70b03f982998..1ac6ec11d07506f9f97a0325bfa219a7b7f37975 100644 (file)
@@ -237,14 +237,12 @@ class Scoreboard(Elaboratable):
         # Shadow Matrix.  currently n_int_fus shadows, to be used for
         # write-after-write hazards
         m.submodules.shadows = shadows = ShadowMatrix(n_int_fus, n_int_fus)
+        # combined go_rd/wr + go_die (go_die used to reset latches)
         go_rd_rst = Signal(n_int_fus, reset_less=True)
         go_wr_rst = Signal(n_int_fus, reset_less=True)
-
-        # Write-after-Write grid: selects one shadow to enable, based
-        # on which unit(s) have writes pending and the current instruction
-        # also needing to write
-        m.submodules.wawgrid = wawgrid = WaWGrid(n_int_fus, n_int_fus)
+        # record previous instruction to cast shadow on current instruction
         fn_issue_prev = Signal(n_int_fus)
+        prev_shadow = Signal(n_int_fus)
 
         #---------
         # ok start wiring things together...
@@ -330,17 +328,11 @@ class Scoreboard(Elaboratable):
         with m.If(fn_issue_o): # only update prev bit if instruction issued
             m.d.sync += fn_issue_prev.eq(fn_issue_o)
 
-        # now the "2D-bit-array-linked-list" can be created, with the
-        # relationships of the previous and current instruction.
-        # *previous* instruction shadows *current* instruction
-        #m.d.comb += wawgrid.shadow_i.eq(fn_issue_prev & cu.busy_o & ~fn_issue_o)
-        #m.d.comb += wawgrid.fu_i.eq(fn_issue_o)
-
-        # and now we can connect the wawgrid to the shadow matrix.  whewww
+        # *previous* instruction shadows *current* instruction, and, obviously,
+        # if the previous is completed (!busy) don't cast the shadow!
+        m.d.comb += prev_shadow.eq(~fn_issue_o & fn_issue_prev & cu.busy_o)
         for i in range(n_int_fus):
-            m.d.comb += shadows.shadow_i[i].eq(\
-                        ~fn_issue_o & fn_issue_prev & cu.busy_o)
-            #m.d.comb += shadows.shadow_i[i].eq(wawgrid.waw_o[i])
+            m.d.comb += shadows.shadow_i[i].eq(prev_shadow)
 
         #---------
         # Connect Register File(s)
@@ -448,7 +440,7 @@ def scoreboard_sim(dut, alusim):
 
     yield dut.int_store_i.eq(1)
 
-    for i in range(20):
+    for i in range(2):
 
         # set random values in the registers
         for i in range(1, dut.n_regs):
index 8b6a11432fed6d514a5a2d79ca318ff4b3b62ac8..f0908c64077560677e27c2c635d052fc947fe07c 100644 (file)
@@ -25,13 +25,16 @@ class Shadow(Elaboratable):
         self.shadow_wid = shadow_wid
 
         if shadow_wid:
+            # inputs
             self.issue_i = Signal(reset_less=True)
             self.shadow_i = Signal(shadow_wid, reset_less=True)
             self.s_fail_i = Signal(shadow_wid, reset_less=True)
             self.s_good_i = Signal(shadow_wid, reset_less=True)
+            # outputs
             self.go_die_o = Signal(reset_less=True)
             self.shadown_o = Signal(reset_less=True)
         else:
+            # outputs when no shadowing needed
             self.shadown_o = Const(1)
             self.go_die_o = Const(0)