Control

Control unit

We will have the control unit that is plug into all the components mention in the previous slides (MUX/REGISTERS/DATAMEMORY)
This will allow us to control when we want each component to accept each specific data

Control Signals




RegDst
Controls the multiplexer.
False (0) - Write register = Inst[20:16] //Register Target
True (1) - Write register = Inst[15:11] //Register Destination
(Inst[Bitsfrom instruction])

R-Type -> 1
lw -> 0 //has no third register, rt is the register number
sw-> X //we dont care, we are not even going to write back
beq-> X //we dont care

RegWrite
Controls the write to register
False (0) - No register Write
True (1) - New value will be written

R-Type -> 1
lw -> 1
sw-> 0 
beq-> 0 //because of the previous

ALUSrc
Controls the write to register
False (0) - Operand2 = Register Read Data 2
True (1) - Operand2 = SignExt (Inst [15:0]) //for immediate

R-Type -> 0
lw -> 1
sw-> 1 
beq-> 0 //The signal is send to the adder, we need to ensure that the second register goes to the ALU

Memread
Under datamemory
False (0) - Not performing memory read access
True (1) - Read memory using address

R-Type -> 0
lw -> 1
sw-> 0 
beq-> 0 

Memwrite
Under datamemory
False (0) - Not performing memory write access
True (1) - Write memory using address

R-Type -> 0
lw -> 0
sw-> 1 
beq-> 0 


MemToReg
This mux is reverse input
To select the memory or ALU result to be written back to the register
False (0) - ALU result
True (1) - Memory read data

R-Type -> 0 //write back to register
lw -> 1 //route to back from memory
sw-> X
beq-> X //Due to regwrite control ignoring

PCSrc
Selects the next instruction or the branch target address
However, is this signal generate from the type of pc source
We need to check if its a branch instruction. (It could be SW)

Check if its Branch:
Branch = 1
Not Branch = 0

Check if we can jump:
Taken = 1
Not Taken = 0

We will use an AND gate to and it together to drive this MUX

R-Type -> 0
lw -> 0
sw-> 0 
beq-> 1 //only beq will jump

ALUcontrol signal

We need to know the opcode and the function code to generate the alu signal

Multilevel decoding

Using the control that is looking at the opcode, generate the ALUop signal
Generate ALUCtrl signal from ALUop and optionally function field.





<Prev