-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPC_mux_module.v
37 lines (34 loc) · 922 Bytes
/
PC_mux_module.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10/31/2021 08:48:25 PM
// Design Name:
// Module Name: PC_mux
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module PC_mux_module(input rst, input [31:0]PC_plus_4, [31:0]PC_plus_imm, [31:0]ALUOutput, input AND_gate_output, [1:0]PC_mux_signal, output reg [31:0]next_PC);
always@(*) begin
if(rst) next_PC = 0;
else begin
case(PC_mux_signal)
2'b00: next_PC = PC_plus_4;
2'b01: next_PC = PC_plus_imm;
2'b10: next_PC = ALUOutput;
2'b11: next_PC = AND_gate_output? PC_plus_imm :PC_plus_4;
default:next_PC=0;
endcase
end
end
endmodule