Trap – Texas Instruments TMS320C2XX User Manual
Page 345
TRAP
Software Interrupt
7-192
Syntax
TRAP
Operands
None
Opcode
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
0
0
0
1
0
1
0
0
1
1
1
1
1
0
1
Execution
(PC) + 1
→
stack
22h
→
PC
Status Bits
Not affected by INTM; does not affect INTM.
Description
The TRAP instruction is a software interrupt that transfers program control to
program-memory location 22h and pushes the program counter (PC) plus 1
onto the hardware stack. The instruction at location 22h may contain a branch
instruction to transfer control to the TRAP routine. Putting (PC + 1) onto the
stack enables a return instruction to pop the return address (which points to
the instruction after TRAP) from the stack. The TRAP instruction is not mask-
able.
Words
1
Cycles for a Single TRAP Instruction
ROM
DARAM
SARAM
External
4
4
4
4+3p
†
† The processor performs speculative fetching by reading two additional instruction words. If the
PC discontinuity is taken, these two instruction words are discarded.
Example
TRAP
;PC + 1 is pushed onto the stack, and then
;control is passed to program memory location
;22h.
Cycles