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

feat(store_event): add pc and robidx debugging information for store event #499

Merged
merged 1 commit into from
Nov 11, 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: 2 additions & 0 deletions src/main/scala/Bundles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ class StoreEvent extends DifftestBaseBundle with HasValid {
val addr = UInt(64.W)
val data = UInt(64.W)
val mask = UInt(8.W)
val pc = UInt(64.W)
val robidx = UInt(10.W)
}

class LoadEvent extends DifftestBaseBundle with HasValid {
Expand Down
9 changes: 7 additions & 2 deletions src/test/csrc/difftest/difftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,10 +689,15 @@ int Difftest::do_store_check() {
return 0;
}
#endif
uint64_t pc = store_event.pc;
display();

printf("\n============== Store Commit Event (Core %d) ==============\n", this->id);
proxy->get_store_event_other_info(&pc);
printf("Mismatch for store commits \n");
printf(" REF commits addr 0x%lx, data 0x%lx, mask 0x%x\n", addr, data, mask);
printf(" DUT commits addr 0x%lx, data 0x%lx, mask 0x%x\n", store_event.addr, store_event.data, store_event.mask);
printf(" REF commits addr 0x%016lx, data 0x%016lx, mask 0x%04x, pc 0x%016lx\n", addr, data, mask, pc);
printf(" DUT commits addr 0x%016lx, data 0x%016lx, mask 0x%04x, pc 0x%016lx, robidx 0x%x\n", store_event.addr,
store_event.data, store_event.mask, store_event.pc, store_event.robidx);

store_event_queue.pop();
return 1;
Expand Down
14 changes: 12 additions & 2 deletions src/test/csrc/difftest/refproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class RefProxyConfig {
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)

f(ref_raise_critical_error, difftest_raise_critical_error, bool) \
f(ref_get_store_event_other_info, difftest_get_store_event_other_info, void, void*)
#define RefFunc(func, ret, ...) ret func(__VA_ARGS__)
#define DeclRefFunc(this_func, dummy, ret, ...) RefFunc((*this_func), ret, __VA_ARGS__);
/* clang-format on */
Expand Down Expand Up @@ -289,6 +289,16 @@ class RefProxy : public AbstractRefProxy {
}
}

inline void get_store_event_other_info(void *info) {
if (ref_get_store_event_other_info) {
ref_get_store_event_other_info(info);
} else {
printf(
"This version of 'REF' does not support the 'PC' value of store commit event. Please use a newer version of "
"'REF'.\n");
}
}

#ifdef ENABLE_STORE_LOG
inline void set_store_log(bool enable = false) {
config.enable_store_log = enable;
Expand Down