2/8/01 Name: _________________________
This test has 5 questions, totaling 50 points.
The test is closed book, closed notes, closed calculator, open mind, etc. In general, we are insensitive to small syntactic errors, unless we think they are symptomatic of a a significant misunderstanding of the material, so don't be panicked over details of that sort. Remember, don't spend all your time on one question. You should budget roughly one minute per point.
Question | Possible | Score |
---|---|---|
1 | 10 | |
2 | 10 | |
3 | 3 | |
4 | 10 | |
5 | 17 | |
Total | 50 |
Class | Frequency | CPI |
---|---|---|
Stores | 10% | 5 |
Loads | 20% | 7 |
Branches | 20% | 3 |
ALU operations | 50% | 4 |
1. What is the average CPI of your machine?
2. Which class of instructions contributes the most to the average CPI?
3. The hardware team tells you they can either reduce the CPI of loads to 4 cycles, or reduce the CPI of ALU operations to 3 cycles. You don't have time to make both improvements, which do you choose? Why?
4. Someone suggests a last-minute modification to the ISA. By adding some new instructions to the ISA, the instruction count for the benchmark programs will drop by 10%. However, implementing the new instructions will mean that the CPI of ALU operations and stores will increase by 1 cycle each. The modification will impact neither cycle time nor the instruction mix shown above. Should you make the modification? Why or why not? (In your calculations, compare against the original machine. Not the modified machine from part 3, above.)
LI $t0, 0xF000F00F SRL $t1, $t0, 31 SLL $t0, $t0, 1 OR $t0, $t0, $t1
JR $RAwould be encoded as follows (all numbers in decimal):
Opcode | rs | rt | rd | shamt | func |
0 | 31 | 0 | 0 | 0 | 8 |
Please see the diagram of the single-cycle implementation on the following page. You may make your changes directly to the diagram, if you wish.
2. Fill in the table of control signals below for the JR instruction. If you needed to add a new control line, use the provided empty column for it, and show us the appropriate values (for all of the listed instructions). Use don't-cares where appropriate.
Instruction | RegDst | ALUSrc | MemTo Reg | Reg Write | Mem Read | Mem Write | Branch | |
---|---|---|---|---|---|---|---|---|
R-format | 1 | 0 | 0 | 1 | 0 | 0 | 0 | |
lw | 0 | 1 | 1 | 1 | 1 | 0 | 0 | |
sw | X | 1 | X | 0 | 0 | 1 | 0 | |
beq | X | 0 | X | 0 | 0 | 0 | 1 | |
jr |
3. Is the above modification likely to impact the cycle time of the single-cycle implementation? Why or why not?
// readInt() is a function defined elsewhere. int readInt(); // Args: The number of students in the course. // Reads the specified number of scores and inserts each score into // the provided array. // Returns: The average score. Modifies the array. int grades(int A[], int students) { int sum = 0; for (int i=0; i < students; i++) { int score = readInt(); A[i] = score; sum = sum + score; } int average = sum / students; return average; }