I'm trying to implement a simple interrupt controller for my RV32I core. I believe I understand how an interrupt should be handled in RISC-V, and the role of the CSR registers in the process.
RISC-V defines three sources of interrupts: External, Software and Timer. I understand how a timer and an external interrupt would generate. However, I do not understand how or what would generate a software interrupt. An instruction? A sequence of instructions? Maybe implementation defined flags? I have no idea.
Could anyone give an example and the explanation of a software interrupt, preferably with the associated assembly code if it is relevant?
Thanks in advance!
What you are looking for are SSIP and USIP bits from the mip csr.
You can find this information in
The RISC-V Instruction Set Manual Volume II: Privileged ArchitectureV20190608.