From faf46e0e0efd0c43e2d991ea4eaaca30fdd30701 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 18 Mar 2022 10:00:13 +0000 Subject: [PATCH] turn CompALU/CompLDST latches synchronous to cut down combinatorial loops --- src/soc/experiment/compalu_multi.py | 2 +- src/soc/experiment/compldst_multi.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/soc/experiment/compalu_multi.py b/src/soc/experiment/compalu_multi.py index d33be619..3d1f7249 100644 --- a/src/soc/experiment/compalu_multi.py +++ b/src/soc/experiment/compalu_multi.py @@ -258,7 +258,7 @@ class MultiCompUnit(RegSpecALUAPI, Elaboratable): # src operand latch (not using go_wr_i) ANDed with rdmask rdmaskn = Signal(self.n_src) latchregister(m, self.rdmaskn, rdmaskn, self.issue_i, name="rdmask_l") - m.d.comb += src_l.s.eq(Repl(self.issue_i, self.n_src) & ~rdmaskn) + m.d.sync += src_l.s.eq(Repl(self.issue_i, self.n_src) & ~rdmaskn) m.d.sync += src_l.r.eq(reset_r) # dest operand latch (not using issue_i) diff --git a/src/soc/experiment/compldst_multi.py b/src/soc/experiment/compldst_multi.py index 094fbc6d..2a54e51b 100644 --- a/src/soc/experiment/compldst_multi.py +++ b/src/soc/experiment/compldst_multi.py @@ -266,7 +266,7 @@ class LDSTCompUnit(RegSpecAPI, Elaboratable): ##################### # latches for the FSM. - m.submodules.opc_l = opc_l = SRLatch(sync=False, name="opc") + m.submodules.opc_l = opc_l = SRLatch(sync=True, name="opc") m.submodules.src_l = src_l = SRLatch(False, self.n_src, name="src") m.submodules.alu_l = alu_l = SRLatch(sync=False, name="alu") m.submodules.adr_l = adr_l = SRLatch(sync=False, name="adr") @@ -372,8 +372,8 @@ class LDSTCompUnit(RegSpecAPI, Elaboratable): # opcode latch - inverted so that busy resets to 0 # note this MUST be sync so as to avoid a combinatorial loop # between busy_o and issue_i on the reset latch (rst_l) - sync += opc_l.s.eq(issue_i) # XXX NOTE: INVERTED FROM book! - sync += opc_l.r.eq(reset_o) # XXX NOTE: INVERTED FROM book! + comb += opc_l.s.eq(issue_i) # XXX NOTE: INVERTED FROM book! + comb += opc_l.r.eq(reset_o) # XXX NOTE: INVERTED FROM book! # src operand latch sync += src_l.s.eq(Repl(issue_i, self.n_src) & ~self.rdmaskn) -- 2.30.2