Skip to content

Commit

Permalink
difftest: fix the sync timing for LR/SC (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
poemonsense authored Sep 14, 2023
1 parent 8e99ba4 commit b0bb8d5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/test/csrc/difftest/difftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ int Difftest::step() {

#endif

#ifdef CONFIG_DIFFTEST_LRSCEVENT
// sync lr/sc reg microarchitectural status to the REF
if (dut.lrsc.valid) {
struct SyncState sync;
sync.sc_fail = !dut.lrsc.success;
printf("sync: sc_fail %lu\n", sync.sc_fail);
proxy->uarchstatus_sync((uint64_t*)&sync);
}
#endif

num_commit = 0; // reset num_commit this cycle to 0
if (dut.event.valid) {
// interrupt has a higher priority than exception
Expand Down Expand Up @@ -312,15 +322,6 @@ int Difftest::do_instr_commit(int i) {
}
#endif

#ifdef CONFIG_DIFFTEST_LRSCEVENT
// sync lr/sc reg microarchitectural status to the REF
if (dut.lrsc.valid) {
struct SyncState sync;
sync.sc_fail = !dut.lrsc.success;
proxy->uarchstatus_sync((uint64_t*)&sync);
}
#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
Expand Down

0 comments on commit b0bb8d5

Please sign in to comment.