What happens on a RISC-V CPU when the program counter (PC) overflows?
For example, what happens on RV32G IALIGN = 32 after a (32-bit) NOP at 0xFFFF’FFFC has been executed? Or on RV32GC after a 16-bit NOP at 0xFFFF’FFFE has been executed? The easiest answer to both of these questions to be “nothing much, execution proceeds from 0x0000’0000”, but then what happens on RV32GC after a 16-bit NOP at 0xFFFF’FFFC has been executed? The same answer would imply the instruction fetch might then need to span the end of the address space, which doesn’t sound architecturally pleasant. (Then again, with IALIGN = 16 an instruction fetch might have to span a page boundary, which doesn’t sound all that pleasant either, and IIRC x86 implementations have caused plenty of hilarity for partially-faulting instruction fetches.)
A reference to the specPDF would be preferred, though I haven’t been able to find anything relevant there. Failing that, it’d be interesting to hear what actual hardware implementations do in this situation.
https://riscv.org/wp-content/uploads/2019/12/riscv-spec-20191213.pdf
This suggests to me that the PC wraps, since incrementing it is a memory address computation.