Skip to content

Commit

Permalink
difftest: support rob compression and instr fusion (#139)
Browse files Browse the repository at this point in the history
* add support for multiple commits in one commit event

Co-authored-by: fdy <841513191@qq.com>
  • Loading branch information
poemonsense and fdy0 authored Sep 8, 2023
1 parent 4c1b283 commit 5a20f17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/Difftest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ class DiffInstrCommit(numPhyRegs: Int = 32) extends DifftestBundle
with DifftestWithIndex
with DifftestWithValid
{
val special = UInt(8.W)
val skip = Bool()
val isRVC = Bool()
val rfwen = Bool()
Expand All @@ -169,13 +168,14 @@ class DiffInstrCommit(numPhyRegs: Int = 32) extends DifftestBundle
val sqIdx = UInt(7.W)
val isLoad = Bool()
val isStore = Bool()
val nFused = UInt(8.W)
val special = UInt(8.W)

def setSpecial(
isFused: Bool = false.B,
isExit: Bool = false.B,
isDelayedWb: Bool = false.B,
isExit: Bool = false.B,
): Unit = {
special := Cat(isDelayedWb, isExit, isFused)
special := Cat(isExit, isDelayedWb)
}
override val desiredCppName: String = "commit"
}
Expand Down
14 changes: 5 additions & 9 deletions src/test/csrc/difftest/difftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ int Difftest::step() {
return 1;
}
dut.commit[i].valid = 0;
num_commit++;
// TODO: let do_instr_commit return number of instructions in this uop
if (dut.commit[i].special & 0x1) {
num_commit++;
}
num_commit += 1 + dut.commit[i].nFused;
}
}

Expand Down Expand Up @@ -226,14 +222,14 @@ int Difftest::do_instr_commit(int i) {
#endif
uint64_t commit_instr = dut.commit[i].instr;
state->record_inst(commit_pc, commit_instr, (dut.commit[i].rfwen | dut.commit[i].fpwen),
dut.commit[i].wdest, get_commit_data(i), dut.commit[i].skip != 0, dut.commit[i].special & 0x4,
dut.commit[i].wdest, get_commit_data(i), dut.commit[i].skip != 0, dut.commit[i].special & 0x1,
dut.commit[i].lqIdx, dut.commit[i].sqIdx, dut.commit[i].robIdx, dut.commit[i].isLoad, dut.commit[i].isStore);

progress = true;
update_last_commit();

// isDelayeWb
if (dut.commit[i].special & 0x4) {
if (dut.commit[i].special & 0x1) {
int *status =
#ifdef CONFIG_DIFFTEST_ARCHINTDELAYEDUPDATE
dut.commit[i].rfwen ? delayed_int:
Expand Down Expand Up @@ -287,8 +283,8 @@ int Difftest::do_instr_commit(int i) {

// single step exec
proxy->ref_exec(1);
// when there's a fused instruction, let proxy execute one more instruction.
if (dut.commit[i].special & 0x1) {
// when there's a fused instruction, let proxy execute more instructions.
for (int j = 0; j < dut.commit[i].nFused; j++) {
proxy->ref_exec(1);
}

Expand Down

0 comments on commit 5a20f17

Please sign in to comment.