next up previous contents
Next: 4.9 Example 2 Up: 4 Defoe: An Example Previous: 4.7 Assembly Language Syntax   Contents

4.8 Example 1

This example demonstrates the execution model of the Defoe by computing the following set of expressions.

a = x + y - z

b = x + y - 2 * z

c = x + y - 3 * z

Register assignments: r1 = x, r2 = y, r3 = z, r32 = a, r33 = b, r34 = c

Line # Code Comments

1. add r4 = r1, r2 // r4 = x + y

2. shl r5 = r3, 1 // r5 = z $<<$ 1, i.e. z * 2

3. mul r6 = r3, 3 ; // r6 = z * 3. Stop bit.

4. sub r32 = r4, r3 // r5 = a = gets x + y - z

5. sub r33 = r4, r5 ; // r33 = b = x + y - 2 * z.

// Stop bit.

6. sub r34 = r4, r6 ; // r34 = c = x + y - 3 * z.

// Stop bit.

The first three lines are followed by a stop bit to indicate that those three operations constitute a MultiOp and that they should be executed in parallel. Unlike a super scalar processor where independent operations are detected by the processor, the programmer/compiler has indicated to the processor by means of the stop bit that these 3 operations are independent. The multiply operation will typically have a higher latency than the other instructions. In that case we have two different ways of scheduling this code. Since Defoe already uses score boarding to deal with variable load latencies, it is only natural for the scoreboard to stall issue till the multiply operation is done. In a traditional VLIW processor, the compiler will insert additional NOPs after the first MultiOp. Lines 4-6 show how structural hazards are handled in a VLIW system. The compiler is aware that Defoe has only two simple integer ALUs. Even though instruction 6 is independent of instructions 4 and 5, because of the unavailability of a suitable function unit, instruction 6 is issued as a separate MultiOp, one cycle after its two predecessors. In a super scalar processor, this decision will be handled at run-time by the hardware.


next up previous contents
Next: 4.9 Example 2 Up: 4 Defoe: An Example Previous: 4.7 Assembly Language Syntax   Contents
Binu K. Mathew