INSTRUCTION DESCRIPTIONS

 

ENDDO

End Current DO Loop

ENDDO

Operation:

Assembler Syntax:

 

SSL(LF) SR;SP – 1SP

ENDDO

 

SSH LA; SSL LC;SP –1 SP

Description: Terminate the current hardware DO loop before the current loop counter (LC) equals one. If the value of the current DO loop counter (LC) is needed, it must be read before the execution of the ENDDO instruction. Initially, the loop flag (LF) is restored from the system stack and the remaining portion of the status register (SR) and the program counter (PC) are purged from the system stack. The loop address (LA) and the loop counter (LC) registers are then restored from the system stack.

Restrictions: Due to pipelining and the fact that the ENDDO instruction accesses the program controller registers, the ENDDO instruction must not be immediately preceded by any of the following instructions:

Immediately before ENDDO

MOVEC to LA, LC, SR, SSH, SSL, or SP

 

MOVEM to LA, LC, SR, SSH, SSL, or SP

 

MOVEP to LA, LC, SR, SSH, SSL, or SP

 

MOVEC from SSH

 

MOVEM from SSH

 

MOVEP from SSH

 

ORI MR

 

ANDI MR

 

REP

Also, the ENDDO instruction cannot be the last (LA) instruction in a DO loop.

Example:

 

:

 

DO Y0,NEXT

;exec. loop ending at NEXT (Y0) times

:

 

MOVEC LC,A

;get current value of loop counter (LC)

CMP Y1,A

;compare loop counter with value in Y1

JNE ONWARD

;go to ONWARD if LC not equal to Y1

ENDDO

;LC equal to Y1, restore all DO registers

JMP NEXT

;go to NEXT

ONWARD :

;LC not equal to Y1, continue DO loop

:

;(last instruction in DO loop)

NEXT MOVE #$123456,X1

;(first instruction AFTER DO loop)

A - 98

INSTRUCTION SET DETAILS

MOTOROLA

Page 367
Image 367
Motorola 24-Bit Digital Signal Processor, DSP56000 manual End Current do Loop, Immediately before Enddo