12
Programming Model
12 – 5
12.1.2.3 Status And Mode Bits
The stack status (SSTAT) register contains full and empty flags for stacks.
The arithmetic status (ASTAT) register contains status flags for the
computational units. The mode status (MSTAT) register contains control
bits for various options. MSTAT contains 4 bits that control alternate
register selection for the computational units, bit-reverse mode for DAG1,
and overflow latch and saturation modes for the ALU. MSTAT also has 3
bits to control the MAC result placement, timer enable, and Go mode
enable.
Use the Mode Control instruction (ENA, DIS) to conveniently enable or
disable processor modes.
12.1.2.4 Stacks
The program sequencer contains four stacks that allow loop, subroutine
and interrupt nesting.
The PC stack is 14 bits wide and 16 locations deep. It stores return
addresses for subroutines and interrupt service routines, and top-of-loop
addresses for loops. PC stack handling is automatic for subroutine calls
and interrupt handling. In addition, the PC stack can be manually pushed
or popped using the PC Stack Control instructions
TOPPCSTACK=
reg
and
reg=TOPPCSTACK
.
The loop stack is 18 bits wide, 14 bits for the end-of-loop address and 4
bits for the termination condition code. The loop stack is four locations
deep. It is automatically pushed during the execution of a DO UNTIL
instruction. It is popped automatically during a loop exit if the loop was
nested. The loop stack may be manually popped with the
POP LOOP
instruction.
The status stack, which is automatically pushed when the processor
services an interrupt, accommodates the interrupt mask (IMASK), mode
status (MSTAT) and arithmetic status (ASTAT) registers. The depth and
width of the status stack varies with each processor, since different
processors have different numbers of interrupts. The status stack is
automatically popped when the return from interrupt (RTI instruction) is
executed. The status stack can be pushed and popped manually with the
PUSH STS
and
POP STS
instructions.
The count stack is 14 bits wide and holds counter (CNTR) values for
nested counter-based loops. This stack is pushed automatically with the
current CNTR value when there is a write to CNTR. The counter stack
may be manually popped with the
POP CNTR
instruction.