Check completion of the sub-processes
authorCesar Strauss <cestrauss@gmail.com>
Wed, 3 Jun 2020 09:30:04 +0000 (06:30 -0300)
committerCesar Strauss <cestrauss@gmail.com>
Wed, 3 Jun 2020 09:30:04 +0000 (06:30 -0300)
This detects the case where busy_o goes low before the rel / go
cycle finishes.

src/soc/experiment/test/test_compalu_multi.py

index 64b8daec8047872cc05b3e8319c87119fc875cdd..9399908d6d32e65d2440584f6ee2676e3597cb52 100644 (file)
@@ -142,6 +142,9 @@ class CompUnitParallelTest:
         # input data:
         self.operands = (0, 0)
 
+        # Indicates completion of the sub-processes
+        self.rd_complete = [False, False]
+
     def driver(self):
         print("Begin parallel test.")
         yield from self.operation(5, 2, InternalOp.OP_ADD, inv_a=0,
@@ -159,9 +162,16 @@ class CompUnitParallelTest:
         self.imm_control = (zero_a, imm_ok)
         self.rdmaskn = rdmaskn
 
+        # Initialize completion flags
+        self.rd_complete = [False, False]
+
         # trigger operation cycle
         yield from self.issue()
 
+        # check that the sub-processes completed, before the busy_o cycle ended
+        for completion in self.rd_complete:
+            assert completion
+
     def issue(self):
         # issue_i starts inactive
         yield self.dut.issue_i.eq(0)
@@ -248,6 +258,7 @@ class CompUnitParallelTest:
         # TODO: don't exit the process, monitor rd instead to ensure it
         #       doesn't rise on its own
         if self.rdmaskn[rd_idx] or self.imm_control[rd_idx]:
+            self.rd_complete[rd_idx] = True
             return
 
         # issue_i has risen. rel must rise on the next cycle
@@ -291,6 +302,11 @@ class CompUnitParallelTest:
         rel = yield self.dut.rd.rel[rd_idx]
         assert not rel
 
+        self.rd_complete[rd_idx] = True
+
+        # TODO: check that rel doesn't rise again until the end of the
+        #       busy_o cycle
+
     def wr(self, wr_idx):
         # monitor self.dut.wr.req[rd_idx] and sets dut.wr.go[idx] for one cycle
         yield