S

Identified Control Signals

Control SignalExecution StagePurpose
RegDstDecode/ Operand FetchSelect the destination register number
RegWriteDecode/ Operand Fetch RegWriteEnable writing for register
ALUSrcALUSelect the 2nd operand for ALU
ALUcontrolALUSelect the operation to be performed
MemRead/ MemWriteMemoryEnable reading/ writing of data memory
MemToRegRegWriteSelect the result to be written back to register file
PCSrcMemory/ RegWriteSelect the next PC value

Generating Control Signals

Generally, the control signals are generated based on the instruction to be executed.

  • e.g. R-Format RegDst = 1 We want to design a combinational circuit to generate these signals based on Opcode and (possibly) Function code
  • A control unit is needed!
  • See The Control Unit

The Control Unit

  • Generate all the signals!
  • Based on opcode and (optionally) funct

Control Signals

RegDst

  • False (0): Write Register = Inst[20:16]
  • True (1): Write Register = Inst[15:11]

RegWrite

  • False (0): No register write
  • True (1): New value will be written

ALUSrc

Select second operand for the ALU

  • False (0): Operand2 = Register Read Data 2
  • True (1): Operand2 = SignExt(Inst[15:0])

MemRead

  • False (0): Not performing memory read access
  • True (1): Read memory using Address

MemWrite

  • False (0): Not performing memory write operation
  • True (1): memory[Address] Register Read Data 2
    • Data is written into the address that is given

MemToReg

  • False (0): Register write data = Memory read data
  • True (1): Register write data = ALU result

PCSrc

  • Also uses information from isZero
    • isZero = 0 if branch are not equal
    • isZero = 1 if branch are equal
  • Also relies on opcode of branch instruction - beq/ bne
  • Branch AND isZero
BranchisZeroPCSrc
000
100
010
111
  • False (0): Next PC = PC + 4
  • True (1): Next PC = SignExt(Inst[15:0]) << 2 + (PC + 4)

ALU Control Signal

  • the most challenging control signal!
  • the ALU is a combinational circuit

ALUcontrol

AinverBinvertOperationFunction
0000AND
0001OR
0010add
0110subtract
0111slt
1100NOR

Info

subtract is achieved using since is 2s complement

Generating ALUcontrol

Intermediate Signal: ALUop

  1. Use Opcode to generate 2-bit ALUop signal
    • Represents the classification of the instructions
  2. Use ALUop signal (2-bit) and Function Code (6-bit) field to generate 4-bit ALUcontrol signal
Instruction TypeALUop
lw / sw00
beq01
R-type10

ALUcontrol

  • bit 3 = 0
  • bit 2 = ALUop0 1 or (F5 1 and F1 == 1)

Summary of the Combination Circuit

Instruction Execution