return latchregister results so that it can be further set/modified
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 8 Nov 2021 23:33:02 +0000 (23:33 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 8 Nov 2021 23:33:02 +0000 (23:33 +0000)
src/nmutil/latch.py

index 908c15cecf7ea77c955047934fa59704481adb9a..5cf50bccb7fbff2f7a6b5bfe166ee2abf73dc33c 100644 (file)
@@ -47,6 +47,7 @@ def latchregister(m, incoming, outgoing, settrue, name=None):
     m.d.comb += outgoing.eq(Mux(settrue, incoming, reg))
     with m.If(settrue): # pass in some kind of expression/condition here
         m.d.sync += reg.eq(incoming)      # latch input into register
+    return reg
 
 
 def mkname(prefix, suffix):