From 33b337225810486ca6900ccc2dfe4a250f715e82 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 24 May 2019 17:50:18 +0100 Subject: [PATCH] put internal state out as part of latch api --- src/nmutil/latch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nmutil/latch.py b/src/nmutil/latch.py index 6cf5ab7e..0833ae61 100644 --- a/src/nmutil/latch.py +++ b/src/nmutil/latch.py @@ -33,14 +33,15 @@ def latchregister(m, incoming, outgoing, settrue): class SRLatch(Elaboratable): def __init__(self, sync=True): self.sync = sync - self.s = Signal(reset_less=True) - self.r = Signal(reset_less=True) + self.s = Signal(reset=0) + self.r = Signal(reset=1) # defaults to off self.q = Signal(reset_less=True) self.qn = Signal(reset_less=True) + self.qlq = Signal() def elaborate(self, platform): m = Module() - q_int = Signal(reset_less=True) + q_int = self.qlq if self.sync: with m.If(self.s): -- 2.30.2