[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Assembler Language Reference

twi or ti (Trap Word Immediate) Instruction

Purpose

Generates a program interrupt when a specified condition is true.

Syntax

Bits Value
0-5 03
6-10 TO
11-15 RA
16-31 SI
PowerPC 
twi TO, RA, SI
POWER family 
ti TO, RA, SI

See Extended Mnemonics of Fixed-Point Trap Instructions for more information.

Description

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.

Parameters

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.

Examples

The following code generates a Program Interrupt:

# Assume GPR 4 holds 0x0000 0010.
twi 0x4,4,0x10
# A trap type Program Interrupt occurs.

Related Information

Branch Processor .

Fixed-Point Trap Instructions .

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]