From d2e3a951e15ba78f85b3d826d0aaf3c5366cf67e Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Sun, 5 Jul 2020 19:30:45 -0300 Subject: [PATCH] Implement receiver --- src/soc/experiment/alu_hier.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/soc/experiment/alu_hier.py b/src/soc/experiment/alu_hier.py index c4d5305b..074d18f7 100644 --- a/src/soc/experiment/alu_hier.py +++ b/src/soc/experiment/alu_hier.py @@ -484,18 +484,30 @@ def test_alu_parallel(): yield dut.op.insn_type.eq(op) yield dut.op.invert_a.eq(inv_a) yield dut.p.valid_i.eq(1) - yield Settle() while True: + yield rdy = yield dut.p.ready_o if rdy: break + yield dut.p.valid_i.eq(0) + + def receive(): + yield dut.n.ready_i.eq(1) + while True: + valid = yield dut.n.valid_o + if valid: + break yield + result = yield dut.o + yield dut.n.ready_i.eq(0) + return result def producer(): yield from send(5, 3, InternalOp.OP_ADD) def consumer(): - yield dut.n.ready_i.eq(1) + result = yield from receive() + assert (result == 8) sim.add_sync_process(producer) sim.add_sync_process(consumer) -- 2.30.2