RVSCC/rtl/JumpControl.sv

23 lines
441 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 JumpControl (
input logic jump,
branch,
branch_alu_neg,
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;
default: branch_result = 'dx;
endcase
end
assign pc_src = (branch & branch_result) | jump;
2022-12-24 01:13:40 +00:00
endmodule