openhwgroup / cv32e40p

CV32E40P is an in-order 4-stage RISC-V RV32IMFCXpulp CPU based on RI5CY from PULP-Platform
https://docs.openhwgroup.org/projects/cv32e40p-user-manual/en/latest
Other
941 stars 412 forks source link

Change the address of some custom CSRs to be in the range reserved for such CSRs #142

Closed Silabs-ArjanB closed 4 years ago

Silabs-ArjanB commented 5 years ago

Some of RI5CY's custom CSR are in non-custom ranges and these might therefore cause conflicts with future standard extensions. Also the Hardware Loop CSRs are in the Machine CSR section, which would become an issue once https://github.com/pulp-platform/riscv/issues/130 has been resolved.

My proposal would be:

bluewww commented 5 years ago

Are we allowed to just duplicate the hwloop csrs into the user csr custom read/write space?

Silabs-ArjanB commented 5 years ago

I am not 100% sure about the spec in this respect. I believe that if you put the HW Loop CSRs in the user csr custom part, then you can use them in both user and machine mode (but if you leave them where they are now, then you should not be able to access them in user mode). I assume that you intend these CSRs to be available at the lowest privilege level, right? I do not see the point in duplicating these registers.

bluewww commented 5 years ago

Indeed it makes sense to have these registers in user mode. It is just a bit painful to remap CSRs because it will break our SDK. I'll have a look with @haugoug.

bluewww commented 5 years ago

I made a table overview of the mappings

MarekPikula commented 5 years ago

In addition I can see that performance counters don't use the standard addresses. Look in Privileged spec in table 2.5 and from 3.1.11 section. It makes SDK incompatible with Ibex for PULPissimo and with spec, what I guess is more important.

Here are docs of Ibex implementation.

MarekPikula commented 5 years ago

And here is the PR, which changed performance counters in Ibex: lowRISC/ibex#53

Silabs-ArjanB commented 4 years ago

Above pull request fixes various CSR addresses as follows:


CSR                     Old address     New address     Comment
---------------------------------------------------------------
HWLoop0_START           12'h7C0         12'h800         Needs to be User accessible (now in user custom read/write space)
HWLoop0_END             12'h7C1         12'h801         Needs to be User accessible (now in user custom read/write space)
HWLoop0_COUNTER         12'h7C2         12'h802         Needs to be User accessible (now in user custom read/write space)
HWLoop1_START           12'h7C4         12'h804         Needs to be User accessible (now in user custom read/write space)
HWLoop1_END             12'h7C5         12'h805         Needs to be User accessible (now in user custom read/write space)
HWLoop1_COUNTER         12'h7C6         12'h806         Needs to be User accessible (now in user custom read/write space)
FPREC                   12'h006         12'h807         Cannot be in Standard space (now in user custom read/write space)
UHARTID                 12'h014         12'hCC0         Cannot be in Standard space; should not be R/W (now in user custom read-only space)
PRIVLV                  12'hC10         12'hCC1         Cannot be in Standard space (also clashes) (now in user custom read-only space)
davideschiavone commented 4 years ago

shall we close this issue? @Silabs-ArjanB