From a5d3936b335ceaef952a53e98b06bd5dcdc1f295 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 31 Jan 2022 16:13:15 +0000 Subject: [PATCH] store latch next in temporary --- src/nmutil/latch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nmutil/latch.py b/src/nmutil/latch.py index f4c03ab..e250508 100644 --- a/src/nmutil/latch.py +++ b/src/nmutil/latch.py @@ -74,11 +74,13 @@ class SRLatch(Elaboratable): def elaborate(self, platform): m = Module() - m.d.sync += self.q_int.eq((self.q_int & ~self.r) | self.s) + next_o = Signal(self.llen, reset_less=True) + m.d.comb += next_o.eq((self.q_int & ~self.r) | self.s) + m.d.sync += self.q_int.eq(next_o) if self.sync: m.d.comb += self.q.eq(self.q_int) else: - m.d.comb += self.q.eq((self.q_int & ~self.r) | self.s) + m.d.comb += self.q.eq(next_o) m.d.comb += self.qn.eq(~self.q) m.d.comb += self.qlq.eq(self.q | self.q_int) # useful output -- 2.30.2