put internal state out as part of latch api
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 May 2019 16:50:18 +0000 (17:50 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 24 May 2019 16:50:18 +0000 (17:50 +0100)
src/nmutil/latch.py

index 6cf5ab7ec93e5de0752cdfd2cf00f56c4edf7d8c..0833ae61b5a7137e5483b8e41d5884fb4273c824 100644 (file)
@@ -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):