riscv-admin/riscv-ovpsim

Adding custom CSRs

udinator opened this issue · 4 comments

Hi,
Is there a way to add some custom CSRs through the OVPsim configuration file?
The Ibex core (rv32imcb) I am verifying implements several custom CSRs at addresses 0x7C0 and 0x7C1, accesses to which OVPsim treats as illegal instructions, so I'd like to register these CSRs with OVPsim somehow to correctly emulate RTL behavior.
I'm seeing that using the enable_CSR_bus option allows use of callbacks to implement modified behavior - is this something I can leverage to get the desired results?
Best,
Udi

@udinator - thanks for the request - let me find out what is possible in the free riscvOVPsim. - Simon

Hi @udinator
The enable_CSR_bus option is used with OVP modeling when you place the CSRs into memory mapped platform regions and effectively create behavior using callbacks in the platform code.

I looked at https://github.com/lowRISC/ibex/blob/master/dv/uvm/core_ibex/riscv_dv_extension/csr_description.yaml#L299 and found definitions of the CSRs but I could not find description of the behavior that sits behind the CSRs - could you point me at that so we can see the type of behaviors you are looking to model.

@udinator
The compliance reference simulator riscvOVPsim was created as a free GitHub simulator to be used for compliance testing and models the complete RISC-V ISA priv and unpriv and does not have the ability to be extended for individual users custom extensions (like your CSRs and their behavior) and other requirements. If you need to extend it - like adding CSRs, behaviors, instructions, etc., this is available in other simulators in the Imperas reference and professional ranges (all using the same RISC-V models and simulator infrastructure and options). If you want us to provide your project with a reference simulator that is easily extendable in the way you need - then please do contact us: info@imperas.com.
thanks
Simon

Hi @simon5656 - sorry I didn't respond to your first reply, I must have missed the notification!

Thank you for the detailed response! I'm not really looking to model the behavior of the CSRs themselves and was just wondering if there was a way to extend from the user-perspective - from your comment it doesn't seem like this is the case.
Thank you for the help!