RVSCC/rtl/control_unit.sv

41 lines
961 B
Systemverilog
Raw Permalink Normal View History

`include "timescale.sv"
2023-01-01 22:28:56 +00:00
import rv32i_defs::*;
2023-02-26 23:26:11 +00:00
module control_unit (
2023-01-29 04:55:22 +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,
2023-01-01 22:28:56 +00:00
output logic mem_write,
2023-01-29 04:55:22 +00:00
output logic [2:0] alu_ctrl,
2023-01-01 22:28:56 +00:00
output logic alu_src,
2023-01-29 04:55:22 +00:00
output logic [1:0] imm_src,
2023-01-01 22:28:56 +00:00
output logic reg_write,
output logic jump,
2023-01-29 04:55:22 +00:00
output logic branch,
2023-02-26 23:26:11 +00:00
output logic branch_alu_neg
2023-01-01 22:28:56 +00:00
);
2023-01-29 04:55:22 +00:00
logic [1:0] alu_op;
2023-02-26 23:26:11 +00:00
main_decoder main_decoder (
2023-01-29 04:55:22 +00:00
.opcode(opcode),
.branch(branch),
.jump(jump),
.result_src(result_src),
.mem_write(mem_write),
.alu_src(alu_src),
.imm_src(imm_src),
.reg_write(reg_write),
.alu_op(alu_op)
);
2023-02-26 23:26:11 +00:00
alu_decoder alu_decoder (
2023-01-29 04:55:22 +00:00
.opcode_5(opcode[5]),
.funct_3(funct_3),
.funct_7_5(funct_7[5]),
.alu_op(alu_op),
.alu_ctrl(alu_ctrl),
.branch_neg(branch_alu_neg)
);
2023-01-01 22:28:56 +00:00
endmodule