Dynamic Programming Rules

7.6.6 Rule Detection Across Exception Boundaries

The SC140 can take an exception at most VLES boundaries in a program, and return using a RTE//RTED/ instruction after completing the exception service routine. The programming rules ensure that the transition from the program to the exception service routine, and the return back to the program are correct. The return back to the program is covered by the RTE//RTED/ programming rules in this chapter.

The following rules cover the transition from the program to the exception service routine. They apply to the first 1-2 VLES of the exception service routine, and do not apply to the program that was interrupted:

Rule SR.2a

Instructions that are affected by the C, T, S0, S1, or VF0-VF3 status bits in SR are not allowed in the first two VLES of an exception service routine. This rule does not apply to instructions that are affected by the EXP status bit in SR.

The assembler-mapped instruction CLR Dn is never affected by the SR status bits, even though it is implemented as SUB Da,Da,Dn. Therefore, this rule applies to the SUB instruction, but not to CLR (SUB Da,Da,Dn is taken as CLR in this context).

Rule SR.4b

MOVE-like instructions that reads or writes the EMR register are not allowed at the first two VLES of an exception service routine. The exception to this rule is any bit mask instruction(s) that does not have a zero value to the corresponding position of DOVF bit in the mask or that accesses the high portion of the EMR.

Example 7-85. EMR access at the start of an exception

; ISR Start

; Not allowed

move.l emr.l,d0

; ISR Start

; Not allowed

bmclr #$0004,emr.l

; ISR Start

; Allowed

bmclr #$fff0,emr.l

; ISR Start

; Allowed

bmtstc #$0020,emr.l

; ISR Start

; Not allowed

move #$00000004,sr

Rule SR.6

The following instructions are not allowed in the first two VLES of an exception service routine:

DOENn/DOENSHn

CONT/CONTD

BREAK

SKIPLS

7-46

SC140 DSP Core Reference Manual

Page 296
Image 296
Freescale Semiconductor SC140 specifications Rule Detection Across Exception Boundaries, Rule SR.2a, Rule SR.4b, Rule SR.6