hooray, p_o_ready works
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 5 Apr 2019 22:37:12 +0000 (23:37 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 5 Apr 2019 22:37:12 +0000 (23:37 +0100)
src/add/singlepipe.py
src/add/test_buf_pipe.py

index e32a0c67a2665176bd92c4c95247621c5ed139c5..2cb7d1ab06bacdc11f95ac14848d0b2b70aed308 100644 (file)
@@ -197,8 +197,12 @@ class PrevControl:
         vlen = len(self.i_valid)
         if vlen > 1: # multi-bit case: valid only when i_valid is all 1s
             all1s = Const(-1, (len(self.i_valid), False))
+            if self.stage_ctl:
+                return self.i_valid == all1s & self.s_o_ready
             return self.i_valid == all1s
         # single-bit i_valid case
+        if self.stage_ctl:
+            return self.i_valid & self.s_o_ready
         return self.i_valid
 
 
index 7cdb7ebdedbf467e9296767dbb277bf0dd45df9c..28a48db4eb590439e7859dcf8dd2015424795785 100644 (file)
@@ -587,7 +587,7 @@ class ExampleStageDelayCls(StageCls):
     """
 
     def __init__(self):
-        self.count = Signal(3)
+        self.count = Signal(2)
 
     def ispec(self):
         return Signal(16, name="example_input_signal")
@@ -597,7 +597,6 @@ class ExampleStageDelayCls(StageCls):
 
     @property
     def p_o_ready(self):
-        return Const(1)
         return self.count == 0
 
     @property
@@ -611,7 +610,7 @@ class ExampleStageDelayCls(StageCls):
 
     def elaborate(self, platform):
         m = Module()
-        m.d.sync += self.count.eq(~self.count)
+        m.d.sync += self.count.eq(self.count + 1)
         return m