Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dbltrp): critical-error is not treated as diff error #492

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ coherence via RefillTest.
| `DiffLrScEvent` | Executed LR/SC instructions | No |
| `DiffNonRegInterruptPengingEvent` | Non-register interrupts pending | No |
| `DiffMhpmeventOverflowEvent` | Mhpmevent-register overflow | No |
| `DiffDiffCriticalErrorEvent` | Raise critical-error | No |
| `DiffCriticalErrorEvent` | Raise critical-error | No |

The DiffTest framework comes with a simulation framework with some top-level IOs.
They will be automatically created when calling `DifftestModule.finish(cpu: String)`.
Expand Down
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);
bool ref_critical_error = proxy->raise_critical_error();
if (ref_critical_error == dut->critical_error.criticalError) {
Info("Core %d dump: critical_error raise \n", this->id);
raise_trap(STATE_GOODTRAP);
} else {
display();
Info("Core %d dump: DUT critical_error diff REF \n", this->id);
raise_trap(STATE_ABORT);
}
}
}
#endif
Expand Down
11 changes: 8 additions & 3 deletions src/test/csrc/difftest/refproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ class RefProxyConfig {
f(ref_memcpy_init, difftest_memcpy_init, void, uint64_t, void*, size_t, bool) \
f(raise_nmi_intr, difftest_raise_nmi_intr, void, bool) \
f(ref_virtual_interrupt_is_hvictl_inject, difftest_virtual_interrupt_is_hvictl_inject, void, bool) \
f(disambiguation_state, difftest_disambiguation_state, int, ) \
f(ref_non_reg_interrupt_pending, difftest_non_reg_interrupt_pending, void, void*) \
f(raise_mhpmevent_overflow, difftest_raise_mhpmevent_overflow, void, uint64_t)
f(disambiguation_state, difftest_disambiguation_state, int, ) \
f(ref_non_reg_interrupt_pending, difftest_non_reg_interrupt_pending, void, void*) \
f(raise_mhpmevent_overflow, difftest_raise_mhpmevent_overflow, void, uint64_t) \
f(ref_raise_critical_error, difftest_raise_critical_error, bool)

#define RefFunc(func, ret, ...) ret func(__VA_ARGS__)
#define DeclRefFunc(this_func, dummy, ret, ...) RefFunc((*this_func), ret, __VA_ARGS__);
Expand Down Expand Up @@ -258,6 +259,10 @@ class RefProxy : public AbstractRefProxy {
}
}

inline bool raise_critical_error() {
return ref_raise_critical_error ? ref_raise_critical_error() : false;
}

inline void guided_exec(struct ExecutionGuide &guide) {
return ref_guided_exec ? ref_guided_exec(&guide) : ref_exec(1);
}
Expand Down