Programming Guidelines

Rule J.5

A program section that ends near a border of reserved memory must end with a non-conditional change of flow (COF) instruction(s) followed by 4 aligned fetch sets (64 bytes) of NOPs or un-allocated memory. If the last meaningful instruction is not aligned with an end of a fetch set, some more NOPs are needed (up to

7)before 4 mentioned fetch sets. This is needed so that memory systems that generate an exception when reserved memory is accessed will not get an exception due to the pre-fetching of the core into the reserved memory.

Rule L.N.5

The LFn status bit (and SLF for a short loop) in SR must be set when executing loop body n (between the LOOPSTARTn and LOOPENDn directives).

Example 7-90. LFn Enabled During Loop Body n

dosetup1 label1

doen1

#5

pop sr

;not allowed if pop disables LF1

...

 

loopstart1

label1

nop nop nop loopend1

Good programming practice uses the loop control instructions listed in Table A-14: AGU Loop Control (Including Loop COF) Instructions on page A-18 for enabling and terminating loops. The programmer should not change the LFn and SLF status bits in SR while a loop is enabled. This will ensure that rule L.N.5 is enforced.

7.7.1 Rules Not Detected Across COF Boundaries

The simulator cannot detect all rules across COF boundaries. This may be due to limited analysis of the execution trace, or missing information in the binary encoding input to the simulator. The following rules must be detected by the programmer across COF boundaries:

L.G.5

7.7.2Good Programming Practices

Good programming practices assist the assembler and simulator in detecting programming rule violations. They also help the programmer write robust, compatible SC140 code. Some are generic to all software, and others are specific to the SC140 . They are organized in several categories.

7.7.2.1 Source Code Practices

Use symbolic COF destination labels and symbol arithmetic (not absolute addresses). Let the assembler resolve the label to a COF destination address.

Use symbolic data labels (not absolute addresses). Use symbolic labels and symbol arithmetic for offsets into data structures. Let the assembler resolve the label to a data element address.

SC140 DSP Core Reference Manual

7-49

Page 299
Image 299
Freescale Semiconductor SC140 Rules Not Detected Across COF Boundaries, Good Programming Practices, Source Code Practices