-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fetch.v
53 lines (42 loc) · 808 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
42
43
44
45
46
47
48
49
50
51
52
53
`timescale 1ns / 1ps
module Fetch
(
input [31:0] BranchTarget,
input PCSource,
input clk,
output wire [31:0] NextPC,
output wire [31:0] Instruction,
output wire Hit
);
wire [127:0] DataLine;
wire [31:0] Muxoutput;
wire [31:0] Address;
assign NextPC = Address +4;
PCRegister pcRegister (
.pcRegInput(Muxoutput),
.clk(clk),
.Hit(Hit),
.Address(Address)
);
Multiplexer mux (
.PC(NextPC),
.BranchTarget(BranchTarget),
.PCSource(PCSource),
.Address(Muxoutput)
);
Cache cache (
.Address(Address),
.DataLine(DataLine),
.clk(clk),
.Instruction(Instruction),
.Hit(Hit)
);
InstructionMemory instructionMemory (
.Address(Address),
.clk(clk),
.DataLine(DataLine)
);
//always@(Address) begin
// NextPC= Address +4;
//end
endmodule