In the basic singlecycle implementation what are the values
In the basic single-cycle implementation, what are the values of control signals generated by the control unit for the instructions shown in the following table? Fill in the following table with appropriate values such as true/false or specific ALU operations that need to be activated. Assume that a selection signal of false (“0”) selects the top entry of a multiplexor.
Solution
For Subtract operation like
Here’s a simple ALU with five operations, selected by a 3-bit control signal ALUOp. Functions like and or add subtract slt Have ALUOp 000,001,010,110,111 respectively
Subtract have 1)reg write value of 0/false2) Mem read and write also 0/false
ALUMux is the control signal that controls the Mux at the ALU input, 0 (Reg) selects the output of the register file and 1 (Imm) selects the immediate from the instruction word as the second input to the ALU.
RegMux is the control signal that controls the Mux at the Data input to the regis- ter file, 0 (ALU) selects the output of the ALU and 1 (Mem) selects the output of memory.
A value of X is a “don’t care” (does not matter if signal is 0 or 1) so ALU mux and Reg mux also becomes zero or false
Ii) lw
An example load instruction is lw $t0, –4($sp). The ALUOp must be 010 (add), to compute the effective address. Regs write value of 1 , Mem write value of 0and Mem read value of 1, thus from these values we can get Alu MUx and Regmux value
lw and sw are the only instructions that use the constant field. They also
depend on the ALU to compute the effective memory address
.iii) sw reg write is 0/ false
Mem read is 0/false and Mem write is 1/true through this ALU MUx and Reg MuX value can be known
All three have ALU op 010
Iv) sra-
Shift Instructions (4/4)
°Since shifting may be faster than multiplication, a good compiler usually notices when C code multiplies by a power of 2 and compiles it to a shift instruction:
a *= 8; (in C)
would compile to:
sll $s0,$s0,3 (in MIPS)
°Likewise, shift right to divide by powers of 2
