-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIF_Stage.v
51 lines (43 loc) · 1.03 KB
/
IF_Stage.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module IF_Stage #(
parameter DATA_LEN = 32,
parameter ADDRESS_LEN = 32
) (
input wire clk, rst, freeze,
input wire Branch_taken,
input wire [31 : 0] BranchAddr,
output wire [31 : 0] PC, Instruction
);
wire [DATA_LEN - 1 : 0] PC_Reg_in;
wire [DATA_LEN - 1 : 0] PC_Reg_out;
MUX2to1 #(
.DATA_LEN(DATA_LEN)
) MUX2to1(
.data_in1(BranchAddr),
.data_in0(PC),
.sel(Branch_taken),
.data_out(PC_Reg_in)
);
PC #(
.DATA_LEN(DATA_LEN)
) myPC(
.clk(clk),
.rst(rst),
.data_in(PC_Reg_in),
.freeze(freeze),
.data_out(PC_Reg_out)
);
Adder #(
.DATA_LEN(DATA_LEN)
) Adder(
.data_in1(PC_Reg_out),
.data_in2(32'd4),
.data_out(PC)
);
Ins_Mem #(
.DATA_LEN(DATA_LEN),
.ADDRESS_LEN(ADDRESS_LEN)
) Ins_Mem(
.address(PC_Reg_out),
.data_out(Instruction)
);
endmodule