Freescale Semiconductor SC140 specifications Rtsd

Models: SC140

1 760
Download 760 pages 48.94 Kb
Page 686
Image 686

RTSD

RTSD Return From Subroutine With Delay Slot (AGU) RTSD

Operation

Assembler Syntax

If (RAS valid), then RAS → PC;

RTSD

else (SP – 8) → PC;

 

always SP – 8 → SP

 

Description

 

RTSD

 

Returns from a subroutine after executing the execution set in the delay slot. If the RAS is valid, the PC is restored from the RAS. Otherwise, the PC is popped from the active stack in memory as a 32-bit long word. The implicit pop is done before the execution set in the delay slot is executed. The stack pointer always decrements by 8, RAS becomes invalid, and program execution continues at the address specified in the PC.

Note: Because RTSD uses the RAS mechanism, returning from an exception using RTSD is illegal. The result is undefined.

Status and Conditions that Affect Instruction

Register Address

Bit Name

Description

SR[18]

EXP

Determines which stack pointer is used.

Status and Conditions Changed by Instruction

None.

Example

rtsd

Instruction

Comment

 

 

Initially ESP = $2000

 

jsr SUB

Jump to subroutine at SUB.

 

- - -

Skip over these instructions.

SUB

MOVE.w #$20,d1

Execute the subroutine here. PC and SR pushed onto the

 

 

stack at $2000 and $2004.

 

- - -

Execute the $47 to d9 and increment d9 to $48, the instruc-

 

rtsd move.w #$47,d9

 

inc d9

tion in the delay slot. Return from the subroutine. PC and

SR popped from the stack.

A-372

SC140 DSP Core Reference Manual

Page 686
Image 686
Freescale Semiconductor SC140 specifications Rtsd