Do Until - Analog Devices adsp-2100 Manual

Adsp-2100 family programmable single-chip microprocessors
Table of Contents

Advertisement

COND: condition
Syntax:
DO <addr> [UNTIL term] ;
Permissible terms
EQ
NE
GT
LE
NEG
POS
AC
NOT AC
MV
Example:
DO loop_label UNTIL CE ;
Description:
DO UNTIL sets up looping circuitry for zero-overhead
looping. The program loop begins at the program instruction immediately
following the DO instruction, ends at the address designated in the
instruction and repeats execution until the specified termination condition is
met (if one is specified) or repeats in an infinite loop (if none is specified). The
termination condition is tested during execution of the last instruction in the
loop, the status having been generated upon completion of the previous
instruction. The address (<addr>) of the last instruction in the loop is stored
directly in the instruction word.
If CE is used for the termination condition, the processor's counter (CNTR
register) is decremented once for each pass through the loop.
When the DO instruction is executed, the address of the last instruction is
pushed onto the loop stack along with the termination condition and the
current program counter value plus 1 is pushed onto the PC stack.
Any nesting of DO loops continues the process of pushing the loop and PC
stacks, up to the limit of the loop stack size (4 levels of loop nesting) or of the
PC stack size (16 levels for subroutines plus interrupts plus loops). With
either or both the loop or PC stacks full, a further attempt to perform the DO
instruction will set the appropriate stack overflow bit and will perform a no-
operation.
Status Generated:
ASTAT:
Not affected.
SSTAT:
7
6
LSO LSE SSO SSE CSO CSE PSO PSE
*
0
LSO
Loop Stack Overflow: set if the loop stack overflows; otherwise not affected.
LSE
Loop Stack Empty: always cleared (indicating loop stack not empty)
PSO
PC Stack Overflow: set if the PC stack overflows; otherwise not affected.
PSE
PC Stack Empty: always cleared (indicating PC stack not empty)
GE
LT
AV
NOT AV
NOT MV
CE
{CNTR is decremented
each pass through loop}
5
4
3
2
(instruction continues on next page)
PROGRAM FLOW

DO UNTIL

FOREVER
1
0
*
0
15
15 – 81

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents