CPSC 330 - Spring 2011 Homework 3 Due on Monday, March 14 1. 4.1.1 a and b - Give values for all control signals in Fig. 4.2 as well as whether each of the three muxes selects its upper or lower input to pass through. For ALU operation, use one of the function names in the table on p. 316. For other control signals, use either 0 or 1, and assume Zero = 0. 2. 4.13.1 a - Draw the data dependency diagram for this code and identify data dependencies through register accesses and the types of the dependencies (RAW,WAR,WAW). 3. Run the following program on EduMIPS64. (See the HW 3 examples for info on using EduMIPS64.) .data a: .word 1,2,3,4 b: .word 0,0,0,0 .text main: daddi r1,r0,a daddi r2,r0,b daddi r3,r0,0 loop: ld r4,0(r1) daddi r4,r4,1 sd r4,0(r2) daddi r1,r1,8 daddi r2,r2,8 daddi r3,r3,1 slti r5,r3,4 bnez r5,loop finish: halt The program calculates b[i] = a[i] + 1 for i = 0 to 3 (a) Draw the data dependency diagram for the code in the body of the loop and identify data dependencies through register accesses and the types of the dependencies (RAW,WAR,WAW). (b) Run the code and compare the cycles required with and without forwarding. 4. Download the program http://www.cs.clemson.edu/~mark/330/predictors.c Run the predictors with these three input files: trace1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 -1 trace2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -1 trace3 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 -1 (a) Draw the state diagram for the encoding 0x80000. (b) Draw the state diagram for the encoding 0x84400. (c) Why does gshare do so much better than the simple predictors on trace3?