Motorola once sc140 User Manual

Page of 40
Compiler Support on StarCore
16
Introduction to the SC140 Tools
12. Type 
next
 to step through the code.
13. Look at the register contents in the session window and write the values in the Simulator Columns 
boxes above for both sections.
Congratulations, you have completed Exercise 4.
.
5   
Split Summation Exercise
The split summation exercise shows how to modify C code using the split summation technique to get 
better parallelization. The split summation technique helps to maximize the multiple-ALU loading by 
performing arithmetic operations in parallel while requiring little algorithmic or code modifications. To 
illustrate this technique, the example performs the the optimization of the energy of a signal calculation 
already considered in Exercise 2. The power calculation is represented in Equation 2:
, (2)
where x(i) is the signal input sample at iteration iy is the power of the signal, and N is the signal length. 
As Exercise 2 shows, computing the signal energy directly from Equation 2 results in the use of only one 
ALU out of the four with one multiply-accumulate operation performed at each iteration. However, the 
split summation technique can load all four ALUs. Equation 2 is expanded as follows:
 (3)
Equation 3 explicitly highlights the four multiply-accumulate operations that can be performed in parallel. 
Figure 9 highlights where each parallel execution is represented by Group 0, Group 1, and so on. It also 
shows that the sample number, i, from one group to the other is incremented by four.
Figure 9.   Signal Power Calculation Using the Split Summation Technique
Good To Know
Unaligned data accesses lead to erroneous results.You must 
consider these issues when developing assembly code.
y
x
2
i
( )
N
1
=
y
x i
( )x i
( ) x i 1
+
(
)x i 1
+
(
x i 2
+
(
)x i 2
+
(
x i 3
+
(
)x i 3
+
(
)
+
+
+
i
0 4 8
, , ,
=
N
1
=
y =
 
x(i) * x(i) + x(i+1) * x(i+1) + x(i+2) * x(i+2) + x(i+3) * x(i+3) 
Group 0 (First cycle)
+
 x(i+4) * x(i+4) + x(i+5) * x(i+5) + x(i+6) * x(i+6) + x(i+7) * x(i+7)
+ ...
Group 1 (Second cycle)