Skip to content

Commit c8036d7

Browse files
committed
Show PMP registers on reg_display
1 parent 549e4e9 commit c8036d7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

difftest/difftest.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,16 @@ void DifftestRef::display() {
264264
printf("mtval: " FMT_WORD " stval: " FMT_WORD " mtvec: " FMT_WORD " stvec: " FMT_WORD "\n",
265265
state->mtval->read(), state->stval->read(), state->mtvec->read(), state->stvec->read());
266266
printf("privilege mode:%ld\n", state->prv);
267+
for (int i = 0; i < CONFIG_PMP_NUM; i++) {
268+
auto cfgidx = i / 4;
269+
if (p->get_xlen() == 64) {
270+
cfgidx -= cfgidx % 2;
271+
}
272+
unsigned pmpcfg = (state->csrmap[CSR_PMPCFG0 + cfgidx]->read() >> (i % (p->get_xlen() / 8)) * 8) & 0xffU;
273+
printf("%2d: cfg:0x%02x addr:0x%016lx", i, pmpcfg, state->pmpaddr[i]->read());
274+
if (i % 2 == 1) printf("\n");
275+
else printf(" | ");
276+
}
267277
fflush(stdout);
268278
}
269279

0 commit comments

Comments
 (0)