From 28dfd208f31f13508843f9f76a114ee524429073 Mon Sep 17 00:00:00 2001 From: Jiuyang Liu Date: Sun, 28 Jul 2024 23:49:17 +0800 Subject: [PATCH] [ipemu] workaround xprop for DPI --- ipemu/src/TestBench.scala | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ipemu/src/TestBench.scala b/ipemu/src/TestBench.scala index c38d5f9c91..e4d2a55df9 100644 --- a/ipemu/src/TestBench.scala +++ b/ipemu/src/TestBench.scala @@ -109,18 +109,25 @@ class TestBench(generator: SerializableModuleGenerator[T1, T1Parameter]) val writeRd: UInt = UInt(32.W) val vxsat: UInt = UInt(32.W) } + // X gated by didIssue val issue = WireDefault(0.U.asTypeOf(new Issue)) val fence = RegInit(false.B) val outstanding = RegInit(0.U(4.W)) val doIssue: Bool = dut.io.issue.ready && !fence outstanding := outstanding + (doIssue && (issue.meta === 1.U)) - dut.io.issue.valid + // used to gate Xprop when DPI hasn't issued yet. + val didIssue = RegInit(false.B) + didIssue := doIssue || didIssue // TODO: refactor driver to spawn 3 scoreboards for record different retirement. val t1Probe = probe.read(dut.io.t1Probe) fence := Mux(doIssue, issue.meta === 2.U, fence && !t1Probe.retireValid && !(outstanding === 0.U)) - issue := RawClockedNonVoidFunctionCall("issue_vector_instruction", new Issue)( - clock, - doIssue + issue := Mux(didIssue, + RawClockedNonVoidFunctionCall("issue_vector_instruction", new Issue)( + clock, + doIssue, + ), + 0.U.asTypeOf(new Issue) ) dut.io.issue.bits.instruction := issue.instruction dut.io.issue.bits.rs1Data := issue.src1Data