From 23496ffdd3e5f130b851250a7a36659cbfd51870 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 8 Apr 2019 11:55:41 +0100 Subject: [PATCH] add more unit tests of PassThroughHandshake --- src/add/test_buf_pipe.py | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/add/test_buf_pipe.py b/src/add/test_buf_pipe.py index b0dfa4dc..3a15ab6d 100644 --- a/src/add/test_buf_pipe.py +++ b/src/add/test_buf_pipe.py @@ -728,6 +728,61 @@ def test_identical_resultfn(o_data, expected, i, o): % (i, o, o_data, res) +###################################################################### +# Test 19 +###################################################################### + +class ExamplePassAdd1Pipe(PassThroughHandshake): + + def __init__(self): + stage = ExampleStageCls() + PassThroughHandshake.__init__(self, stage) + + +class ExampleBufPassThruPipe(ControlBase): + + def elaborate(self, platform): + m = ControlBase._elaborate(self, platform) + + # XXX currently fails: any other permutation works fine. + # p1=u,p2=b ok p1=u,p2=u ok p1=b,p2=b ok + # also fails using UnbufferedPipeline as well + pipe1 = ExampleBufModeAdd1Pipe() + pipe2 = ExamplePassAdd1Pipe() + + m.submodules.pipe1 = pipe1 + m.submodules.pipe2 = pipe2 + + m.d.comb += self.connect([pipe1, pipe2]) + + return m + + +###################################################################### +# Test 997 +###################################################################### + +class ExampleBufPassThruPipe2(ControlBase): + + def elaborate(self, platform): + m = ControlBase._elaborate(self, platform) + + # XXX currently fails: any other permutation works fine. + # p1=u,p2=b ok p1=u,p2=u ok p1=b,p2=b ok + # also fails using UnbufferedPipeline as well + #pipe1 = ExampleUnBufAdd1Pipe() + #pipe2 = ExampleBufAdd1Pipe() + pipe1 = ExampleBufAdd1Pipe() + pipe2 = ExamplePassAdd1Pipe() + + m.submodules.pipe1 = pipe1 + m.submodules.pipe2 = pipe2 + + m.d.comb += self.connect([pipe1, pipe2]) + + return m + + ###################################################################### # Test 998 ###################################################################### @@ -964,6 +1019,30 @@ if __name__ == '__main__': with open("test_passthru18.il", "w") as f: f.write(vl) + print ("test 19") + dut = ExampleBufPassThruPipe() + data = data_chain1() + test = Test5(dut, test9_resultfn, data=data) + run_simulation(dut, [test.send, test.rcv], vcd_name="test_bufpass19.vcd") + ports = [dut.p.i_valid, dut.n.i_ready, + dut.n.o_valid, dut.p.o_ready] + \ + [dut.p.i_data] + [dut.n.o_data] + vl = rtlil.convert(dut, ports=ports) + with open("test_bufpass19.il", "w") as f: + f.write(vl) + + print ("test 997") + dut = ExampleBufPassThruPipe2() + data = data_chain1() + test = Test5(dut, test9_resultfn, data=data) + run_simulation(dut, [test.send, test.rcv], vcd_name="test_bufpass997.vcd") + ports = [dut.p.i_valid, dut.n.i_ready, + dut.n.o_valid, dut.p.o_ready] + \ + [dut.p.i_data] + [dut.n.o_data] + vl = rtlil.convert(dut, ports=ports) + with open("test_bufpass997.il", "w") as f: + f.write(vl) + print ("test 998 (fails, bug)") dut = ExampleBufPipe3() data = data_chain1() -- 2.30.2