wait
Wait for Interrupt
wait WC
wait
Stops instruction execution and places the processor in a lower power state until an interrupt occurs.
Details
Suspends instruction execution and places the processor in a low-power idle state until an interrupt is pending. The WC field selects the wait condition (interrupt vs. resume), and the PL field optionally specifies a programmable length timeout. This is a Base/privileged instruction with no effect on condition registers; execution resumes after the specified event.
Pseudocode Operation
if WC == 0 then
WaitForInterrupt()
else if WC == 1 then
WaitForResume()
Programming Note
Because the waiting begins when the instruction completes, if the waiting is ended by an exception that causes a change of control flow (interrupt, event-based branch), the SPR that is set to reflect the point in the instruction stream at which the change of control flow occurred (e.g., SRR0 for Decrementer interrupt) will contain the EA of the instruction following the wait instruction. Bits 6 and 7 of the wait instruction may be used in some implementations for an implementation-dependent field. Unless the intention is to use the implementation-dependent field, these bits must be coded zero. wait serves as both a basic and an extended mnemonic. The Assembler will recognize a wait mnemonic with two operands as the basic form and a wait mnemonic with one operand or with no operand as an extended form. In the extended form with one operand the PL operand is omitted and assumed to be 0. In the extended form with no operand the WC and PL operands are omitted and assumed to be 0. The wait instruction frees computational resources which might be allocated to another program or converted into power savings.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
| waitrsv | |
| pause_short |
Example
// Idle CPU.
Encoding
Operands
-
WC
Wait Condition (0=Interrupt, 1=Resume) -
PL
Programmable Length Field