Chapter 4: 7. (page 360)
In this exercise we examine in detail how an instruction is executed in a single-cycle datapath. Problems in this exercise refer to a clock cycle in which the processor fetches the following instruction word: 10101100011000100000000000010100. Assume that data memory is all zeros and that the processor’s registers have the following values at the beginning of the cycle in which the above instruction word is fetched:
r0 | r1 | r2 | r3 | r4 | r5 | r6 | r8 | r12 | r31 |
0 | –1 | 2 | –3 | –4 | 10 | 6 | 8 | 2 | –16 |
4.7.1 [5] What are the outputs of the sign-extend and the jump “Shift left 2” unit (near the top of Figure 4.24) for this instruction word?
4.7.2 [10] What are the values of the ALU control unit’s inputs for this instruction?
4.7.3 [10] What is the new PC address after this instruction is executed? Highlight the path through which this value is determined.
4.7.4 [10] For each Mux, show the values of its data output during the execution of this instruction and these register values.
4.7.5 [10] For the ALU and the two add units, what are their data input values?
4.7.6 [10] What are the values of all inputs for the “Registers” unit?
Short Answer
4.7.1
The outputs of the sign-extend is 00000000000000000000000000010100
The outputs of the jump “Shift left 2” unit is 0001100010000000000001010000
4.7.2
The values of the ALU control unit’s inputs –00 [ALUOp],010100 [Instruction]
4.7.3
The required values:
The new PC address - PC + 4.
The required path will bePC to Add (PC + 4) to branch Mux to jump Mux to PC.
4.7.4
The required values:
WrReg Mux-2 or 0 (RegDst is X)
ALU Mux-20
Mem/ALU Mux-X
Branch Mux-PC + 4
Jump Mux-PC + 4
4.7.5
The required values:
ALU: −3 and 20
Add (PC + 4):PC and 4
Add (Branch) : PC+4 and 20x4
4.7.6
The required values:
Read Register 1: 3
Read Register 2:2
Write Register:X
Write Data:X
RegWrite : 0