The real answer might be whatever the SAIL formal model says, since that is what compliance will check against (some day).
It might be safe to look at it and spike and see if it can be decoded from there.
There is a new policy that will be coming into force as soon as next week that will require at least an acknowledgement of the question within a short time frame (whose length is being argued about).
The intent of the existing wording is clear: Ensure that bits that are both writable by SW and by external events do not lose the external event.
The other intent is implied: writing to the bit is different than setting or clearing the bit
"...with a
CSR[RW] instruction, the value of the SEIP bit returned .... is the
logical-OR
of the software-writable SEIP bit and the interrupt signal from the interrupt controller.
I believe I had this discussion with Andrew, and "used" can be replaced with "read" or "returned", since that is the verb used in the immediately previous sentence.
The term "software-writable SEIP bit" is the value that would have been read had the external interrupt not been signalled.
In your example above, I'm going to assume that all xIP bits are zero, and that the CSR access occurs simultaneously with the interrupt signals.
It is my interpretation that delegation doesn't matter; it affects which mode handles the interrupt, but not which bits get set.
Instead, since xIP CSRs are restricted view CSRs, then only the bits pertaining to the mode being read from are visible.
In the first example , you'd read all zeros in MIP, SIP and UIP, you're returning the current value of MEIP, MTIP, SEIP, STIP, UEIP, UTIP
and since MEIP, MTIP
A cycle later, the interrupt signal would have set their respective xxIP bits, and you'd read
- MEIP, MTIP, SEIP, STIP, UEIP, UTIP in MIP
- only SEIP, STIP, UEIP, UTIP in SIP,
- only UEIP, UTIP in UIP
obviously, MIP and SIP accesses would be trapped from Umode, and MIP accesses would be trapped from Smode.
(The privileged spec I have doesn't actually show UIP, UEIP/UTIP,USIP because those don't exist unless the N extension exists (and has been ratified).
In the second example, you're actually forcing a zero into the IP bit, so the first clause takes effect and you'd see the OR:
- SEIP, STIP, UEIP, UTIP in MIP (because MEIP and MTIP aren't writable)
- only SEIP, STIP, UEIP, UTIP in SIP,
- only UEIP, UTIP in UIP
(let the corrections begin)