From 7f4015949019da87d10cc12889dd2ed1525bc88b Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Mon, 6 Jul 2020 08:12:59 -0300 Subject: [PATCH] Assert n.ready_i at the beginning of the cycle This simulates the common case where we are ready for the result as soon as the ALU delivers it. The special case for the zero-delay operation is no longer needed. --- src/soc/experiment/alu_hier.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/soc/experiment/alu_hier.py b/src/soc/experiment/alu_hier.py index fd5add20..828511b6 100644 --- a/src/soc/experiment/alu_hier.py +++ b/src/soc/experiment/alu_hier.py @@ -392,24 +392,7 @@ def run_op(dut, a, b, op, inv_a=0): yield dut.op.invert_a.eq(inv_a) yield dut.n.ready_i.eq(0) yield dut.p.valid_i.eq(1) - - # if valid_o rose on the very first cycle, it is a - # zero-delay ALU - yield Settle() - vld = yield dut.n.valid_o - if vld: - # special case for zero-delay ALU - # we must raise ready_i first, since the combinatorial ALU doesn't - # have any storage, and doesn't dare to assert ready_o back to us - # until we accepted the output data - yield dut.n.ready_i.eq(1) - result = yield dut.o - yield - yield dut.p.valid_i.eq(0) - yield dut.n.ready_i.eq(0) - yield - return result - + yield dut.n.ready_i.eq(1) yield # wait for the ALU to accept our input data @@ -423,11 +406,8 @@ def run_op(dut, a, b, op, inv_a=0): yield # latch the result and lower read_i - yield dut.n.ready_i.eq(1) result = yield dut.o - yield yield dut.n.ready_i.eq(0) - yield return result -- 2.30.2