From 6861d8f62cd1e077db19f8c5fd9a6c3223c575c6 Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Mon, 25 May 2020 19:28:43 -0300 Subject: [PATCH] Implement the issue_i/busy_o protocol check. It will timeout, until the rel/go signals are implemented. --- src/soc/experiment/compalu_multi.py | 46 ++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/soc/experiment/compalu_multi.py b/src/soc/experiment/compalu_multi.py index 33a2492b..081472ee 100644 --- a/src/soc/experiment/compalu_multi.py +++ b/src/soc/experiment/compalu_multi.py @@ -385,27 +385,59 @@ class CompUnitParallelTest: ): self.dut = dut + # Operation cycle should not take longer than this: + self.MAX_BUSY_WAIT = 50 + def driver(self): + + print("Begin parallel test.") + + # issue_i starts inactive yield self.dut.issue_i.eq(0) yield + # busy_o must start inactive + # TODO: Check a few times that busy_o doesn't rise on its own busy_o = yield self.dut.busy_o - print("Driver: busy_o =", busy_o) + assert not busy_o - print("Driver: activating issue_i") + # activate issue_i to begin the operation cycle yield self.dut.issue_i.eq(1) yield + # busy_o must keep being low in this cycle, because issue_i was + # low on the previous cycle. + # It cannot rise on its own. + # Also, busy_o and issue_i must never be active at the same time, ever. busy_o = yield self.dut.busy_o - print("Driver: busy_o =", busy_o) + assert not busy_o - print("Driver: de-activating issue_i") + # Lower issue_i yield self.dut.issue_i.eq(0) yield - # TODO: while-loop on busy (see ldst comp unit for suitable function) - busy_o = yield self.dut.busy_o - print("Driver: busy_o =", busy_o) + # wait for busy_o to lower + # timeout after self.MAX_BUSY_WAIT cycles + for n in range(self.MAX_BUSY_WAIT): + # sample busy_o in the current cycle + busy_o = yield self.dut.busy_o + if not busy_o: + # operation cycle ends when busy_o becomes inactive + break + yield + + # if busy_o is still active, a timeout has occurred + # TODO: Uncomment this, once the test is complete: + # assert not busy_o + + if busy_o: + print("If you are reading this, " + "it's because the above test failed, as expected,\n" + "with a timeout. It must pass, once the test is complete.") + return + + print("If you are reading this, " + "it's because the above test unexpectedly passed.") def monitor(self): # TODO: as a while-loop. first loop on busy *not* set, -- 2.30.2