-
Notifications
You must be signed in to change notification settings - Fork 2
/
IF_Stage.v
47 lines (39 loc) · 915 Bytes
/
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
`include "settings.h"
module IF_Stage
(
input clk,
input rst,
input freeze,
input branch_taken,
input [`WORD_WIDTH-1:0] branch_addr,
output [`WORD_WIDTH-1:0] pc,
output [`WORD_WIDTH-1:0] instruction
);
wire [`WORD_WIDTH-1:0] pc_out;
wire [`WORD_WIDTH-1:0] mux_out;
wire [`WORD_WIDTH-1:0] adder_out;
Instruction_Mem Instruction_Mem_Inst (
.addr(pc_out),
.instruction(instruction)
);
MUX_2_to_1 MUX_2_to_1_Inst (
.sel(branch_taken),
.in1(adder_out),
.in2(branch_addr),
.out(mux_out)
);
PC PC_Inst (
.clk(clk),
.rst(rst),
.freeze(freeze),
.pc_in(mux_out),
.pc(pc_out)
);
Adder Adder_Inst (
// .a(32'b0100),
.a(32'b01),
.b(pc_out),
.out(adder_out)
);
assign pc = mux_out;
endmodule