Part B: Implementing the Control Logic Block (setControl)
In this step, you will be implementing the control logic block in the following diagram.
Add
Instruction [6-0]
Branch
MemRead
MemtoReg
ALUOP
MemWrite
ALUSrc
RegWrite
Read
address
Instruction [19-15]
Read
register 1 Read
data 1
Instruction [24-20]
Instruction
[31-0]
Instruction
memory
Read
register 2
Instruction [11-7]
Write Read
data 2
Write
Instruction [31-0]
Add Sum
Zero
Mux
ALU ALU
result
Address Read
data
Registers
Write Data
data memory
Imm
Gen
ALU
contro
Instruction [30, 14-12]
Mux
The first function in the lab.cc file is setControl(). This is the function you will write your code in to implement your Control Unit. Your
task for the first part of this lab is to assign the correct value to the control signals based upon the opcode of the given instructions. For
example, in order to assign the control signal Branch a value of One, you should use the following code inside the function.