Generates a program interrupt when a specified condition is true.
PowerPC | |
---|---|
twi | TO,RA,SI |
POWER | |
---|---|
ti | TO,RA,SI |
See "Extended Mnemonics of Fixed-Point Trap Instructions" for more information.
The twi and ti instructions compare the contents of general-purpose register (GPR) RA with the sign extended SI field, AND the compared results with TO, and generate a trap-type program interrupt if the result is not 0.
The TO bit conditions are defined as follows.
TO bit | ANDed with Condition |
---|---|
0 | Compares Less Than. |
1 | Compares Greater Than. |
2 | Compares Equal. |
3 | Compares Logically Less Than. |
4 | Compares Logically Greater Than. |
The twi and ti instructions have one syntax form and do not affect the Fixed-Point Exception Register or Condition Register Field 0.
TO | Specifies TO bits that are ANDed with compare results. |
RA | Specifies source general-purpose register for compare. |
SI | Specifies sign-extended value for compare. |
The following code generates a Program Interrupt:
# Assume GPR 4 holds 0x0000 0010. twi 0x4,4,0x10 # A trap type Program Interrupt occurs.
Fixed-Point Trap Instructions.