RVSCC/rtl/PipelinedControlUnit.sv

47 lines
946 B
Systemverilog
Raw Normal View History

2022-12-24 01:13:40 +00:00
`timescale 1ns / 1ps
2023-01-29 04:55:22 +00:00
module PipelinedControlUnit (
input logic [6:0] opcode,
input logic [2:0] funct_3,
input logic [6:0] funct_7,
2022-12-24 01:13:40 +00:00
output logic reg_write,
2023-01-29 04:55:22 +00:00
output logic [1:0] result_src,
2022-12-24 01:13:40 +00:00
output logic mem_write,
output logic branch,
2023-01-29 04:55:22 +00:00
output logic [2:0] alu_ctrl,
2022-12-24 01:13:40 +00:00
output logic alu_src,
2023-01-29 04:55:22 +00:00
output logic [1:0] imm_src
2022-12-24 01:13:40 +00:00
);
2023-01-29 04:55:22 +00:00
//logic branch, branch_result, branch_neg, jump;
//assign pc_src = (branch & branch_result) | jump;
/*
2022-12-24 01:13:40 +00:00
always_comb begin
case(branch_neg)
'd0: branch_result = !zero;
'd1: branch_result = zero;
endcase
end*/
2023-01-29 04:55:22 +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,
funct_7[5],
alu_op,
alu_ctrl,
branch_neg
);
2022-12-24 01:13:40 +00:00
endmodule