
376
SAM G51 [DATASHEET]
11209C–ATARM–20-Dec-13
Figure 19-3.
Code Read Optimization for FWS = 3
Note:
When FWS is included between 1 and 3, in case of sequential reads, the first access takes (FWS+1) cycles, the other
ones only 1 cycle.
19.4.2.3
Code Loop Optimization
Code loop optimization is enabled when the CLOE bit of EEFC_FMR is set to 1.
When a backward jump is inserted in the code, the pipeline of the sequential optimization is broken and becomes
inefficient. In this case, the loop code read optimization takes over from the sequential code read optimization to prevent
the insertion of wait states. The loop code read optimization is enabled by default. In EEFC_FMR, if the bit CLOE is reset
to 0 or the bit SCOD is set to 1, these buffers are disabled and the loop code read is not optimized.
When code loop optimization is enabled, if inner loop body instructions L
0 to Ln are positioned from the 128-bit Flash
memory cell M
b0 to the memory cell Mp1, after recognition of a first backward branch, the first two Flash memory cells Mb0
and M
b1 targeted by this branch are cached for fast access from the processor at the next loop iteration.
body with the fast read access to the loop entry cache, the entire loop can be iterated with no wait state.
Figure 19-4.
Code Loop Optimization
Flash Access
Buffer 0 (128bits)
Master Clock
ARM Request
(32-bit)
Data To ARM
Buffer 1 (128bits)
0-3
XXX
Bytes 16-31
@Byte 0
@4
@8
Bytes 0-15
Bytes 16-31
Bytes 32-47
Bytes 48-63
XXX
Bytes 0-15
4-7
8-11
12-15
@12
@16
@20
24-27
28-31
32-35
36-39
16-19
20-23
40-43
44-47
@24
@28 @32@36
@40
@44
@48
@52
Bytes 32-47
48-51
Ln
Ln-1
Ln-2
Ln-3
Ln-4
Ln-5
L5
L4
L3
L2
L1
L0
B1
B2
B3
B4
B5
B6
B7
B0
P1
P2
P3
P4
P5
P6
P7
P0
Mb0
Mb0
Mb1
Mp0
Mp1
Backward address jump
2x128-bit loop entry
cache
2x128-bit prefetch
buffer
L0 Loop Entry instruction
Ln Loop End instruction
Flash Memory
128-bit words
Mb0 Branch Cache 0
Mb1 Branch Cache 1
Mp0 Prefetch Buffer 0
Mp1 Prefetch Buffer 1