Does WFI always put the processor into low-power sleep?
No. WFI is not a HINT instruction, but its official semantics still allow an implementation to stall or to legally continue as a NOP.
Wait-for-interrupt instruction: an implementation may stall the hart until an interrupt might need service, or legally avoid stalling and continue as a NOP.
Extension condition: Available in implemented privileged modes; U-mode support is optional and subject to TW and the S-mode bounded-time rule. H adds VTW rules.
WFI informs the implementation that this hart may stall until an interrupt might need service; a legal implementation may instead treat it as a NOP. On the normal wait path, a locally enabled pending interrupt must resume execution regardless of global interrupt-enable bits or mideleg; resumption does not necessarily take an interrupt trap. If a deliverable enabled interrupt appears while stalled, the trap is taken on the following instruction. If the resume event does not cause a trap, execution continues at WFI PC+4 and software must recheck conditions. With TW=1, lower-than-M WFI must raise an illegal-instruction exception if it fails to complete within an implementation-specific bounded time; an implementation may always trap immediately. When S-mode exists, U-mode has this bounded-completion condition regardless of TW.
Shows the fixed SYSTEM encoding, TW restriction, and ISA-visible WFI behavior: it may stall or may return as a NOP.
This V=0 model assumes U-mode WFI support when S-mode is absent and excludes H/VTW. The result shows possible paths for the selected conditions, not committed state; exceeding the TW bounded limit must trap. This animation does not promise sleep duration, power reduction, wake latency, or scheduling policy; those are not portable WFI ISA semantics.
Wait-for-interrupt instruction: an implementation may stall the hart until an interrupt might need service, or legally avoid stalling and continue as a NOP.
With V=0, execution in M, no deliverable interrupt and PC=0x2000, an implementation choosing the NOP path continues after wfi at 0x2004. Software must still recheck its wait condition; this does not imply sleep or power savings.
With V=0, execution in M, no deliverable interrupt and PC=0x2000, an implementation choosing the NOP path continues after wfi at 0x2004. Software must still recheck its wait condition; this does not imply sleep or power savings.
No. WFI is not a HINT instruction, but its official semantics still allow an implementation to stall or to legally continue as a NOP.
Software should recheck its wait condition or pending state, because WFI may resume for any reason and resumption alone does not guarantee the intended event has been handled.