From d8325c11939e4ddcd9ebe8265766c72aeebbd42e Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Mon, 25 May 2020 11:53:42 -0300 Subject: [PATCH] Proof of concept of a parallel test It doesn't work as expected. For some reason, only the driver sees the rise of busy_o. --- src/soc/experiment/compalu_multi.py | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/soc/experiment/compalu_multi.py b/src/soc/experiment/compalu_multi.py index 2f6754c3..5d671eab 100644 --- a/src/soc/experiment/compalu_multi.py +++ b/src/soc/experiment/compalu_multi.py @@ -378,6 +378,38 @@ def test_compunit(): run_simulation(m, scoreboard_sim(dut), vcd_name='test_compunit1.vcd') +class CompUnitParallelTest: + def __init__(self, dut): + self.dut = dut + + def driver(self): + yield self.dut.issue_i.eq(0) + yield + + busy_o = yield self.dut.busy_o + print("Driver: busy_o =", busy_o) + + print("Driver: activating issue_i") + yield self.dut.issue_i.eq(1) + yield + + busy_o = yield self.dut.busy_o + print("Driver: busy_o =", busy_o) + + print("Driver: de-activating issue_i") + yield self.dut.issue_i.eq(0) + yield + + busy_o = yield self.dut.busy_o + print("Driver: busy_o =", busy_o) + + def monitor(self): + busy_o = yield self.dut.busy_o + for i in range(10): + print(" Monitor: busy_o =", busy_o) + yield + + def test_compunit_regspec1(): from alu_hier import ALU from soc.fu.alu.alu_input_record import CompALUOpSubset @@ -401,6 +433,12 @@ def test_compunit_regspec1(): run_simulation(m, scoreboard_sim(dut), vcd_name='test_compunit_regspec1.vcd') + test = CompUnitParallelTest(dut) + run_simulation(dut, [test.driver(), + test.monitor() + ], + vcd_name="test_compunit_parallel.vcd") + if __name__ == '__main__': test_compunit() -- 2.30.2