self.m = ControlBase._elaborate(self, platform)
+ r_busy = Signal()
result = self.stage.ospec()
if hasattr(self.stage, "setup"):
self.stage.setup(self.m, self.p.i_data)
# previous valid and ready
with self.m.If(p_i_valid_p_o_ready):
- self.m.d.sync += [self.n.o_valid.eq(1), # output valid
+ self.m.d.sync += [r_busy.eq(1), # output valid
+ #self.n.o_valid.eq(1), # output valid
eq(self.n.o_data, result), # update output
]
# previous invalid or not ready, however next is accepting
with self.m.Elif(n_i_ready):
self.m.d.sync += [ eq(self.n.o_data, result)]
# TODO: could still send data here (if there was any)
- self.m.d.sync += self.n.o_valid.eq(0) # ...so set output invalid
+ #self.m.d.sync += self.n.o_valid.eq(0) # ...so set output invalid
+ self.m.d.sync += r_busy.eq(0) # ...so set output invalid
+ self.m.d.comb += self.n.o_valid.eq(r_busy)
# if next is ready, so is previous
self.m.d.comb += self.p._o_ready.eq(n_i_ready)
for i in range(num_tests):
data.append(1<<((i*3)%15))
#data.append(randint(0, 1<<16-2))
- print (hex(data[-1]))
+ #print (hex(data[-1]))
return data
# Test 13
######################################################################
-class ExampleUnBufDelayedPipe(BufferedPipeline2):
+class ExampleUnBufDelayedPipe(BufferedPipeline):
def __init__(self):
- stage = ExampleStageDelayCls(valid_trigger=1)
- BufferedPipeline2.__init__(self, stage, stage_ctl=True)
+ stage = ExampleStageDelayCls(valid_trigger=3)
+ BufferedPipeline.__init__(self, stage, stage_ctl=True)
def elaborate(self, platform):
- m = BufferedPipeline2.elaborate(self, platform)
+ m = BufferedPipeline.elaborate(self, platform)
m.submodules.stage = self.stage
return m
# Unit Tests
######################################################################
-num_tests = 10
+num_tests = 100
if __name__ == '__main__':
print ("test 1")