-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFetch.v
41 lines (34 loc) · 760 Bytes
/
Fetch.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
module Fetch(
input clk, Reset,
input Branch,
input [9:0] TargetAddress,
input [31:0] plus32,
output [31:0] Instruction,
output [9:0] Add
);
wire [9:0] Address, Previous;
wire [31:0] I;
reg branch;
reg [9:0] JumpTo;
reg [31:0] Plus32;
always @ (posedge clk) begin
{branch, JumpTo} <= {Branch, TargetAddress};
Plus32 <= plus32;
end
Prog_Count PC(
.clk(clk),
.Reset(Reset),
.Jump(Jump),
.JumpTo(JumpTo),
.Address(Address)
);
Prog_Mem IMEM(
.clk(clk),
.Reset(Reset),
.Address(Address),
.plus32(Plus32),
.Instruction(I)
);
assign Add = Address;
assign Instruction = I;
endmodule