use internal latch qlq value instead of creating a separate sync register
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 May 2019 16:54:43 +0000 (17:54 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 May 2019 16:54:43 +0000 (17:54 +0100)
src/scoreboard/dependence_cell.py
src/scoreboard/fu_dep_cell.py
src/scoreboard/shadow.py
src/scoreboard/shadow_fn.py

index fa0ff11a7da3920ab092fc5ee020fb9d7df3714e..242c5a435a81282959a4d0193fbcd1be42247f2e 100644 (file)
@@ -42,10 +42,6 @@ class DepCell(Elaboratable):
         m = Module()
         m.submodules.l = l = SRLatch(sync=False) # async latch
 
         m = Module()
         m.submodules.l = l = SRLatch(sync=False) # async latch
 
-        # record current version of q in a sync'd register
-        cq = Signal() # resets to 0
-        m.d.sync += cq.eq(l.q)
-
         # reset on go HI, set on dest and issue
         m.d.comb += l.s.eq(self.issue_i & self.reg_i)
         m.d.comb += l.r.eq(self.go_i)
         # reset on go HI, set on dest and issue
         m.d.comb += l.s.eq(self.issue_i & self.reg_i)
         m.d.comb += l.r.eq(self.go_i)
@@ -54,9 +50,8 @@ class DepCell(Elaboratable):
         m.d.comb += self.fwd_o.eq((l.q) & self.hazard_i) # & ~self.issue_i)
 
         # Register Select. Activated on go read/write and *current* latch set
         m.d.comb += self.fwd_o.eq((l.q) & self.hazard_i) # & ~self.issue_i)
 
         # Register Select. Activated on go read/write and *current* latch set
-        m.d.comb += self.rsel_o.eq((cq | l.q) & self.go_i)
-
-        m.d.comb += self.q_o.eq(cq | l.q)
+        m.d.comb += self.q_o.eq(l.qlq)
+        m.d.comb += self.rsel_o.eq(self.q_o & self.go_i)
 
         return m
 
 
         return m
 
index 544c3265882450fbb84c0bb51eba047f77b1ce65..4ac2a6daa76034c20339cb74bb2708259456e3eb 100644 (file)
@@ -20,16 +20,12 @@ class DepCell(Elaboratable):
         m = Module()
         m.submodules.l = l = SRLatch(sync=False) # async latch
 
         m = Module()
         m.submodules.l = l = SRLatch(sync=False) # async latch
 
-        # record current version of q in a sync'd register
-        cq = Signal() # resets to 0
-        m.d.sync += cq.eq(l.q)
-
         # reset on go HI, set on dest and issue
         m.d.comb += l.s.eq(self.issue_i & self.pend_i)
         m.d.comb += l.r.eq(self.go_i)
 
         # wait out
         # reset on go HI, set on dest and issue
         m.d.comb += l.s.eq(self.issue_i & self.pend_i)
         m.d.comb += l.r.eq(self.go_i)
 
         # wait out
-        m.d.comb += self.wait_o.eq((cq | l.q) & ~self.issue_i)
+        m.d.comb += self.wait_o.eq(l.qlq & ~self.issue_i)
 
         return m
 
 
         return m
 
index c1d77a0229835913fbf334416b27850837dcadbf..1b8903dcd38872611ff4cb03e75d5ec86c05bb80 100644 (file)
@@ -3,8 +3,6 @@ from nmigen.cli import verilog, rtlil
 from nmigen import Module, Signal, Cat, Array, Const, Elaboratable, Repl
 from nmigen.lib.coding import Decoder
 
 from nmigen import Module, Signal, Cat, Array, Const, Elaboratable, Repl
 from nmigen.lib.coding import Decoder
 
-from nmutil.latch import SRLatch, latchregister
-
 from scoreboard.shadow_fn import ShadowFn
 
 
 from scoreboard.shadow_fn import ShadowFn
 
 
index b7edf8e9929c90dae85f0c27f2071eadbb8f7aa0..bb91e312e1ddb3509a091ea82441e9e305f1834c 100644 (file)
@@ -23,13 +23,10 @@ class ShadowFn(Elaboratable):
         m = Module()
         m.submodules.sl = sl = SRLatch(sync=False)
 
         m = Module()
         m.submodules.sl = sl = SRLatch(sync=False)
 
-        cq = Signal() # resets to 0
-        m.d.sync += cq.eq(sl.q)
-
         m.d.comb += sl.s.eq(self.shadow_i & self.issue_i & ~self.s_good_i)
         m.d.comb += sl.r.eq(self.s_good_i | (self.issue_i & ~self.shadow_i))
         m.d.comb += sl.s.eq(self.shadow_i & self.issue_i & ~self.s_good_i)
         m.d.comb += sl.r.eq(self.s_good_i | (self.issue_i & ~self.shadow_i))
-        m.d.comb += self.recover_o.eq((cq | sl.q) & self.s_fail_i)
-        m.d.comb += self.shadow_o.eq((cq | sl.q))
+        m.d.comb += self.recover_o.eq(sl.qlq & self.s_fail_i)
+        m.d.comb += self.shadow_o.eq(sl.qlq)
 
         return m
 
 
         return m