Skip to content

Commit 23ae8e5

Browse files
authored
Merge pull request #624 from sysprog21/csr-cycle
Support CSR_INSTRETH for insn counter high bits
2 parents e8f24f4 + 0fcee70 commit 23ae8e5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/emulate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ static uint32_t *csr_get_ptr(riscv_t *rv, uint32_t csr)
131131
return &rv->csr_time[1];
132132
case CSR_INSTRET: /* Number of Instructions Retired Counter */
133133
return (uint32_t *) (&rv->csr_cycle);
134+
case CSR_INSTRETH: /* Upper 32 bits of instructions retired */
135+
return &((uint32_t *) &rv->csr_cycle)[1];
134136
#if RV32_HAS(EXT_F)
135137
case CSR_FFLAGS:
136138
return (uint32_t *) (&rv->csr_fcsr);

0 commit comments

Comments
 (0)