Cleans up control unit
This commit is contained in:
@@ -142,8 +142,9 @@ class ControlUnit() extends Module {
|
||||
val funct7 = io.instruction(31, 25);
|
||||
|
||||
switch(opcode) {
|
||||
// ~~~ Single instruction OpCodes ~~
|
||||
|
||||
// U instructions
|
||||
// ~ U instructions ~
|
||||
is(OpCode.LUI) {
|
||||
io.reg_file_we := true.B // Write to regfile
|
||||
io.mux_alu_imm := false.B // Send immy directly to refile
|
||||
@@ -157,19 +158,7 @@ class ControlUnit() extends Module {
|
||||
io.optype := OpType.U
|
||||
}
|
||||
|
||||
// OpImm instructions
|
||||
is(OpCode.OpImm) {
|
||||
io.reg_file_we := true.B // Write to regfile
|
||||
OpImm.opImm(io)
|
||||
}
|
||||
|
||||
// OpR instructions
|
||||
is(OpCode.OpR) {
|
||||
io.reg_file_we := true.B // Write to regfile
|
||||
OpR.opR(io);
|
||||
}
|
||||
|
||||
// J instructions
|
||||
// ~ J instructions ~
|
||||
is(OpCode.JAL) {
|
||||
io.alu_opcode := AluOpCode.Add // ALU is unused
|
||||
|
||||
@@ -201,24 +190,27 @@ class ControlUnit() extends Module {
|
||||
io.optype := OpType.I
|
||||
}
|
||||
|
||||
is(OpCode.OpImm) {
|
||||
OpImm.opImm(io)
|
||||
}
|
||||
|
||||
is(OpCode.OpR) {
|
||||
OpR.opR(io);
|
||||
}
|
||||
|
||||
is(OpCode.OpBranch) {
|
||||
io.optype := OpType.B;
|
||||
OpBranch.opBranch(io);
|
||||
}
|
||||
|
||||
is(OpCode.OpStore) {
|
||||
io.optype := OpType.S
|
||||
OpStore.opStore(io);
|
||||
}
|
||||
|
||||
is(OpCode.OpLoad) {
|
||||
io.optype := OpType.I
|
||||
OpLoad.opLoad(io);
|
||||
}
|
||||
|
||||
is(OpCode.OpImmW) {
|
||||
io.reg_file_we := true.B // Write to regfile
|
||||
io.optype := OpType.I
|
||||
OpImmW.opImmW(io);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user