chipsalliance / riscv-dv

Random instruction generator for RISC-V processor verification
Apache License 2.0
1.02k stars 329 forks source link

[pmp] riscv_pmp_test will set pmpcfg1 even if XLEN=64 #891

Open atsushi-shinbo-esoltrinity opened 2 years ago

atsushi-shinbo-esoltrinity commented 2 years ago

riscv_pmp_test will generate pmp_setup routine in the output code. When the target is rv64gc, this routine contains csrw pmpcfg1, rs1 instruction.

According to RISC-V specification, there is no pmpcfg1 register when XLEN=64. So, generated code is invalid.

riscv-privileged-20211203.pdf 3.7.1 Physical Memory Protection CSRs

For RV64, eight even-numbered CSRs, pmpcfg0, pmpcfg2, ..., pmpcfg14, hold the configurations for the 64 PMP entries, as shown in Figure 3.32. For RV64, the odd-numbered configuration registers, pmpcfg1, pmpcfg3, ..., pmpcfg15, are illegal.

How to reproduce

Versions

I am using following environment