2022-11-26 10:44:00 +00:00
|
|
|
`timescale 1ns / 1ps
|
|
|
|
|
2022-12-24 01:13:40 +00:00
|
|
|
import rv32i_defs::*;
|
|
|
|
|
2022-11-26 10:44:00 +00:00
|
|
|
module ControlUnit
|
|
|
|
(
|
2022-11-28 03:44:11 +00:00
|
|
|
input logic[6:0] opcode,
|
|
|
|
input logic[2:0] funct_3,
|
|
|
|
input logic[6:0] funct_7,
|
|
|
|
output logic[1:0] result_src,
|
|
|
|
output logic mem_write,
|
|
|
|
output logic[2:0] alu_ctrl,
|
|
|
|
output logic alu_src,
|
|
|
|
output logic[1:0] imm_src,
|
2022-12-24 01:13:40 +00:00
|
|
|
output logic reg_write,
|
|
|
|
output logic jump,
|
|
|
|
output logic branch, branch_alu_neg
|
2022-11-26 10:44:00 +00:00
|
|
|
);
|
2022-11-28 03:44:11 +00:00
|
|
|
logic[1:0] alu_op;
|
|
|
|
MainDecoder main_decoder(
|
|
|
|
opcode,
|
|
|
|
branch,
|
|
|
|
jump,
|
|
|
|
result_src,
|
|
|
|
mem_write,
|
|
|
|
alu_src,
|
|
|
|
imm_src,
|
|
|
|
reg_write,
|
|
|
|
alu_op
|
|
|
|
);
|
|
|
|
|
|
|
|
ALUDecoder alu_decoder(
|
|
|
|
opcode[5],
|
|
|
|
funct_3,
|
2022-12-20 05:19:32 +00:00
|
|
|
funct_7[5],
|
2022-11-28 03:44:11 +00:00
|
|
|
alu_op,
|
2022-12-20 05:19:32 +00:00
|
|
|
alu_ctrl,
|
2022-12-24 01:13:40 +00:00
|
|
|
branch_alu_neg
|
2022-11-28 03:44:11 +00:00
|
|
|
);
|
2022-11-26 10:44:00 +00:00
|
|
|
endmodule
|