Compaq ECQD2KCTE manual Arithmetic Traps, Dictable

Models: ECQD2KCTE

1 371
Download 371 pages 20.35 Kb
Page 242
Image 242

5.7 Arithmetic Traps

Alpha implementations are allowed to execute multiple instructions concurrently and to for- ward results from one instruction to another. Thus, when an arithmetic trap is detected, the PC may have advanced an arbitrarily large number of instructions past the instruction T (calculat- ing result R) whose execution triggered the trap.

When the trap is detected, any or all of these subsequent instructions may run to completion before the trap is actually taken. The set of instructions subsequent to T that complete before the trap is taken are collectively called the trap shadow of T. The PC pushed on the stack when the trap is taken is the PC of the first instruction past the trap shadow.

The instructions in the trap shadow of T may use the UNPREDICTABLE result R of T, they may generate additional traps, and they may completely change the PC (branches, JSR).

Thus, by the time a trap is taken, the PC pushed on the stack may bear no useful relationship to the PC of the trigger instruction T, and the state visible to the programmer may have been updated using the UNPREDICTABLE result R. If an instruction in the trap shadow of T uses R to calculate a subsequent register value, that register value is UNPREDICTABLE, even though there may be no trap associated with the subsequent calculation. Similarly:

If an instruction in the trap shadow of T stores R or any subsequent UNPREDICT- ABLE result, the stored value is UNPREDICTABLE.

If an instruction in the trap shadow of T uses R or any subsequent UNPREDICTABLE result as the basis of a conditional or calculated branch, the branch target is UNPRE-

DICTABLE.

If an instruction in the trap shadow of T uses R or any subsequent UNPREDICTABLE result as the basis of an address calculation, the memory address actually accessed is

UNPREDICTABLE.

Software can follow the rules in Section 4.7.7.3 to reliably bound how far the PC may advance before taking a trap, how far an UNPREDICTABLE result may propagate or continue from a trap by supplying a well-defined result R within an arithmetic trap handler. Arithmetic instruc- tions that do not use the /S exception completion qualifier can reliably produce that behavior by inserting TRAPB instructions at appropriate points.

5–30Alpha Architecture Handbook

Page 242
Image 242
Compaq ECQD2KCTE manual Arithmetic Traps, Dictable