In this exercise we examine in detail how an instruction is executed in a single
ID: 3802535 • Letter: I
Question
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: 1 0 1 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 Assume that the 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: a. What are the outputs of the sign-extend and the jump "Shift-Left-2" (near the top of Figure 4.24) for this instruction word? b, What are the values of ALU control unit's inputs (ALUOp and Instruction operation) for this instruction? c. What is the new PC address after this instruction is executed? Highlight the path through which this value is determined. d. For the ALU and the two add units, what are their data input values? e. What are the values of all inputs for the "Registers" unit?Explanation / Answer
a)Sign Extended
Sign-extend takes the lower 16 bits and expands them to be 32 bits, outputting
00000000000000000000000000010100
Shift left 2
The shift left 2 in the upper-left is used for a jump, which takes the lower 26 bits and expands them to 28 bits with a left-shift.
0010000101000000000001010000
b) The ALU control gets the lower 6 bits as it's main input, so 010100. It also gets a signal from the main Control indicating the ALU op. In this case the main control gets bits 31-26 as it's input, 010100. This corresponds to “lw”, which sends a 00 to the ALU Control.
c) PC outputs goes into ALU to be added to 4 -> PC+4
This output gets directed into a MUX into the 0 port
The branch control is set to 0 so PC+4 (on the 0 port)
moves through. This output goes to the 0 port of the next MUX
Not a jump instructions so jump control set to 0 -> so PC+4 moves
through the MUX again. Output gets put back into PC so PC has been
set to PC+4.
d) For the top ALU unit, the inputs are PC+4 and sign-extended 16-bit immediate
shifted left 2. We found that the 16-bit immediate was 20 so shifting left
2 would result in 20*4 = 80.
For the bottom ALU unit, one of the inputs is Read data 1. Read register 1
is 00100 -> register 3. From the table, read data 1 is -3. The other input
will be the sign-extended 16-bit immediate, which we found to be 20.
The PC adder unit will have inputs of PC and 4.
e) Read register 1 will take bits 25-21 as input, which are 00100 = 4
Read register 2 will take bits 20-16 as input, which are 00101 = 5
Since we are doing a store (from register to memory) we don't care what
goes into the write register or the write data ports (because we aren't
writing to the register file). It follows that the RegWrite control will be 0.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.