-
Notifications
You must be signed in to change notification settings - Fork 0
/
pip_dec_ex.v
109 lines (96 loc) · 2.41 KB
/
pip_dec_ex.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
103
104
105
106
107
108
109
module pip_dec_ex (
input clk,
input pip_en,
input discard,
//register addresses
input [4:0] rs1_ad,
input [4:0] rs2_ad,
input [4:0] rd_ad,
//reg/imm value
input [31:0] rs1,
input [31:0] rs2,
input [31:0] imm,
//alu signals
input [3:0] aluCont,
input rdmuxSel,
input alumux1sel,
input alumux2sel,
//mem wb signals
input DMwriteEn,
input DMread,
input [2:0] DM_ctrl,
input rdEn,
input rs1_read,
input rs2_read,
input branch_comm,
input branch_taken,
//register addresses
output reg [4:0] rs1_ad_p,
output reg [4:0] rs2_ad_p,
output reg [4:0] rd_ad_p,
//reg/imm value
output reg [31:0] rs1_p,
output reg [31:0] rs2_p,
output reg [31:0] imm_p,
//alu signals
output reg [3:0] aluCont_p,
output reg rdmuxSel_p,
output reg alumux1sel_p,
output reg alumux2sel_p,
//mem wb signals
output reg DMwriteEn_p,
output reg DMread_p,
output reg [2:0] DM_ctrl_p,
output reg rdEn_p,
output reg rs1_read_p,
output reg rs2_read_p,
output reg branch_comm_p,
output reg branch_taken_p,
);
always @(posedge clk) begin
if (pip_en && !discard) begin
// Register addresses
rs1_ad_p <= rs1_ad;
rs2_ad_p <= rs2_ad;
rd_ad_p <= rd_ad;
// Register values and immediate
rs1_p <= rs1;
rs2_p <= rs2;
imm_p <= imm;
// ALU signals
aluCont_p <= aluCont;
rdmuxSel_p <= rdmuxSel;
alumux1sel_p <= alumux1sel;
alumux2sel_p <= alumux2sel;
// Memory and write-back signals
DMwriteEn_p <= DMwriteEn;
DMread_p <= DMread;
DM_ctrl_p <= DM_ctrl;
rdEn_p <= rdEn;
rs1_read_p <= rs1_read;
rs2_read_p <= rs2_read;
branch_taken_p <= branch_taken;
branch_comm_p <= branch_comm;
end
else if (pip_en && discard) begin
rs1_ad_p <= 0;
rs2_ad_p <= 0;
rd_ad_p <= 0;
rs1_p <= 0;
rs2_p <= 0;
imm_p <= 0;
aluCont_p <= 0;
rdmuxSel_p <= 0;
alumux1sel_p <= 0;
alumux2sel_p <= 0;
DMwriteEn_p <= 0;
DMread_p <= 0;
DM_ctrl_p <= 0;
rdEn_p <= 0;
rs1_read_p <= 0;
rs2_read_p <= 0;
branch_taken_p <= 0;
branch_comm_p <= 0;
end
end
endmodule