14.06.2015 Views

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Version</strong> <strong>2.03</strong><br />

3.3.10 Fixed-Point Trap Instructions<br />

The Trap instructions are provided to test for a specified<br />

set of conditions. If any of the conditions tested by<br />

a Trap instruction are met, the system trap handler is<br />

invoked. If none of the tested conditions are met,<br />

instruction execution continues normally.<br />

The contents of register RA are compared with either<br />

the sign-extended value of the SI field or the contents<br />

of register RB, depending on the Trap instruction. For<br />

tdi and td, the entire contents of RA (and RB) participate<br />

in the comparison; for twi and tw, only the contents<br />

of the low-order 32 bits of RA (and RB) participate<br />

in the comparison.<br />

This comparison results in five conditions which are<br />

ANDed with TO. If the result is not 0 the system trap<br />

handler is invoked. These conditions are as follows.<br />

TO Bit ANDed with Condition<br />

0 Less Than, using signed comparison<br />

1 Greater Than, using signed comparison<br />

2 Equal<br />

3 Less Than, using unsigned comparison<br />

4 Greater Than, using unsigned comparison<br />

Extended mnemonics for traps<br />

A set of extended mnemonics is provided so that traps<br />

can be coded with the condition as part of the mnemonic<br />

rather than as a numeric operand. Some of<br />

these are shown as examples with the Trap instructions.<br />

See Appendix D for additional extended mnemonics.<br />

Trap Word Immediate<br />

D-form<br />

Trap Word<br />

X-form<br />

twi<br />

TO,RA,SI<br />

tw<br />

TO,RA,RB<br />

3 TO RA SI<br />

0 6 11 16 31<br />

a EXTS((RA) 32:63 )<br />

if (a < EXTS(SI)) & TO 0 then TRAP<br />

if (a > EXTS(SI)) & TO 1 then TRAP<br />

if (a = EXTS(SI)) & TO 2 then TRAP<br />

if (a < u EXTS(SI)) & TO 3 then TRAP<br />

if (a > u EXTS(SI)) & TO 4 then TRAP<br />

The contents of RA 32:63 are compared with the<br />

sign-extended value of the SI field. If any bit in the TO<br />

field is set to 1 and its corresponding condition is met<br />

by the result of the comparison, the system trap handler<br />

is invoked.<br />

If the trap conditions are met, this instruction is context<br />

synchronizing (see Book III).<br />

Special Registers Altered:<br />

None<br />

Extended Mnemonics:<br />

Examples of extended mnemonics for Trap Word<br />

Immediate:<br />

Extended:<br />

Equivalent to:<br />

twgti Rx,value twi 8,Rx,value<br />

twllei Rx,value twi 6,Rx,value<br />

31 TO RA RB 4 /<br />

0 6 11 16 21 31<br />

a EXTS((RA) 32:63 )<br />

b EXTS((RB) 32:63 )<br />

if (a < b) & TO 0 then TRAP<br />

if (a > b) & TO 1 then TRAP<br />

if (a = b) & TO 2 then TRAP<br />

if (a < u b) & TO 3 then TRAP<br />

if (a > u b) & TO 4 then TRAP<br />

The contents of RA 32:63 are compared with the contents<br />

of RB 32:63 . If any bit in the TO field is set to 1 and<br />

its corresponding condition is met by the result of the<br />

comparison, the system trap handler is invoked.<br />

If the trap conditions are met, this instruction is context<br />

synchronizing (see Book III).<br />

Special Registers Altered:<br />

None<br />

Extended Mnemonics:<br />

Examples of extended mnemonics for Trap Word:<br />

Extended:<br />

Equivalent to:<br />

tweq Rx,Ry tw 4,Rx,Ry<br />

twlge Rx,Ry tw 5,Rx,Ry<br />

trap tw 31,0,0<br />

66<br />

<strong>Power</strong> ISA -- Book I

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!