pmpaddr0 = 0x20000003 (NAPOT: 32-byte range from 0x80000000)
pmpaddr1 = 0x00000000
pmpaddr2 = 0x3FFFFFFF (TOR: from 0x00000000 to 0xFFFFFFFF)
However, actual generated code will set the registers as following;
pmpaddr0 = 0x3fffffe0000003 (invalid)
pmpaddr1 = 0x00000000
pmpaddr2 = 0x3fffffffffffff (invalid)
These are not correct.
It seems that riscv-dv interpret the ADDR definition in testlist.yaml as a signed 32-bit integer value.
And sign extends it to a 64-bit value (8000000C -> FFFFFFFF8000000C).
Then, shift right by 2-bit and trim to 54-bit (FFFFFFFF8000000C -> 3fffffe0000003).
The expected behavior is to handle the definition as unsigned value.
How to reproduce
Modify target/rv64gc/riscv_core_setting.sv as following,
When XLEN=64, pmpaddr value is invalid in the generated code.
I wrote definitions of pmp regions in testlist.yaml as following.
The expected value of pmpaddr registers are;
However, actual generated code will set the registers as following;
These are not correct. It seems that riscv-dv interpret the ADDR definition in testlist.yaml as a signed 32-bit integer value. And sign extends it to a 64-bit value (8000000C -> FFFFFFFF8000000C). Then, shift right by 2-bit and trim to 54-bit (FFFFFFFF8000000C -> 3fffffe0000003).
The expected behavior is to handle the definition as unsigned value.
How to reproduce
Modify target/rv64gc/riscv_core_setting.sv as following,
bit support_pmp = 0;
bit support_pmp = 1;
Modify target/rv32imc/testlist.yaml as following,
+pmp_num_regions=1
+pmp_num_regions=3 +pmp_granularity=1
+pmp_region_0=L:0,A:TOR,X:1,W:1,R:1,ADDR:FFFFFFFF
+pmp_region_0=L:0,A:NAPOT,X:1,W:1,R:1,ADDR:8000000C
+pmp_region_1=L:0,A:OFF,X:1,W:0,R:1,ADDR:00000000
+pmp_region_2=L:0,A:TOR,X:1,W:0,R:1,ADDR:FFFFFFFF rtl_test: core_base_test
Run following command,
result
Versions