wfi

Can causes the processor to enter a low-power state until the next interrupt occurs. <%- if ext?(:H) -%> The behavior of `wfi` is affected by the `mstatus.TW` and `hstatus.VTW` bits, as summarized below. [%autowidth,%footer] |=== .2+| [.rotate]#`mstatus.TW`# .2+| [.rotate]#`hstatus.VTW`# 4+^.>| `wfi` behavior h| HS-mode h| U-mode h| VS-mode h| in VU-mode | 0 | 0 | Wait | Trap (I) | Wait | Trap (V) | 0 | 1 | Wait | Trap (I) | Trap (V) | Trap (V) | 1 | - | Trap (I) | Trap (I) | Trap (I) | Trap (I) 6+| Trap (I) - Trap with `Illegal Instruction` code + Trap (V) - Trap with `Virtual Instruction` code |=== <%- else -%> The `wfi` instruction is also affected by `mstatus.TW`, as shown below: [%autowidth,%footer] |=== .2+| [.rotate]#`mstatus.TW`# 2+^.>| `wfi` behavior h| S-mode h| U-mode | 0 | Wait | Trap (I) | 1 | Trap (I) | Trap (I) 3+| Trap (I) - Trap with `Illegal Instruction` code |=== <%- end -%> When `wfi` is marked as causing a trap above, the implementation is allowed to wait for an unspecified period of time to see if an interrupt occurs before raising the trap. That period of time can be zero (_i.e._, `wfi` always causes a trap in the cases identified above).

Synopsis

wfi

Encoding

Type:

03100010000010100000000000001110011
funct7: 0001000
funct3: 000
opcode: 1110011

RISC-V Instruction Encoder/Decoder

open wfi in rvcodecjs

Availability