Skip to content

Commit

Permalink
fix(skip): fix RF updates for floating-point (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anzooooo authored Nov 29, 2024
1 parent 6834b7a commit b3d2aaf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/test/csrc/difftest/difftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,12 @@ int Difftest::do_instr_commit(int i) {
}
#endif

bool realWen = (dut->commit[i].rfwen && dut->commit[i].wdest != 0) || (dut->commit[i].fpwen);

// MMIO accessing should not be a branch or jump, just +2/+4 to get the next pc
// to skip the checking of an instruction, just copy the reg state to reference design
if (dut->commit[i].skip || (DEBUG_MODE_SKIP(dut->commit[i].valid, dut->commit[i].pc, dut->commit[i].inst))) {
// We use the physical register file to get wdata
proxy->skip_one(dut->commit[i].isRVC, realWen, dut->commit[i].wdest, get_commit_data(i));
proxy->skip_one(dut->commit[i].isRVC, (dut->commit[i].rfwen && dut->commit[i].wdest != 0), dut->commit[i].fpwen,
dut->commit[i].vecwen, dut->commit[i].wdest, get_commit_data(i));
return 0;
}

Expand Down
18 changes: 14 additions & 4 deletions src/test/csrc/difftest/refproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,26 @@ class RefProxy : public AbstractRefProxy {
int compare(DiffTestState *dut);
void display(DiffTestState *dut = nullptr);

inline void skip_one(bool isRVC, bool wen, uint32_t wdest, uint64_t wdata) {
inline void skip_one(bool isRVC, bool rfwen, bool fpwen, bool vecwen, uint32_t wdest, uint64_t wdata) {
bool wen = rfwen | fpwen;
if (ref_skip_one) {
ref_skip_one(isRVC, wen, wdest, wdata);
} else {
sync();
pc += isRVC ? 2 : 4;
// TODO: what if skip with fpwen?
if (wen) {

if (rfwen)
regs_int.value[wdest] = wdata;
}
#ifdef CONFIG_DIFFTEST_ARCHFPREGSTATE
if (fpwen)
regs_fp.value[wdest] = wdata;
#endif // CONFIG_DIFFTEST_ARCHFPREGSTATE
#ifdef CONFIG_DIFFTEST_ARCHVECREGSTATE
// TODO: vec skip is not supported at this time.
if (vecwen)
assert(0);
#endif // CONFIG_DIFFTEST_ARCHVECREGSTATE

sync(true);
}
}
Expand Down

0 comments on commit b3d2aaf

Please sign in to comment.