Skip to content

Commit 63a8d43

Browse files
committed
Only use xcpt-handler in debug mode
1 parent e782858 commit 63a8d43

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

include/gemmini.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,26 @@ acc_scale_t_bits acc_scale_t_to_acc_scale_t_bits(acc_scale_t x) {
197197
// LSB indicates if the page addr is load fault or store fault
198198
void handle_gemmini_xcpt(uint64_t rd) {
199199
char is_st = (uint64_t) rd & 1;
200-
char* addr = (char*) rd;
200+
char* addr = (char*) (rd & ~1);
201201
if (is_st) {
202+
printf("[GEMMINI] Store page fault at %x\n", addr);
202203
*addr = 0;
203204
} else {
205+
printf("[GEMMINI] Load page fault at %x\n", addr);
204206
volatile char t = *addr;
205207
}
206208
gemmini_flush(0);
207209
}
208210

211+
#ifdef GEMMINI_XCPT_DEBUG
209212
#define ROCC_INSTRUCTION_RD_RS1_RS2(x, rs1, rs2, funct) \
210213
ROCC_INSTRUCTION_RD_RS1_RS2_labeled(x, rs1, rs2, funct, 0)
214+
#else
215+
#define ROCC_INSTRUCTION_RD_RS1_RS2(x, rs1, rs2, funct) \
216+
ROCC_INSTRUCTION_RS1_RS2(x, rs1, rs2, funct)
217+
#endif
218+
219+
211220

212221
// First, issue the instruction, and then check the return code
213222
// If the return code indicates a pending exception from gemmini, handle it,

0 commit comments

Comments
 (0)