-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pipeline.v
102 lines (84 loc) · 1.54 KB
/
Pipeline.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
module DP_IF(
input clk, reset,
input [31:0] PC,
output reg [31:0] PCF
);
initial begin
PCF <= 32'h0;
end
always @(posedge clk or posedge reset) begin
if(reset == 1'b1)
PCF <= 32'h0;
else
PCF <= PC;
end
endmodule
module DP_ID(
input clk, reset,
input [31:0] InstrF,
output reg [1:0] Op,
output reg [5:0] Funct,
output reg [3:0] Rd,
output reg [3:0] Cond,
output reg [3:0] Rn,
output reg [3:0] Rm,
output reg [23:0] Inst23
);
always @(posedge clk) begin
Op <= InstrF[27:26];
Funct <= InstrF[25:20];
Rd <= InstrF[15:12];
Cond <= InstrF[31:28];
Rn <= InstrF[19:16];
Rm <= InstrF[3:0];
Inst23 <= InstrF[23:0];
end
endmodule
module DP_EX(
input clk, reset,
input [31:0] RD1,
input [31:0] RD2,
input [3:0] WA3D,
input [31:0] ExtImm,
output reg [31:0] SrcAE,
output reg [31:0] WriteDataE,
output reg [3:0] WA3E,
output reg [31:0] ExtImmE
);
always @(posedge clk) begin
SrcAE <= RD1;
WriteDataE <= RD2;
WA3E <= WA3D;
ExtImmE <= ExtImm;
end
endmodule
module DP_MEM(
input clk, reset,
input [31:0] ALUResultE,
input [31:0] WriteDataE,
input [3:0] WA3E,
output reg [31:0] A,
output reg [31:0] WD,
output reg [3:0] WA3M
);
always @(posedge clk) begin
A <= ALUResultE;
WD <= WriteDataE;
WA3M <= WA3E;
end
endmodule
module DP_WB(
input clk, reset,
input [31:0] RD,
input [31:0] ALUOutM,
input [3:0] WA3M,
output reg [31:0] ReadDataW,
output reg [31:0] ALUOutW,
output reg [3:0] WA3W
);
always @(posedge clk) begin
ReadDataW <= RD;
ALUOutW <= ALUOutM;
WA3W <= WA3M;
end
endmodule