Modulo Scheduling of Multicycle Loops
6-65
Optimizing Assembly Code via Linear Assembly
6.6.6.1
Resource Conflicts
Resources from one instruction cannot conflict with resources from any other
instruction scheduled modulo iteration intervals away. In other words, for a
2-cycle loop, instructions scheduled on cycle n
cannot use the same resources
as instructions scheduled on cycles n + 2, n + 4, n
+ 6, etc. Table 6–13 shows
the addition of the SHR bi+1 instruction. This must avoid a conflict of resources
in cycles 5 and 7, which are one iteration interval away from each other.
Even though LDW
bi_i+1 (.D2, cycle 0) finishes on cycle 5, its child, SHR bi+1,
cannot be scheduled on .S2 until cycle 6 because of a resource conflict with
SHR pi+1_scaled, which is on .S2 in cycle 7.
Figure 6–12. Dependency Graph of Weighted Vector Sum (Showing Resource Conflict)
B side
A side
2
1
1
1
ADD
1
5
5
SHR
AND
LDW
ADD
SHR
2
SHR
MPYHL
5
5
MPY
ci
bi_bi+1
bi+1
bi
ci+1
pi+1_scaled
pi_scaled
LDW
pi+ 1
pi
ai_ai+ 1
Scheduled
on cycle 5
Scheduled
on cycle 7