Hi, I have a question on how Rocket Chip handles asynchronous interrupts.
From my understanding and the explanation in
https://groups.google.com/a/groups.riscv.org/forum/#!msg/hw-dev/uNE1WL8svXs/vjy1AuN8FAAJ,an interrupt will cause an illegal instruction inserted. And in the Chisel code, I think it corresponds to using csr.io.interrupt in the id stage to generate id_xcpt/id_cause signal, and these will be carried to the writeback stage and treated similarly as traps/exceptions. Correct?
However,
1) csr.io.interrupt (from csr to the pipeline) relies on the enabling bits in CSRs
2) The effect of the enabling bits is on id stage (because csr.io.interrupt is used in id stage)
3) CSRs are written by CSRRW instructions in write-back stage
4) I didn't find the forwarding logic to forward the new csr value to CSRFile to determine the csr.io.interrupt in id stage (did I miss them? please help me by pointing it out, thanks! )
So, I suspect whether there is a hazard. Suppose, an instruction turns off the enabling bits, however, before it reaches the WB stage, these new values are not visible to a younger interrupt. So an illegal instruction is injected, and that is *after* the enabling bits has turned off. This confuses me a lot.
Please point out any incorrect reasoning or misunderstanding of the Chisel code. Thank you for your help!
Hongce