beautypg.com

Dor start pc relative hardware loop dor – Motorola DSP96002 User Manual

Page 267

background image

MOTOROLA

DSP96002 USER’S MANUAL

A - 79

DOR

Start PC Relative Hardware Loop

DOR

Operation:

LA

SSH; LC

SSL; X:

LC

PC

SSH; SR

SSL; PC+xxxx

LA; 1

LF

LA

SSH; LC

SSL; Y:

LC

PC

SSH; SR

SSL; PC+xxxx

LA; 1

LF

LA

SSH; LC

SSL; S

LC

PC

SSH; SR

SSL; PC+xxxx

LA; 1

LF

LA

SSH; LC

SSL; #xxx

LC

PC

SSH; SR

SSL; PC+xxxx

LA; 1

LF

Assembler Syntax:

DOR X: ea, label

DOR Y: ea, label

DOR S,label

DOR #count,label

Description:

This instruction initiates the beginning of a PC relative hardware program loop. The current loop address

(LA) and loop counter (LC) values are pushed onto the system stack. With proper system stack manage-

ment, this allows unlimited nested hardware DO loops. The PC and SR are pushed onto the system stack.

The PC is added to the 32-bit address displacement extension word and the resulting address is loaded

into the loop address register (LA). The PC points to the next instruction when it is added to the displace-

ment. The effective address specifies the address of the loop count which is loaded into the loop counter

(LC). The DO loop is executed LC times. If LC=0, the loop is executed 2**32 times. All address register
indirect addressing modes (less Long Displacement) may be used. Register Direct addressing mode may

also be used. If immediate short data is specified, the LC is loaded with the zero extended 19-bit immedi-

ate data.

During hardware loop operation, each instruction is fetched each time through the program loop. There-

fore, instructions being executed in a hardware loop are interruptible and may be nested. The value of the

PC pushed onto the system stack is the location of the first instruction after the DOR instruction. This

value is read from the top of the system stack to return to the start of the program loop. When DOR in-

structions are nested, the end of loop addresses must also be nested and are not allowed to be equal.

An example is shown below.

DOR

#n1,END1

DOR

#n2,END2

MOVE D0,X:(R0)+

END2

ADD

D1,D2

X:(R1)+,D3

END1

The assembler calculates the end of loop address LA (PC relative address extension word xxxx) by eval-

uating the end of loop expression and subtracting one. Thus the end of loop expression in the source code