From 08a0c5ba350912e53478835985ef1ada0a51d3ff Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 25 May 2020 12:44:38 +0100 Subject: [PATCH] quick addition of zero+immed test to LDSTCompUnit --- src/soc/experiment/compldst_multi.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/soc/experiment/compldst_multi.py b/src/soc/experiment/compldst_multi.py index 85933a88..c3d2606a 100644 --- a/src/soc/experiment/compldst_multi.py +++ b/src/soc/experiment/compldst_multi.py @@ -541,23 +541,28 @@ def store(dut, src1, src2, src3, imm, imm_ok=True, update=False): return addr -def load(dut, src1, src2, imm, imm_ok=True, update=False): +def load(dut, src1, src2, imm, imm_ok=True, update=False, zero_a=False): print ("LD", src1, src2, imm, imm_ok, update) yield dut.oper_i.insn_type.eq(InternalOp.OP_LOAD) yield dut.src1_i.eq(src1) yield dut.src2_i.eq(src2) + yield dut.oper_i.zero_a.eq(zero_a) yield dut.oper_i.imm_data.imm.eq(imm) yield dut.oper_i.imm_data.imm_ok.eq(imm_ok) yield dut.issue_i.eq(1) yield yield dut.issue_i.eq(0) yield - if imm_ok: - yield dut.rd.go.eq(0b01) - else: - yield dut.rd.go.eq(0b11) - yield from wait_for(dut.rd.rel) - yield dut.rd.go.eq(0) + rd = 0b00 + if not imm_ok: + rd |= 0b10 + if not zero_a: + rd |= 0b01 + + if rd: + yield dut.rd.go.eq(rd) + yield from wait_for(dut.rd.rel) + yield dut.rd.go.eq(0) yield from wait_for(dut.adr_rel_o, False, test1st=True) #yield dut.ad.go.eq(1) @@ -613,8 +618,14 @@ def scoreboard_sim(dut): # update-indexed version data, addr = yield from load(dut, 4, 5, 0, imm_ok=False, update=True) + assert data == 0x0003, "returned %x" % data assert addr == 0x0009, "returned %x" % addr + # immediate *and* zero version + data, addr = yield from load(dut, 4, 5, 9, imm_ok=True, zero_a=True) + assert data == 0x0003, "returned %x" % data + + class TestLDSTCompUnit(LDSTCompUnit): def __init__(self, rwid): -- 2.30.2