RVSCC/rtl/jump_control.sv

23 lines
485 B
Systemverilog
Raw Normal View History

`include "timescale.sv"
2022-12-24 01:13:40 +00:00
2023-02-26 23:26:11 +00:00
module jump_control (
2023-01-29 04:55:22 +00:00
input logic jump,
2023-02-26 23:26:11 +00:00
input logic branch,
input logic branch_alu_neg,
input logic zero,
2022-12-24 01:13:40 +00:00
output logic pc_src
);
2023-01-29 04:55:22 +00:00
logic alu_result, branch_result;
assign alu_result = !zero;
2022-12-24 01:13:40 +00:00
2023-01-29 04:55:22 +00:00
always_comb begin
case (branch_alu_neg)
'd0: branch_result = alu_result;
'd1: branch_result = !alu_result;
2023-02-26 23:26:11 +00:00
default: branch_result = 1'dx;
2023-01-29 04:55:22 +00:00
endcase
end
assign pc_src = (branch & branch_result) | jump;
2022-12-24 01:13:40 +00:00
endmodule