Skip to content

Commit

Permalink
fix(dbltrp): critical-error is not treated as diff error
Browse files Browse the repository at this point in the history
* When both RTL and NEMU report a critical-error, the hardware behavior is considered correct.
  Upon detecting a critical-error, it should indicate a "good trap."
* If they do not report simultaneously, it results in a diff error and triggers an abort.
  • Loading branch information
lewislzh committed Nov 4, 2024
1 parent 7c4bd54 commit 61fb531
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/test/csrc/difftest/difftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,15 @@ void Difftest::do_mhpmevent_overflow() {
#ifdef CONFIG_DIFFTEST_CRITICALERROREVENT
void Difftest::do_raise_critical_error() {
if (dut->critical_error.valid) {
display();
Info("Core %d dump: critical_error raise \n", this->id);
raise_trap(STATE_ABORT);
proxy->ref_raise_critical_error(&ref_critical_error);
if (ref_critical_error) {
Info("Core %d dump: critical_error raise \n", this->id);
raise_trap(STATE_GOODTRAP);
} else {
display();
Info("Core %d dump: critical_error raise \n", this->id);
raise_trap(STATE_ABORT);
}
}
}
#endif
Expand Down
1 change: 1 addition & 0 deletions src/test/csrc/difftest/difftest.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ class Difftest {
#endif
#ifdef CONFIG_DIFFTEST_CRITICALERROREVENT
void do_raise_critical_error();
bool ref_critical_error;
#endif
#ifdef CONFIG_DIFFTEST_REPLAY
struct {
Expand Down
1 change: 1 addition & 0 deletions src/test/csrc/difftest/refproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class RefProxyConfig {
f(ref_memcpy, difftest_memcpy, void, uint64_t, void*, size_t, bool) \
f(ref_exec, difftest_exec, void, uint64_t) \
f(ref_reg_display, difftest_display, void, ) \
f(ref_raise_critical_error, difftest_raise_critical_error, void, void*) \
f(update_config, update_dynamic_config, void, void*) \
f(uarchstatus_sync, difftest_uarchstatus_sync, void, void*) \
f(store_commit, difftest_store_commit, int, uint64_t*, uint64_t*, uint8_t*) \
Expand Down

0 comments on commit 61fb531

Please sign in to comment.