tw or t (Trap Word) instruction
Purpose
Generates a program interrupt when a specified condition is true.
Syntax
Bits | Value |
---|---|
0-5 | 31 |
6-10 | TO |
11-15 | RA |
16-20 | RB |
21-30 | 4 |
31 | / |
Description
The tw and t instructions compare the contents of general-purpose register (GPR) RA with the contents of GPR RB, 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 tw and t instructions have one syntax form and do not affect the Fixed-Point Exception Register or Condition Register Field 0.
Parameters
Item | Description |
---|---|
TO | Specifies TO bits that are ANDed with compare results. |
RA | Specifies source general-purpose register for compare. |
RB | Specifies source general-purpose register for compare. |
Examples
The following code generates a Program Interrupt:
# Assume GPR 4 contains 0x9000 3000.
# Assume GPR 7 contains 0x789A 789B.
tw 0x10,4,7
# A trap type Program Interrupt occurs.