1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: bw_r_irf.v |
---|
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
---|
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
---|
6 | // |
---|
7 | // The above named program is free software; you can redistribute it and/or |
---|
8 | // modify it under the terms of the GNU General Public |
---|
9 | // License version 2 as published by the Free Software Foundation. |
---|
10 | // |
---|
11 | // The above named program is distributed in the hope that it will be |
---|
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | // General Public License for more details. |
---|
15 | // |
---|
16 | // You should have received a copy of the GNU General Public |
---|
17 | // License along with this work; if not, write to the Free Software |
---|
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
19 | // |
---|
20 | // ========== Copyright Header End ============================================ |
---|
21 | //////////////////////////////////////////////////////////////////////// |
---|
22 | /* |
---|
23 | // Module Name: bw_r_irf |
---|
24 | // Description: Register file with 3 read ports and 2 write ports. Has |
---|
25 | // 32 registers per thread with 4 threads. Reading and writing |
---|
26 | // the same register concurrently produces x. |
---|
27 | */ |
---|
28 | |
---|
29 | //FPGA_SYN enables all FPGA related modifications |
---|
30 | `ifdef FPGA_SYN |
---|
31 | `define FPGA_SYN_IRF |
---|
32 | `endif |
---|
33 | |
---|
34 | |
---|
35 | `ifdef FPGA_SYN_IRF |
---|
36 | `ifdef FPGA_SYN_1THREAD |
---|
37 | module bw_r_irf (/*AUTOARG*/ |
---|
38 | // Outputs |
---|
39 | so, irf_byp_rs1_data_d_l, irf_byp_rs2_data_d_l, |
---|
40 | irf_byp_rs3_data_d_l, irf_byp_rs3h_data_d_l, |
---|
41 | // Inputs |
---|
42 | rclk, reset_l, si, se, sehold, rst_tri_en, ifu_exu_tid_s2, |
---|
43 | ifu_exu_rs1_s, ifu_exu_rs2_s, ifu_exu_rs3_s, ifu_exu_ren1_s, |
---|
44 | ifu_exu_ren2_s, ifu_exu_ren3_s, ecl_irf_wen_w, ecl_irf_wen_w2, |
---|
45 | ecl_irf_rd_m, ecl_irf_rd_g, byp_irf_rd_data_w, byp_irf_rd_data_w2, |
---|
46 | ecl_irf_tid_m, ecl_irf_tid_g, rml_irf_old_lo_cwp_e, |
---|
47 | rml_irf_new_lo_cwp_e, rml_irf_old_e_cwp_e, rml_irf_new_e_cwp_e, |
---|
48 | rml_irf_swap_even_e, rml_irf_swap_odd_e, rml_irf_swap_local_e, |
---|
49 | rml_irf_kill_restore_w, rml_irf_cwpswap_tid_e, rml_irf_old_agp, |
---|
50 | rml_irf_new_agp, rml_irf_swap_global, rml_irf_global_tid |
---|
51 | ) ; |
---|
52 | input rclk; |
---|
53 | input reset_l; |
---|
54 | input si; |
---|
55 | input se; |
---|
56 | input sehold; |
---|
57 | input rst_tri_en; |
---|
58 | input [1:0] ifu_exu_tid_s2; // s stage thread |
---|
59 | input [4:0] ifu_exu_rs1_s; // source addresses |
---|
60 | input [4:0] ifu_exu_rs2_s; |
---|
61 | input [4:0] ifu_exu_rs3_s; |
---|
62 | input ifu_exu_ren1_s; // read enables for all 3 ports |
---|
63 | input ifu_exu_ren2_s; |
---|
64 | input ifu_exu_ren3_s; |
---|
65 | input ecl_irf_wen_w; // write enables for both write ports |
---|
66 | input ecl_irf_wen_w2; |
---|
67 | input [4:0] ecl_irf_rd_m; // w destination |
---|
68 | input [4:0] ecl_irf_rd_g; // w2 destination |
---|
69 | input [71:0] byp_irf_rd_data_w;// write data from w1 |
---|
70 | input [71:0] byp_irf_rd_data_w2; // write data from w2 |
---|
71 | input [1:0] ecl_irf_tid_m; // w stage thread |
---|
72 | input [1:0] ecl_irf_tid_g; // w2 thread |
---|
73 | |
---|
74 | input [2:0] rml_irf_old_lo_cwp_e; // current window pointer for locals and odds |
---|
75 | input [2:0] rml_irf_new_lo_cwp_e; // target window pointer for locals and odds |
---|
76 | input [2:1] rml_irf_old_e_cwp_e; // current window pointer for evens |
---|
77 | input [2:1] rml_irf_new_e_cwp_e; // target window pointer for evens |
---|
78 | input rml_irf_swap_even_e; |
---|
79 | input rml_irf_swap_odd_e; |
---|
80 | input rml_irf_swap_local_e; |
---|
81 | input rml_irf_kill_restore_w; |
---|
82 | input [1:0] rml_irf_cwpswap_tid_e; |
---|
83 | |
---|
84 | input [1:0] rml_irf_old_agp; // alternate global pointer |
---|
85 | input [1:0] rml_irf_new_agp; // alternate global pointer |
---|
86 | input rml_irf_swap_global; |
---|
87 | input [1:0] rml_irf_global_tid; |
---|
88 | |
---|
89 | output so; |
---|
90 | output [71:0] irf_byp_rs1_data_d_l; |
---|
91 | output [71:0] irf_byp_rs2_data_d_l; |
---|
92 | output [71:0] irf_byp_rs3_data_d_l; |
---|
93 | output [31:0] irf_byp_rs3h_data_d_l; |
---|
94 | |
---|
95 | wire [71:0] irf_byp_rs1_data_d; |
---|
96 | wire [71:0] irf_byp_rs2_data_d; |
---|
97 | wire [71:0] irf_byp_rs3_data_d; |
---|
98 | wire [71:0] irf_byp_rs3h_data_d; |
---|
99 | |
---|
100 | wire [1:0] ecl_irf_tid_w; // w stage thread |
---|
101 | wire [1:0] ecl_irf_tid_w2; // w2 thread |
---|
102 | wire [4:0] ecl_irf_rd_w; // w destination |
---|
103 | wire [4:0] ecl_irf_rd_w2; // w2 destination |
---|
104 | wire [1:0] ifu_exu_thr_d; // d stage thread |
---|
105 | wire ifu_exu_ren1_d; // read enables for all 3 ports |
---|
106 | wire ifu_exu_ren2_d; |
---|
107 | wire ifu_exu_ren3_d; |
---|
108 | wire [4:0] ifu_exu_rs1_d; // source addresses |
---|
109 | wire [4:0] ifu_exu_rs2_d; |
---|
110 | wire [4:0] ifu_exu_rs3_d; |
---|
111 | wire [6:0] thr_rs1; // these 5 are a combination of the thr and reg |
---|
112 | wire [6:0] thr_rs2; // so that comparison can be done more easily |
---|
113 | wire [6:0] thr_rs3; |
---|
114 | wire [6:0] thr_rs3h; |
---|
115 | wire [6:0] thr_rd_w; |
---|
116 | wire [6:0] thr_rd_w2; |
---|
117 | |
---|
118 | reg [1:0] cwpswap_tid_m; |
---|
119 | reg [1:0] cwpswap_tid_w; |
---|
120 | reg [2:0] old_lo_cwp_m; |
---|
121 | reg [2:0] new_lo_cwp_m; |
---|
122 | reg [2:0] new_lo_cwp_w; |
---|
123 | reg [1:0] old_e_cwp_m; |
---|
124 | reg [1:0] new_e_cwp_m; |
---|
125 | reg [1:0] new_e_cwp_w; |
---|
126 | reg swap_local_m; |
---|
127 | reg swap_local_w; |
---|
128 | reg swap_even_m; |
---|
129 | reg swap_even_w; |
---|
130 | reg swap_odd_m; |
---|
131 | reg swap_odd_w; |
---|
132 | reg kill_restore_d1; |
---|
133 | reg swap_global_d1; |
---|
134 | reg swap_global_d2; |
---|
135 | reg [1:0] global_tid_d1; |
---|
136 | reg [1:0] global_tid_d2; |
---|
137 | reg [1:0] old_agp_d1, |
---|
138 | new_agp_d1, |
---|
139 | new_agp_d2; |
---|
140 | |
---|
141 | `ifdef FPGA_SYN_SAVE_BRAM |
---|
142 | wire [71:0] active_win_thr_rd_w_neg; |
---|
143 | wire [71:0] active_win_thr_rd_w2_neg; |
---|
144 | wire [6:0] thr_rd_w_neg; |
---|
145 | wire [6:0] thr_rd_w2_neg; |
---|
146 | wire active_win_thr_rd_w_neg_wr_en; |
---|
147 | wire active_win_thr_rd_w2_neg_wr_en; |
---|
148 | wire rst_tri_en_neg; |
---|
149 | `else |
---|
150 | reg [71:0] active_win_thr_rd_w_neg; |
---|
151 | reg [71:0] active_win_thr_rd_w2_neg; |
---|
152 | reg [6:0] thr_rd_w_neg; |
---|
153 | reg [6:0] thr_rd_w2_neg; |
---|
154 | reg active_win_thr_rd_w_neg_wr_en; |
---|
155 | reg active_win_thr_rd_w2_neg_wr_en; |
---|
156 | reg rst_tri_en_neg; |
---|
157 | `endif |
---|
158 | |
---|
159 | wire se; |
---|
160 | wire clk; |
---|
161 | // assign clk = rclk & reset_l; |
---|
162 | assign clk = rclk; |
---|
163 | |
---|
164 | wire ren1_s; |
---|
165 | wire ren2_s; |
---|
166 | wire ren3_s; |
---|
167 | wire [4:0] rs1_s; |
---|
168 | wire [4:0] rs2_s; |
---|
169 | wire [4:0] rs3_s; |
---|
170 | wire [1:0] tid_s; |
---|
171 | wire [1:0] tid_g; |
---|
172 | wire [1:0] tid_m; |
---|
173 | wire [4:0] rd_m; |
---|
174 | wire [4:0] rd_g; |
---|
175 | wire kill_restore_w; |
---|
176 | wire swap_global_d1_vld; |
---|
177 | wire swap_local_m_vld; |
---|
178 | wire swap_even_m_vld; |
---|
179 | wire swap_odd_m_vld; |
---|
180 | |
---|
181 | assign {ren1_s,ren2_s,ren3_s,rs1_s[4:0],rs2_s[4:0],rs3_s[4:0],tid_s[1:0],tid_g[1:0],tid_m[1:0], |
---|
182 | rd_m[4:0], rd_g[4:0]} = (sehold)? |
---|
183 | {ifu_exu_ren1_d,ifu_exu_ren2_d,ifu_exu_ren3_d,ifu_exu_rs1_d[4:0],ifu_exu_rs2_d[4:0], |
---|
184 | ifu_exu_rs3_d[4:0],ifu_exu_thr_d[1:0],ecl_irf_tid_w2[1:0],ecl_irf_tid_w[1:0], |
---|
185 | ecl_irf_rd_w[4:0],ecl_irf_rd_w2[4:0]}: |
---|
186 | {ifu_exu_ren1_s,ifu_exu_ren2_s,ifu_exu_ren3_s,ifu_exu_rs1_s[4:0],ifu_exu_rs2_s[4:0], |
---|
187 | ifu_exu_rs3_s[4:0],ifu_exu_tid_s2[1:0],ecl_irf_tid_g[1:0],ecl_irf_tid_m[1:0], |
---|
188 | ecl_irf_rd_m[4:0],ecl_irf_rd_g[4:0]}; |
---|
189 | // Pipeline flops for irf control signals |
---|
190 | dff_s dff_ren1_s2d(.din(ren1_s), .clk(clk), .q(ifu_exu_ren1_d), .se(se), |
---|
191 | .si(), .so()); |
---|
192 | dff_s dff_ren2_s2d(.din(ren2_s), .clk(clk), .q(ifu_exu_ren2_d), .se(se), |
---|
193 | .si(), .so()); |
---|
194 | dff_s dff_ren3_s2d(.din(ren3_s), .clk(clk), .q(ifu_exu_ren3_d), .se(se), |
---|
195 | .si(), .so()); |
---|
196 | dff_s #5 dff_rs1_s2d(.din(rs1_s[4:0]), .clk(clk), .q(ifu_exu_rs1_d[4:0]), .se(se), |
---|
197 | .si(),.so()); |
---|
198 | dff_s #5 dff_rs2_s2d(.din(rs2_s[4:0]), .clk(clk), .q(ifu_exu_rs2_d[4:0]), .se(se), |
---|
199 | .si(),.so()); |
---|
200 | dff_s #5 dff_rs3_s2d(.din(rs3_s[4:0]), .clk(clk), .q(ifu_exu_rs3_d[4:0]), .se(se), |
---|
201 | .si(),.so()); |
---|
202 | dff_s #2 dff_thr_s2d(.din(tid_s[1:0]), .clk(clk), .q(ifu_exu_thr_d[1:0]), .se(se), |
---|
203 | .si(),.so()); |
---|
204 | dff_s #2 dff_thr_g2w2(.din(tid_g[1:0]), .clk(clk), .q(ecl_irf_tid_w2[1:0]), .se(se), |
---|
205 | .si(),.so()); |
---|
206 | dff_s #2 dff_thr_m2w(.din(tid_m[1:0]), .clk(clk), .q(ecl_irf_tid_w[1:0]), .se(se), |
---|
207 | .si(),.so()); |
---|
208 | dff_s #5 dff_rd_m2w(.din(rd_m[4:0]), .clk(clk), .q(ecl_irf_rd_w[4:0]), .se(se), |
---|
209 | .si(),.so()); |
---|
210 | dff_s #5 dff_rd_g2w2(.din(rd_g[4:0]), .clk(clk), .q(ecl_irf_rd_w2[4:0]), .se(se), |
---|
211 | .si(),.so()); |
---|
212 | |
---|
213 | // Concatenate the thread and rs1/rd bits together |
---|
214 | assign thr_rs1[6:0] = {ifu_exu_thr_d, ifu_exu_rs1_d}; |
---|
215 | assign thr_rs2[6:0] = {ifu_exu_thr_d, ifu_exu_rs2_d}; |
---|
216 | assign thr_rs3[6:0] = {ifu_exu_thr_d, ifu_exu_rs3_d[4:0]}; |
---|
217 | assign thr_rs3h[6:0] = {ifu_exu_thr_d[1:0], ifu_exu_rs3_d[4:1], 1'b1}; |
---|
218 | assign thr_rd_w[6:0] = {ecl_irf_tid_w, ecl_irf_rd_w}; |
---|
219 | assign thr_rd_w2[6:0] = {ecl_irf_tid_w2, ecl_irf_rd_w2}; |
---|
220 | |
---|
221 | // Active low outputs |
---|
222 | assign irf_byp_rs1_data_d_l[71:0] = ~irf_byp_rs1_data_d[71:0]; |
---|
223 | assign irf_byp_rs2_data_d_l[71:0] = ~irf_byp_rs2_data_d[71:0]; |
---|
224 | assign irf_byp_rs3_data_d_l[71:0] = ~irf_byp_rs3_data_d[71:0]; |
---|
225 | assign irf_byp_rs3h_data_d_l[31:0] = ~irf_byp_rs3h_data_d[31:0]; |
---|
226 | |
---|
227 | ///////////////////////////////////////////////////////////////// |
---|
228 | /// Write ports |
---|
229 | //////////////////////////////////////////////////////////////// |
---|
230 | // This is a latch that works if both wen is high and clk is low |
---|
231 | |
---|
232 | `ifdef FPGA_SYN_SAVE_BRAM |
---|
233 | assign rst_tri_en_neg = rst_tri_en; |
---|
234 | assign active_win_thr_rd_w_neg = byp_irf_rd_data_w; |
---|
235 | assign active_win_thr_rd_w2_neg = byp_irf_rd_data_w2; |
---|
236 | assign thr_rd_w_neg = thr_rd_w; |
---|
237 | assign thr_rd_w2_neg = thr_rd_w2; |
---|
238 | assign active_win_thr_rd_w_neg_wr_en = ecl_irf_wen_w & (thr_rd_w[4:0] != 5'b0); |
---|
239 | assign active_win_thr_rd_w2_neg_wr_en = ecl_irf_wen_w2 & (thr_rd_w2[4:0] != 5'b0); |
---|
240 | `else |
---|
241 | |
---|
242 | always @(negedge clk) begin |
---|
243 | rst_tri_en_neg <= rst_tri_en; |
---|
244 | // write conflict results in X written to destination |
---|
245 | if (ecl_irf_wen_w & ecl_irf_wen_w2 & (thr_rd_w[6:0] == thr_rd_w2[6:0])) begin |
---|
246 | active_win_thr_rd_w_neg <= {72{1'bx}}; |
---|
247 | thr_rd_w_neg <= thr_rd_w; |
---|
248 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
249 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
250 | end |
---|
251 | else begin |
---|
252 | // W1 write port |
---|
253 | if (ecl_irf_wen_w & (thr_rd_w[4:0] != 5'b0)) begin |
---|
254 | active_win_thr_rd_w_neg <= byp_irf_rd_data_w; |
---|
255 | thr_rd_w_neg <= thr_rd_w; |
---|
256 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
257 | end |
---|
258 | else |
---|
259 | active_win_thr_rd_w_neg_wr_en <= 1'b0; |
---|
260 | |
---|
261 | // W2 write port |
---|
262 | if (ecl_irf_wen_w2 & (thr_rd_w2[4:0] != 5'b0)) begin |
---|
263 | active_win_thr_rd_w2_neg <= byp_irf_rd_data_w2; |
---|
264 | thr_rd_w2_neg <= thr_rd_w2; |
---|
265 | active_win_thr_rd_w2_neg_wr_en <= 1'b1; |
---|
266 | end |
---|
267 | else |
---|
268 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
269 | end |
---|
270 | end |
---|
271 | |
---|
272 | `endif |
---|
273 | |
---|
274 | |
---|
275 | |
---|
276 | /* MOVED TO CMP ENVIRONMENT |
---|
277 | initial begin |
---|
278 | // Hardcode R0 to zero |
---|
279 | active_window[{2'b00, 5'b00000}] = 72'b0; |
---|
280 | active_window[{2'b01, 5'b00000}] = 72'b0; |
---|
281 | active_window[{2'b10, 5'b00000}] = 72'b0; |
---|
282 | active_window[{2'b11, 5'b00000}] = 72'b0; |
---|
283 | end |
---|
284 | */ |
---|
285 | ////////////////////////////////////////////////// |
---|
286 | // Window management logic |
---|
287 | ////////////////////////////////////////////////// |
---|
288 | // Pipeline flops for control signals |
---|
289 | |
---|
290 | // cwp swap signals |
---|
291 | assign kill_restore_w = (sehold)? kill_restore_d1: rml_irf_kill_restore_w; |
---|
292 | assign swap_local_m_vld = swap_local_m & ~rst_tri_en; |
---|
293 | assign swap_odd_m_vld = swap_odd_m & ~rst_tri_en; |
---|
294 | assign swap_even_m_vld = swap_even_m & ~rst_tri_en; |
---|
295 | assign swap_global_d1_vld = swap_global_d1 & ~rst_tri_en; |
---|
296 | |
---|
297 | always @ (posedge clk) begin |
---|
298 | cwpswap_tid_m[1:0] <= (sehold)? cwpswap_tid_m[1:0]: rml_irf_cwpswap_tid_e[1:0]; |
---|
299 | cwpswap_tid_w[1:0] <= cwpswap_tid_m[1:0]; |
---|
300 | old_lo_cwp_m[2:0] <= (sehold)? old_lo_cwp_m[2:0]: rml_irf_old_lo_cwp_e[2:0]; |
---|
301 | new_lo_cwp_m[2:0] <= (sehold)? new_lo_cwp_m[2:0]: rml_irf_new_lo_cwp_e[2:0]; |
---|
302 | new_lo_cwp_w[2:0] <= new_lo_cwp_m[2:0]; |
---|
303 | old_e_cwp_m[1:0] <= (sehold)? old_e_cwp_m[1:0]: rml_irf_old_e_cwp_e[2:1]; |
---|
304 | new_e_cwp_m[1:0] <= (sehold)? new_e_cwp_m[1:0]: rml_irf_new_e_cwp_e[2:1]; |
---|
305 | new_e_cwp_w[1:0] <= new_e_cwp_m[1:0]; |
---|
306 | swap_local_m <= (sehold)? swap_local_m & rst_tri_en: rml_irf_swap_local_e; |
---|
307 | swap_local_w <= swap_local_m_vld; |
---|
308 | swap_odd_m <= (sehold)? swap_odd_m & rst_tri_en: rml_irf_swap_odd_e; |
---|
309 | swap_odd_w <= swap_odd_m_vld; |
---|
310 | swap_even_m <= (sehold)? swap_even_m & rst_tri_en: rml_irf_swap_even_e; |
---|
311 | swap_even_w <= swap_even_m_vld; |
---|
312 | kill_restore_d1 <= kill_restore_w; |
---|
313 | end |
---|
314 | // global swap signals |
---|
315 | always @ (posedge clk) begin |
---|
316 | swap_global_d1 <= (sehold)? swap_global_d1 & rst_tri_en: rml_irf_swap_global; |
---|
317 | swap_global_d2 <= swap_global_d1_vld; |
---|
318 | global_tid_d1[1:0] <= (sehold)? global_tid_d1[1:0]: rml_irf_global_tid[1:0]; |
---|
319 | global_tid_d2[1:0] <= global_tid_d1[1:0]; |
---|
320 | old_agp_d1[1:0] <= (sehold)? old_agp_d1[1:0]: rml_irf_old_agp[1:0]; |
---|
321 | new_agp_d1[1:0] <= (sehold)? new_agp_d1[1:0]: rml_irf_new_agp[1:0]; |
---|
322 | new_agp_d2[1:0] <= new_agp_d1[1:0]; |
---|
323 | end |
---|
324 | |
---|
325 | wire wr_en = active_win_thr_rd_w_neg_wr_en & (~rst_tri_en | ~rst_tri_en_neg); |
---|
326 | wire wr_en2 = active_win_thr_rd_w2_neg_wr_en & (~rst_tri_en | ~rst_tri_en_neg); |
---|
327 | |
---|
328 | // synthesis translate_off |
---|
329 | always @(posedge clk) begin |
---|
330 | if(wr_en) |
---|
331 | $display("Write Port 1: %h %h", active_win_thr_rd_w_neg, thr_rd_w_neg ); |
---|
332 | if(wr_en2) |
---|
333 | $display("Write Port 2: %h %h", active_win_thr_rd_w2_neg, thr_rd_w2_neg ); |
---|
334 | if(ifu_exu_ren1_d) begin |
---|
335 | @(posedge clk); |
---|
336 | $display("Read Port 1: %h %h", irf_byp_rs1_data_d, thr_rs1); |
---|
337 | end |
---|
338 | if(ifu_exu_ren2_d) begin |
---|
339 | @(posedge clk); |
---|
340 | $display("Read Port 2: %h %h", irf_byp_rs2_data_d, thr_rs2); |
---|
341 | end |
---|
342 | if(ifu_exu_ren3_d) begin |
---|
343 | @(posedge clk); |
---|
344 | $display("Read Port 3: %h %h", irf_byp_rs3_data_d, thr_rs3); |
---|
345 | end |
---|
346 | end |
---|
347 | //synthesis translate_on |
---|
348 | |
---|
349 | bw_r_irf_core bw_r_irf_core ( |
---|
350 | .clk (clk), |
---|
351 | .ifu_exu_ren1_d (ifu_exu_ren1_d), |
---|
352 | .ifu_exu_ren2_d (ifu_exu_ren2_d), |
---|
353 | .ifu_exu_ren3_d (ifu_exu_ren3_d), |
---|
354 | .thr_rs1 (thr_rs1), |
---|
355 | .thr_rs2 (thr_rs2), |
---|
356 | .thr_rs3 (thr_rs3), |
---|
357 | .thr_rs3h (thr_rs3h), |
---|
358 | .irf_byp_rs1_data_d (irf_byp_rs1_data_d), |
---|
359 | .irf_byp_rs2_data_d (irf_byp_rs2_data_d), |
---|
360 | .irf_byp_rs3_data_d (irf_byp_rs3_data_d), |
---|
361 | .irf_byp_rs3h_data_d (irf_byp_rs3h_data_d), |
---|
362 | .wr_en (wr_en), |
---|
363 | .wr_en2 (wr_en2), |
---|
364 | .active_win_thr_rd_w_neg(active_win_thr_rd_w_neg), |
---|
365 | .active_win_thr_rd_w2_neg(active_win_thr_rd_w2_neg), |
---|
366 | .thr_rd_w_neg (thr_rd_w_neg), |
---|
367 | .thr_rd_w2_neg (thr_rd_w2_neg), |
---|
368 | .swap_global_d1_vld (swap_global_d1_vld), |
---|
369 | .swap_global_d2 (swap_global_d2), |
---|
370 | .global_tid_d1 (global_tid_d1), |
---|
371 | .global_tid_d2 (global_tid_d2), |
---|
372 | .old_agp_d1 (old_agp_d1), |
---|
373 | .new_agp_d2 (new_agp_d2), |
---|
374 | .swap_local_m_vld (swap_local_m_vld), |
---|
375 | .swap_local_w (swap_local_w), |
---|
376 | .old_lo_cwp_m (old_lo_cwp_m), |
---|
377 | .new_lo_cwp_w (new_lo_cwp_w), |
---|
378 | .swap_even_m_vld (swap_even_m_vld), |
---|
379 | .swap_even_w (swap_even_w), |
---|
380 | .old_e_cwp_m (old_e_cwp_m), |
---|
381 | .new_e_cwp_w (new_e_cwp_w), |
---|
382 | .swap_odd_m_vld (swap_odd_m_vld), |
---|
383 | .swap_odd_w (swap_odd_w), |
---|
384 | .cwpswap_tid_m (cwpswap_tid_m), |
---|
385 | .cwpswap_tid_w (cwpswap_tid_w), |
---|
386 | .kill_restore_w (kill_restore_w) |
---|
387 | ); |
---|
388 | |
---|
389 | endmodule // bw_r_irf |
---|
390 | |
---|
391 | module bw_r_irf_core( |
---|
392 | clk, |
---|
393 | ifu_exu_ren1_d, |
---|
394 | ifu_exu_ren2_d, |
---|
395 | ifu_exu_ren3_d, |
---|
396 | thr_rs1, |
---|
397 | thr_rs2, |
---|
398 | thr_rs3, |
---|
399 | thr_rs3h, |
---|
400 | irf_byp_rs1_data_d, |
---|
401 | irf_byp_rs2_data_d, |
---|
402 | irf_byp_rs3_data_d, |
---|
403 | irf_byp_rs3h_data_d, |
---|
404 | wr_en, |
---|
405 | wr_en2, |
---|
406 | active_win_thr_rd_w_neg, |
---|
407 | active_win_thr_rd_w2_neg, |
---|
408 | thr_rd_w_neg, |
---|
409 | thr_rd_w2_neg, |
---|
410 | swap_global_d1_vld, |
---|
411 | swap_global_d2, |
---|
412 | global_tid_d1, |
---|
413 | global_tid_d2, |
---|
414 | old_agp_d1, |
---|
415 | new_agp_d2, |
---|
416 | swap_local_m_vld, |
---|
417 | swap_local_w, |
---|
418 | old_lo_cwp_m, |
---|
419 | new_lo_cwp_w, |
---|
420 | swap_even_m_vld, |
---|
421 | swap_even_w, |
---|
422 | old_e_cwp_m, |
---|
423 | new_e_cwp_w, |
---|
424 | swap_odd_m_vld, |
---|
425 | swap_odd_w, |
---|
426 | cwpswap_tid_m, |
---|
427 | cwpswap_tid_w, |
---|
428 | kill_restore_w); |
---|
429 | |
---|
430 | |
---|
431 | input clk; |
---|
432 | input ifu_exu_ren1_d; |
---|
433 | input ifu_exu_ren2_d; |
---|
434 | input ifu_exu_ren3_d; |
---|
435 | |
---|
436 | input [6:0] thr_rs1; |
---|
437 | input [6:0] thr_rs2; |
---|
438 | input [6:0] thr_rs3; |
---|
439 | input [6:0] thr_rs3h; |
---|
440 | |
---|
441 | output [71:0] irf_byp_rs1_data_d; |
---|
442 | output [71:0] irf_byp_rs2_data_d; |
---|
443 | output [71:0] irf_byp_rs3_data_d; |
---|
444 | output [71:0] irf_byp_rs3h_data_d; |
---|
445 | |
---|
446 | |
---|
447 | reg [71:0] irf_byp_rs1_data_d; |
---|
448 | reg [71:0] irf_byp_rs2_data_d; |
---|
449 | reg [71:0] irf_byp_rs3_data_d; |
---|
450 | reg [71:0] irf_byp_rs3h_data_d; |
---|
451 | |
---|
452 | input wr_en; |
---|
453 | input wr_en2; |
---|
454 | input [71:0] active_win_thr_rd_w_neg; |
---|
455 | input [71:0] active_win_thr_rd_w2_neg; |
---|
456 | input [6:0] thr_rd_w_neg; |
---|
457 | input [6:0] thr_rd_w2_neg; |
---|
458 | |
---|
459 | input swap_global_d1_vld; |
---|
460 | input swap_global_d2; |
---|
461 | input [1:0] global_tid_d1; |
---|
462 | input [1:0] global_tid_d2; |
---|
463 | input [1:0] old_agp_d1; |
---|
464 | input [1:0] new_agp_d2; |
---|
465 | |
---|
466 | input swap_local_m_vld; |
---|
467 | input swap_local_w; |
---|
468 | input [2:0] old_lo_cwp_m; |
---|
469 | input [2:0] new_lo_cwp_w; |
---|
470 | |
---|
471 | input swap_even_m_vld; |
---|
472 | input swap_even_w; |
---|
473 | input [1:0] old_e_cwp_m; |
---|
474 | input [1:0] new_e_cwp_w; |
---|
475 | |
---|
476 | input swap_odd_m_vld; |
---|
477 | input swap_odd_w; |
---|
478 | |
---|
479 | input [1:0] cwpswap_tid_m; |
---|
480 | input [1:0] cwpswap_tid_w; |
---|
481 | |
---|
482 | input kill_restore_w; |
---|
483 | |
---|
484 | |
---|
485 | wire [71:0] rd_data00; |
---|
486 | wire [71:0] rd_data01; |
---|
487 | wire [71:0] rd_data02; |
---|
488 | wire [71:0] rd_data03; |
---|
489 | wire [71:0] rd_data04; |
---|
490 | wire [71:0] rd_data05; |
---|
491 | wire [71:0] rd_data06; |
---|
492 | wire [71:0] rd_data07; |
---|
493 | wire [71:0] rd_data08; |
---|
494 | wire [71:0] rd_data09; |
---|
495 | wire [71:0] rd_data10; |
---|
496 | wire [71:0] rd_data11; |
---|
497 | wire [71:0] rd_data12; |
---|
498 | wire [71:0] rd_data13; |
---|
499 | wire [71:0] rd_data14; |
---|
500 | wire [71:0] rd_data15; |
---|
501 | wire [71:0] rd_data16; |
---|
502 | wire [71:0] rd_data17; |
---|
503 | wire [71:0] rd_data18; |
---|
504 | wire [71:0] rd_data19; |
---|
505 | wire [71:0] rd_data20; |
---|
506 | wire [71:0] rd_data21; |
---|
507 | wire [71:0] rd_data22; |
---|
508 | wire [71:0] rd_data23; |
---|
509 | wire [71:0] rd_data24; |
---|
510 | wire [71:0] rd_data25; |
---|
511 | wire [71:0] rd_data26; |
---|
512 | wire [71:0] rd_data27; |
---|
513 | wire [71:0] rd_data28; |
---|
514 | wire [71:0] rd_data29; |
---|
515 | wire [71:0] rd_data30; |
---|
516 | wire [71:0] rd_data31; |
---|
517 | |
---|
518 | // synthesis translate_off |
---|
519 | always @(posedge clk) begin |
---|
520 | if(ifu_exu_ren1_d | ifu_exu_ren2_d | ifu_exu_ren3_d) begin |
---|
521 | if(thr_rs1[6:5] != 2'b00) begin |
---|
522 | $display("Accessing thread # other than 0"); |
---|
523 | $finish; |
---|
524 | end |
---|
525 | end |
---|
526 | end |
---|
527 | // synthesis translate_on |
---|
528 | |
---|
529 | //reg [71:0] active_window [127:0];// 32x4 72 bit registers |
---|
530 | |
---|
531 | always @(negedge clk) |
---|
532 | if(ifu_exu_ren1_d) //comes from a posedge clk |
---|
533 | case(thr_rs1[4:0]) |
---|
534 | 5'b00000: irf_byp_rs1_data_d <= rd_data00; |
---|
535 | 5'b00001: irf_byp_rs1_data_d <= rd_data01; |
---|
536 | 5'b00010: irf_byp_rs1_data_d <= rd_data02; |
---|
537 | 5'b00011: irf_byp_rs1_data_d <= rd_data03; |
---|
538 | 5'b00100: irf_byp_rs1_data_d <= rd_data04; |
---|
539 | 5'b00101: irf_byp_rs1_data_d <= rd_data05; |
---|
540 | 5'b00110: irf_byp_rs1_data_d <= rd_data06; |
---|
541 | 5'b00111: irf_byp_rs1_data_d <= rd_data07; |
---|
542 | 5'b01000: irf_byp_rs1_data_d <= rd_data08; |
---|
543 | 5'b01001: irf_byp_rs1_data_d <= rd_data09; |
---|
544 | 5'b01010: irf_byp_rs1_data_d <= rd_data10; |
---|
545 | 5'b01011: irf_byp_rs1_data_d <= rd_data11; |
---|
546 | 5'b01100: irf_byp_rs1_data_d <= rd_data12; |
---|
547 | 5'b01101: irf_byp_rs1_data_d <= rd_data13; |
---|
548 | 5'b01110: irf_byp_rs1_data_d <= rd_data14; |
---|
549 | 5'b01111: irf_byp_rs1_data_d <= rd_data15; |
---|
550 | 5'b10000: irf_byp_rs1_data_d <= rd_data16; |
---|
551 | 5'b10001: irf_byp_rs1_data_d <= rd_data17; |
---|
552 | 5'b10010: irf_byp_rs1_data_d <= rd_data18; |
---|
553 | 5'b10011: irf_byp_rs1_data_d <= rd_data19; |
---|
554 | 5'b10100: irf_byp_rs1_data_d <= rd_data20; |
---|
555 | 5'b10101: irf_byp_rs1_data_d <= rd_data21; |
---|
556 | 5'b10110: irf_byp_rs1_data_d <= rd_data22; |
---|
557 | 5'b10111: irf_byp_rs1_data_d <= rd_data23; |
---|
558 | 5'b11000: irf_byp_rs1_data_d <= rd_data24; |
---|
559 | 5'b11001: irf_byp_rs1_data_d <= rd_data25; |
---|
560 | 5'b11010: irf_byp_rs1_data_d <= rd_data26; |
---|
561 | 5'b11011: irf_byp_rs1_data_d <= rd_data27; |
---|
562 | 5'b11100: irf_byp_rs1_data_d <= rd_data28; |
---|
563 | 5'b11101: irf_byp_rs1_data_d <= rd_data29; |
---|
564 | 5'b11110: irf_byp_rs1_data_d <= rd_data30; |
---|
565 | 5'b11111: irf_byp_rs1_data_d <= rd_data31; |
---|
566 | endcase |
---|
567 | |
---|
568 | always @(negedge clk) |
---|
569 | if(ifu_exu_ren2_d) |
---|
570 | case(thr_rs2[4:0]) |
---|
571 | 5'b00000: irf_byp_rs2_data_d <= rd_data00; |
---|
572 | 5'b00001: irf_byp_rs2_data_d <= rd_data01; |
---|
573 | 5'b00010: irf_byp_rs2_data_d <= rd_data02; |
---|
574 | 5'b00011: irf_byp_rs2_data_d <= rd_data03; |
---|
575 | 5'b00100: irf_byp_rs2_data_d <= rd_data04; |
---|
576 | 5'b00101: irf_byp_rs2_data_d <= rd_data05; |
---|
577 | 5'b00110: irf_byp_rs2_data_d <= rd_data06; |
---|
578 | 5'b00111: irf_byp_rs2_data_d <= rd_data07; |
---|
579 | 5'b01000: irf_byp_rs2_data_d <= rd_data08; |
---|
580 | 5'b01001: irf_byp_rs2_data_d <= rd_data09; |
---|
581 | 5'b01010: irf_byp_rs2_data_d <= rd_data10; |
---|
582 | 5'b01011: irf_byp_rs2_data_d <= rd_data11; |
---|
583 | 5'b01100: irf_byp_rs2_data_d <= rd_data12; |
---|
584 | 5'b01101: irf_byp_rs2_data_d <= rd_data13; |
---|
585 | 5'b01110: irf_byp_rs2_data_d <= rd_data14; |
---|
586 | 5'b01111: irf_byp_rs2_data_d <= rd_data15; |
---|
587 | 5'b10000: irf_byp_rs2_data_d <= rd_data16; |
---|
588 | 5'b10001: irf_byp_rs2_data_d <= rd_data17; |
---|
589 | 5'b10010: irf_byp_rs2_data_d <= rd_data18; |
---|
590 | 5'b10011: irf_byp_rs2_data_d <= rd_data19; |
---|
591 | 5'b10100: irf_byp_rs2_data_d <= rd_data20; |
---|
592 | 5'b10101: irf_byp_rs2_data_d <= rd_data21; |
---|
593 | 5'b10110: irf_byp_rs2_data_d <= rd_data22; |
---|
594 | 5'b10111: irf_byp_rs2_data_d <= rd_data23; |
---|
595 | 5'b11000: irf_byp_rs2_data_d <= rd_data24; |
---|
596 | 5'b11001: irf_byp_rs2_data_d <= rd_data25; |
---|
597 | 5'b11010: irf_byp_rs2_data_d <= rd_data26; |
---|
598 | 5'b11011: irf_byp_rs2_data_d <= rd_data27; |
---|
599 | 5'b11100: irf_byp_rs2_data_d <= rd_data28; |
---|
600 | 5'b11101: irf_byp_rs2_data_d <= rd_data29; |
---|
601 | 5'b11110: irf_byp_rs2_data_d <= rd_data30; |
---|
602 | 5'b11111: irf_byp_rs2_data_d <= rd_data31; |
---|
603 | endcase |
---|
604 | |
---|
605 | always @(negedge clk) |
---|
606 | if(ifu_exu_ren3_d) |
---|
607 | case(thr_rs3[4:0]) |
---|
608 | 5'b00000: irf_byp_rs3_data_d <= rd_data00; |
---|
609 | 5'b00001: irf_byp_rs3_data_d <= rd_data01; |
---|
610 | 5'b00010: irf_byp_rs3_data_d <= rd_data02; |
---|
611 | 5'b00011: irf_byp_rs3_data_d <= rd_data03; |
---|
612 | 5'b00100: irf_byp_rs3_data_d <= rd_data04; |
---|
613 | 5'b00101: irf_byp_rs3_data_d <= rd_data05; |
---|
614 | 5'b00110: irf_byp_rs3_data_d <= rd_data06; |
---|
615 | 5'b00111: irf_byp_rs3_data_d <= rd_data07; |
---|
616 | 5'b01000: irf_byp_rs3_data_d <= rd_data08; |
---|
617 | 5'b01001: irf_byp_rs3_data_d <= rd_data09; |
---|
618 | 5'b01010: irf_byp_rs3_data_d <= rd_data10; |
---|
619 | 5'b01011: irf_byp_rs3_data_d <= rd_data11; |
---|
620 | 5'b01100: irf_byp_rs3_data_d <= rd_data12; |
---|
621 | 5'b01101: irf_byp_rs3_data_d <= rd_data13; |
---|
622 | 5'b01110: irf_byp_rs3_data_d <= rd_data14; |
---|
623 | 5'b01111: irf_byp_rs3_data_d <= rd_data15; |
---|
624 | 5'b10000: irf_byp_rs3_data_d <= rd_data16; |
---|
625 | 5'b10001: irf_byp_rs3_data_d <= rd_data17; |
---|
626 | 5'b10010: irf_byp_rs3_data_d <= rd_data18; |
---|
627 | 5'b10011: irf_byp_rs3_data_d <= rd_data19; |
---|
628 | 5'b10100: irf_byp_rs3_data_d <= rd_data20; |
---|
629 | 5'b10101: irf_byp_rs3_data_d <= rd_data21; |
---|
630 | 5'b10110: irf_byp_rs3_data_d <= rd_data22; |
---|
631 | 5'b10111: irf_byp_rs3_data_d <= rd_data23; |
---|
632 | 5'b11000: irf_byp_rs3_data_d <= rd_data24; |
---|
633 | 5'b11001: irf_byp_rs3_data_d <= rd_data25; |
---|
634 | 5'b11010: irf_byp_rs3_data_d <= rd_data26; |
---|
635 | 5'b11011: irf_byp_rs3_data_d <= rd_data27; |
---|
636 | 5'b11100: irf_byp_rs3_data_d <= rd_data28; |
---|
637 | 5'b11101: irf_byp_rs3_data_d <= rd_data29; |
---|
638 | 5'b11110: irf_byp_rs3_data_d <= rd_data30; |
---|
639 | 5'b11111: irf_byp_rs3_data_d <= rd_data31; |
---|
640 | endcase |
---|
641 | |
---|
642 | always @(negedge clk) |
---|
643 | if(ifu_exu_ren3_d) |
---|
644 | case(thr_rs3h[4:1]) |
---|
645 | 4'b0000: irf_byp_rs3h_data_d <= rd_data01; |
---|
646 | 4'b0001: irf_byp_rs3h_data_d <= rd_data03; |
---|
647 | 4'b0010: irf_byp_rs3h_data_d <= rd_data05; |
---|
648 | 4'b0011: irf_byp_rs3h_data_d <= rd_data07; |
---|
649 | 4'b0100: irf_byp_rs3h_data_d <= rd_data09; |
---|
650 | 4'b0101: irf_byp_rs3h_data_d <= rd_data11; |
---|
651 | 4'b0110: irf_byp_rs3h_data_d <= rd_data13; |
---|
652 | 4'b0111: irf_byp_rs3h_data_d <= rd_data15; |
---|
653 | 4'b1000: irf_byp_rs3h_data_d <= rd_data17; |
---|
654 | 4'b1001: irf_byp_rs3h_data_d <= rd_data19; |
---|
655 | 4'b1010: irf_byp_rs3h_data_d <= rd_data21; |
---|
656 | 4'b1011: irf_byp_rs3h_data_d <= rd_data23; |
---|
657 | 4'b1100: irf_byp_rs3h_data_d <= rd_data25; |
---|
658 | 4'b1101: irf_byp_rs3h_data_d <= rd_data27; |
---|
659 | 4'b1110: irf_byp_rs3h_data_d <= rd_data29; |
---|
660 | 4'b1111: irf_byp_rs3h_data_d <= rd_data31; |
---|
661 | endcase |
---|
662 | |
---|
663 | wire wren = wr_en | wr_en2; |
---|
664 | wire [4:0] wr_addr = wr_en ? thr_rd_w_neg[4:0] : thr_rd_w2_neg[4:0]; |
---|
665 | wire [71:0] wr_data = wr_en ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
666 | |
---|
667 | //GLOBALs |
---|
668 | bw_r_irf_register register00( |
---|
669 | .clk(clk), |
---|
670 | .wren(wren & (wr_addr == 5'b00000)), |
---|
671 | .save(swap_global_d1_vld), |
---|
672 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
673 | .restore(swap_global_d2), |
---|
674 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
675 | .wr_data(72'b0), |
---|
676 | .rd_data(rd_data00) |
---|
677 | ); |
---|
678 | |
---|
679 | bw_r_irf_register register01( |
---|
680 | .clk(clk), |
---|
681 | .wren(wren & (wr_addr == 5'b00001)), |
---|
682 | .save(swap_global_d1_vld), |
---|
683 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
684 | .restore(swap_global_d2), |
---|
685 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
686 | .wr_data(wr_data), |
---|
687 | .rd_data(rd_data01) |
---|
688 | ); |
---|
689 | |
---|
690 | bw_r_irf_register register02( |
---|
691 | .clk(clk), |
---|
692 | .wren(wren & (wr_addr == 5'b00010)), |
---|
693 | .save(swap_global_d1_vld), |
---|
694 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
695 | .restore(swap_global_d2), |
---|
696 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
697 | .wr_data(wr_data), |
---|
698 | .rd_data(rd_data02) |
---|
699 | ); |
---|
700 | |
---|
701 | bw_r_irf_register register03( |
---|
702 | .clk(clk), |
---|
703 | .wren(wren & (wr_addr == 5'b00011)), |
---|
704 | .save(swap_global_d1_vld), |
---|
705 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
706 | .restore(swap_global_d2), |
---|
707 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
708 | .wr_data(wr_data), |
---|
709 | .rd_data(rd_data03) |
---|
710 | ); |
---|
711 | |
---|
712 | bw_r_irf_register register04( |
---|
713 | .clk(clk), |
---|
714 | .wren(wren & (wr_addr == 5'b00100)), |
---|
715 | .save(swap_global_d1_vld), |
---|
716 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
717 | .restore(swap_global_d2), |
---|
718 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
719 | .wr_data(wr_data), |
---|
720 | .rd_data(rd_data04) |
---|
721 | ); |
---|
722 | |
---|
723 | bw_r_irf_register register05( |
---|
724 | .clk(clk), |
---|
725 | .wren(wren & (wr_addr == 5'b00101)), |
---|
726 | .save(swap_global_d1_vld), |
---|
727 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
728 | .restore(swap_global_d2), |
---|
729 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
730 | .wr_data(wr_data), |
---|
731 | .rd_data(rd_data05) |
---|
732 | ); |
---|
733 | |
---|
734 | bw_r_irf_register register06( |
---|
735 | .clk(clk), |
---|
736 | .wren(wren & (wr_addr == 5'b00110)), |
---|
737 | .save(swap_global_d1_vld), |
---|
738 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
739 | .restore(swap_global_d2), |
---|
740 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
741 | .wr_data(wr_data), |
---|
742 | .rd_data(rd_data06) |
---|
743 | ); |
---|
744 | |
---|
745 | bw_r_irf_register register07( |
---|
746 | .clk(clk), |
---|
747 | .wren(wren & (wr_addr == 5'b00111)), |
---|
748 | .save(swap_global_d1_vld), |
---|
749 | .save_addr({1'b0,old_agp_d1[1:0]}), |
---|
750 | .restore(swap_global_d2), |
---|
751 | .restore_addr({1'b0,new_agp_d2[1:0]}), |
---|
752 | .wr_data(wr_data), |
---|
753 | .rd_data(rd_data07) |
---|
754 | ); |
---|
755 | |
---|
756 | //ODDs |
---|
757 | bw_r_irf_register register08( |
---|
758 | .clk(clk), |
---|
759 | .wren(wren & (wr_addr == 5'b01000)), |
---|
760 | .save(swap_odd_m_vld), |
---|
761 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
762 | .restore(swap_odd_w & ~kill_restore_w), |
---|
763 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
764 | .wr_data(wr_data), |
---|
765 | .rd_data(rd_data08) |
---|
766 | ); |
---|
767 | |
---|
768 | bw_r_irf_register register09( |
---|
769 | .clk(clk), |
---|
770 | .wren(wren & (wr_addr == 5'b01001)), |
---|
771 | .save(swap_odd_m_vld), |
---|
772 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
773 | .restore(swap_odd_w & ~kill_restore_w), |
---|
774 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
775 | .wr_data(wr_data), |
---|
776 | .rd_data(rd_data09) |
---|
777 | ); |
---|
778 | |
---|
779 | bw_r_irf_register register10( |
---|
780 | .clk(clk), |
---|
781 | .wren(wren & (wr_addr == 5'b01010)), |
---|
782 | .save(swap_odd_m_vld), |
---|
783 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
784 | .restore(swap_odd_w & ~kill_restore_w), |
---|
785 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
786 | .wr_data(wr_data), |
---|
787 | .rd_data(rd_data10) |
---|
788 | ); |
---|
789 | |
---|
790 | bw_r_irf_register register11( |
---|
791 | .clk(clk), |
---|
792 | .wren(wren & (wr_addr == 5'b01011)), |
---|
793 | .save(swap_odd_m_vld), |
---|
794 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
795 | .restore(swap_odd_w & ~kill_restore_w), |
---|
796 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
797 | .wr_data(wr_data), |
---|
798 | .rd_data(rd_data11) |
---|
799 | ); |
---|
800 | |
---|
801 | bw_r_irf_register register12( |
---|
802 | .clk(clk), |
---|
803 | .wren(wren & (wr_addr == 5'b01100)), |
---|
804 | .save(swap_odd_m_vld), |
---|
805 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
806 | .restore(swap_odd_w & ~kill_restore_w), |
---|
807 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
808 | .wr_data(wr_data), |
---|
809 | .rd_data(rd_data12) |
---|
810 | ); |
---|
811 | |
---|
812 | bw_r_irf_register register13( |
---|
813 | .clk(clk), |
---|
814 | .wren(wren & (wr_addr == 5'b01101)), |
---|
815 | .save(swap_odd_m_vld), |
---|
816 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
817 | .restore(swap_odd_w & ~kill_restore_w), |
---|
818 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
819 | .wr_data(wr_data), |
---|
820 | .rd_data(rd_data13) |
---|
821 | ); |
---|
822 | |
---|
823 | bw_r_irf_register register14( |
---|
824 | .clk(clk), |
---|
825 | .wren(wren & (wr_addr == 5'b01110)), |
---|
826 | .save(swap_odd_m_vld), |
---|
827 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
828 | .restore(swap_odd_w & ~kill_restore_w), |
---|
829 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
830 | .wr_data(wr_data), |
---|
831 | .rd_data(rd_data14) |
---|
832 | ); |
---|
833 | |
---|
834 | bw_r_irf_register register15( |
---|
835 | .clk(clk), |
---|
836 | .wren(wren & (wr_addr == 5'b01111)), |
---|
837 | .save(swap_odd_m_vld), |
---|
838 | .save_addr({1'b0,old_lo_cwp_m[2:1]}), |
---|
839 | .restore(swap_odd_w & ~kill_restore_w), |
---|
840 | .restore_addr({1'b0,new_lo_cwp_w[2:1]}), |
---|
841 | .wr_data(wr_data), |
---|
842 | .rd_data(rd_data15) |
---|
843 | ); |
---|
844 | |
---|
845 | //LOCALs |
---|
846 | bw_r_irf_register register16( |
---|
847 | .clk(clk), |
---|
848 | .wren(wren & (wr_addr == 5'b10000)), |
---|
849 | .save(swap_local_m_vld), |
---|
850 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
851 | .restore(swap_local_w & ~kill_restore_w), |
---|
852 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
853 | .wr_data(wr_data), |
---|
854 | .rd_data(rd_data16) |
---|
855 | ); |
---|
856 | |
---|
857 | bw_r_irf_register register17( |
---|
858 | .clk(clk), |
---|
859 | .wren(wren & (wr_addr == 5'b10001)), |
---|
860 | .save(swap_local_m_vld), |
---|
861 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
862 | .restore(swap_local_w & ~kill_restore_w), |
---|
863 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
864 | .wr_data(wr_data), |
---|
865 | .rd_data(rd_data17) |
---|
866 | ); |
---|
867 | |
---|
868 | bw_r_irf_register register18( |
---|
869 | .clk(clk), |
---|
870 | .wren(wren & (wr_addr == 5'b10010)), |
---|
871 | .save(swap_local_m_vld), |
---|
872 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
873 | .restore(swap_local_w & ~kill_restore_w), |
---|
874 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
875 | .wr_data(wr_data), |
---|
876 | .rd_data(rd_data18) |
---|
877 | ); |
---|
878 | |
---|
879 | bw_r_irf_register register19( |
---|
880 | .clk(clk), |
---|
881 | .wren(wren & (wr_addr == 5'b10011)), |
---|
882 | .save(swap_local_m_vld), |
---|
883 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
884 | .restore(swap_local_w & ~kill_restore_w), |
---|
885 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
886 | .wr_data(wr_data), |
---|
887 | .rd_data(rd_data19) |
---|
888 | ); |
---|
889 | |
---|
890 | bw_r_irf_register register20( |
---|
891 | .clk(clk), |
---|
892 | .wren(wren & (wr_addr == 5'b10100)), |
---|
893 | .save(swap_local_m_vld), |
---|
894 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
895 | .restore(swap_local_w & ~kill_restore_w), |
---|
896 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
897 | .wr_data(wr_data), |
---|
898 | .rd_data(rd_data20) |
---|
899 | ); |
---|
900 | |
---|
901 | bw_r_irf_register register21( |
---|
902 | .clk(clk), |
---|
903 | .wren(wren & (wr_addr == 5'b10101)), |
---|
904 | .save(swap_local_m_vld), |
---|
905 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
906 | .restore(swap_local_w & ~kill_restore_w), |
---|
907 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
908 | .wr_data(wr_data), |
---|
909 | .rd_data(rd_data21) |
---|
910 | ); |
---|
911 | |
---|
912 | bw_r_irf_register register22( |
---|
913 | .clk(clk), |
---|
914 | .wren(wren & (wr_addr == 5'b10110)), |
---|
915 | .save(swap_local_m_vld), |
---|
916 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
917 | .restore(swap_local_w & ~kill_restore_w), |
---|
918 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
919 | .wr_data(wr_data), |
---|
920 | .rd_data(rd_data22) |
---|
921 | ); |
---|
922 | |
---|
923 | bw_r_irf_register register23( |
---|
924 | .clk(clk), |
---|
925 | .wren(wren & (wr_addr == 5'b10111)), |
---|
926 | .save(swap_local_m_vld), |
---|
927 | .save_addr({old_lo_cwp_m[2:0]}), |
---|
928 | .restore(swap_local_w & ~kill_restore_w), |
---|
929 | .restore_addr({new_lo_cwp_w[2:0]}), |
---|
930 | .wr_data(wr_data), |
---|
931 | .rd_data(rd_data23) |
---|
932 | ); |
---|
933 | |
---|
934 | //EVENs |
---|
935 | bw_r_irf_register register24( |
---|
936 | .clk(clk), |
---|
937 | .wren(wren & (wr_addr == 5'b11000)), |
---|
938 | .save(swap_even_m_vld), |
---|
939 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
940 | .restore(swap_even_w & ~kill_restore_w), |
---|
941 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
942 | .wr_data(wr_data), |
---|
943 | .rd_data(rd_data24) |
---|
944 | ); |
---|
945 | |
---|
946 | bw_r_irf_register register25( |
---|
947 | .clk(clk), |
---|
948 | .wren(wren & (wr_addr == 5'b11001)), |
---|
949 | .save(swap_even_m_vld), |
---|
950 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
951 | .restore(swap_even_w & ~kill_restore_w), |
---|
952 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
953 | .wr_data(wr_data), |
---|
954 | .rd_data(rd_data25) |
---|
955 | ); |
---|
956 | |
---|
957 | bw_r_irf_register register26( |
---|
958 | .clk(clk), |
---|
959 | .wren(wren & (wr_addr == 5'b11010)), |
---|
960 | .save(swap_even_m_vld), |
---|
961 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
962 | .restore(swap_even_w & ~kill_restore_w), |
---|
963 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
964 | .wr_data(wr_data), |
---|
965 | .rd_data(rd_data26) |
---|
966 | ); |
---|
967 | |
---|
968 | bw_r_irf_register register27( |
---|
969 | .clk(clk), |
---|
970 | .wren(wren & (wr_addr == 5'b11011)), |
---|
971 | .save(swap_even_m_vld), |
---|
972 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
973 | .restore(swap_even_w & ~kill_restore_w), |
---|
974 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
975 | .wr_data(wr_data), |
---|
976 | .rd_data(rd_data27) |
---|
977 | ); |
---|
978 | |
---|
979 | bw_r_irf_register register28( |
---|
980 | .clk(clk), |
---|
981 | .wren(wren & (wr_addr == 5'b11100)), |
---|
982 | .save(swap_even_m_vld), |
---|
983 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
984 | .restore(swap_even_w & ~kill_restore_w), |
---|
985 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
986 | .wr_data(wr_data), |
---|
987 | .rd_data(rd_data28) |
---|
988 | ); |
---|
989 | |
---|
990 | bw_r_irf_register register29( |
---|
991 | .clk(clk), |
---|
992 | .wren(wren & (wr_addr == 5'b11101)), |
---|
993 | .save(swap_even_m_vld), |
---|
994 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
995 | .restore(swap_even_w & ~kill_restore_w), |
---|
996 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
997 | .wr_data(wr_data), |
---|
998 | .rd_data(rd_data29) |
---|
999 | ); |
---|
1000 | |
---|
1001 | bw_r_irf_register register30( |
---|
1002 | .clk(clk), |
---|
1003 | .wren(wren & (wr_addr == 5'b11110)), |
---|
1004 | .save(swap_even_m_vld), |
---|
1005 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
1006 | .restore(swap_even_w & ~kill_restore_w), |
---|
1007 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
1008 | .wr_data(wr_data), |
---|
1009 | .rd_data(rd_data30) |
---|
1010 | ); |
---|
1011 | |
---|
1012 | bw_r_irf_register register31( |
---|
1013 | .clk(clk), |
---|
1014 | .wren(wren & (wr_addr == 5'b11111)), |
---|
1015 | .save(swap_even_m_vld), |
---|
1016 | .save_addr({1'b0,old_e_cwp_m[1:0]}), |
---|
1017 | .restore(swap_even_w & ~kill_restore_w), |
---|
1018 | .restore_addr({1'b0,new_e_cwp_w[1:0]}), |
---|
1019 | .wr_data(wr_data), |
---|
1020 | .rd_data(rd_data31) |
---|
1021 | ); |
---|
1022 | |
---|
1023 | endmodule |
---|
1024 | |
---|
1025 | |
---|
1026 | `else |
---|
1027 | |
---|
1028 | |
---|
1029 | module bw_r_irf(so, irf_byp_rs1_data_d_l, irf_byp_rs2_data_d_l, |
---|
1030 | irf_byp_rs3_data_d_l, irf_byp_rs3h_data_d_l, rclk, reset_l, si, se, |
---|
1031 | sehold, rst_tri_en, ifu_exu_tid_s2, ifu_exu_rs1_s, ifu_exu_rs2_s, |
---|
1032 | ifu_exu_rs3_s, ifu_exu_ren1_s, ifu_exu_ren2_s, ifu_exu_ren3_s, |
---|
1033 | ecl_irf_wen_w, ecl_irf_wen_w2, ecl_irf_rd_m, ecl_irf_rd_g, |
---|
1034 | byp_irf_rd_data_w, byp_irf_rd_data_w2, ecl_irf_tid_m, ecl_irf_tid_g, |
---|
1035 | rml_irf_old_lo_cwp_e, rml_irf_new_lo_cwp_e, rml_irf_old_e_cwp_e, |
---|
1036 | rml_irf_new_e_cwp_e, rml_irf_swap_even_e, rml_irf_swap_odd_e, |
---|
1037 | rml_irf_swap_local_e, rml_irf_kill_restore_w, rml_irf_cwpswap_tid_e, |
---|
1038 | rml_irf_old_agp, rml_irf_new_agp, rml_irf_swap_global, |
---|
1039 | rml_irf_global_tid); |
---|
1040 | |
---|
1041 | input rclk; |
---|
1042 | input reset_l; |
---|
1043 | input si; |
---|
1044 | input se; |
---|
1045 | input sehold; |
---|
1046 | input rst_tri_en; |
---|
1047 | input [1:0] ifu_exu_tid_s2; |
---|
1048 | input [4:0] ifu_exu_rs1_s; |
---|
1049 | input [4:0] ifu_exu_rs2_s; |
---|
1050 | input [4:0] ifu_exu_rs3_s; |
---|
1051 | input ifu_exu_ren1_s; |
---|
1052 | input ifu_exu_ren2_s; |
---|
1053 | input ifu_exu_ren3_s; |
---|
1054 | input ecl_irf_wen_w; |
---|
1055 | input ecl_irf_wen_w2; |
---|
1056 | input [4:0] ecl_irf_rd_m; |
---|
1057 | input [4:0] ecl_irf_rd_g; |
---|
1058 | input [71:0] byp_irf_rd_data_w; |
---|
1059 | input [71:0] byp_irf_rd_data_w2; |
---|
1060 | input [1:0] ecl_irf_tid_m; |
---|
1061 | input [1:0] ecl_irf_tid_g; |
---|
1062 | input [2:0] rml_irf_old_lo_cwp_e; |
---|
1063 | input [2:0] rml_irf_new_lo_cwp_e; |
---|
1064 | input [2:1] rml_irf_old_e_cwp_e; |
---|
1065 | input [2:1] rml_irf_new_e_cwp_e; |
---|
1066 | input rml_irf_swap_even_e; |
---|
1067 | input rml_irf_swap_odd_e; |
---|
1068 | input rml_irf_swap_local_e; |
---|
1069 | input rml_irf_kill_restore_w; |
---|
1070 | input [1:0] rml_irf_cwpswap_tid_e; |
---|
1071 | input [1:0] rml_irf_old_agp; |
---|
1072 | input [1:0] rml_irf_new_agp; |
---|
1073 | input rml_irf_swap_global; |
---|
1074 | input [1:0] rml_irf_global_tid; |
---|
1075 | output so; |
---|
1076 | output [71:0] irf_byp_rs1_data_d_l; |
---|
1077 | output [71:0] irf_byp_rs2_data_d_l; |
---|
1078 | output [71:0] irf_byp_rs3_data_d_l; |
---|
1079 | output [31:0] irf_byp_rs3h_data_d_l; |
---|
1080 | |
---|
1081 | wire [71:0] irf_byp_rs1_data_d; |
---|
1082 | wire [71:0] irf_byp_rs2_data_d; |
---|
1083 | wire [71:0] irf_byp_rs3_data_d; |
---|
1084 | wire [71:0] irf_byp_rs3h_data_d; |
---|
1085 | wire [1:0] ecl_irf_tid_w; |
---|
1086 | wire [1:0] ecl_irf_tid_w2; |
---|
1087 | wire [4:0] ecl_irf_rd_w; |
---|
1088 | wire [4:0] ecl_irf_rd_w2; |
---|
1089 | wire [1:0] ifu_exu_thr_d; |
---|
1090 | wire ifu_exu_ren1_d; |
---|
1091 | wire ifu_exu_ren2_d; |
---|
1092 | wire ifu_exu_ren3_d; |
---|
1093 | wire [4:0] ifu_exu_rs1_d; |
---|
1094 | wire [4:0] ifu_exu_rs2_d; |
---|
1095 | wire [4:0] ifu_exu_rs3_d; |
---|
1096 | wire [6:0] thr_rs1; |
---|
1097 | wire [6:0] thr_rs2; |
---|
1098 | wire [6:0] thr_rs3; |
---|
1099 | wire [6:0] thr_rs3h; |
---|
1100 | wire [6:0] thr_rd_w; |
---|
1101 | wire [6:0] thr_rd_w2; |
---|
1102 | reg [1:0] cwpswap_tid_m; |
---|
1103 | reg [1:0] cwpswap_tid_w; |
---|
1104 | reg [2:0] old_lo_cwp_m; |
---|
1105 | reg [2:0] new_lo_cwp_m; |
---|
1106 | reg [2:0] new_lo_cwp_w; |
---|
1107 | reg [1:0] old_e_cwp_m; |
---|
1108 | reg [1:0] new_e_cwp_m; |
---|
1109 | reg [1:0] new_e_cwp_w; |
---|
1110 | reg swap_local_m; |
---|
1111 | reg swap_local_w; |
---|
1112 | reg swap_even_m; |
---|
1113 | reg swap_even_w; |
---|
1114 | reg swap_odd_m; |
---|
1115 | reg swap_odd_w; |
---|
1116 | reg kill_restore_d1; |
---|
1117 | reg swap_global_d1; |
---|
1118 | reg swap_global_d2; |
---|
1119 | reg [1:0] global_tid_d1; |
---|
1120 | reg [1:0] global_tid_d2; |
---|
1121 | reg [1:0] old_agp_d1; |
---|
1122 | reg [1:0] new_agp_d1; |
---|
1123 | reg [1:0] new_agp_d2; |
---|
1124 | reg [71:0] active_win_thr_rd_w_neg; |
---|
1125 | reg [71:0] active_win_thr_rd_w2_neg; |
---|
1126 | reg [6:0] thr_rd_w_neg; |
---|
1127 | reg [6:0] thr_rd_w2_neg; |
---|
1128 | reg active_win_thr_rd_w_neg_wr_en; |
---|
1129 | reg active_win_thr_rd_w2_neg_wr_en; |
---|
1130 | reg rst_tri_en_neg; |
---|
1131 | wire clk; |
---|
1132 | wire ren1_s; |
---|
1133 | wire ren2_s; |
---|
1134 | wire ren3_s; |
---|
1135 | wire [4:0] rs1_s; |
---|
1136 | wire [4:0] rs2_s; |
---|
1137 | wire [4:0] rs3_s; |
---|
1138 | wire [1:0] tid_s; |
---|
1139 | wire [1:0] tid_g; |
---|
1140 | wire [1:0] tid_m; |
---|
1141 | wire [4:0] rd_m; |
---|
1142 | wire [4:0] rd_g; |
---|
1143 | wire kill_restore_w; |
---|
1144 | wire swap_global_d1_vld; |
---|
1145 | wire swap_local_m_vld; |
---|
1146 | wire swap_even_m_vld; |
---|
1147 | wire swap_odd_m_vld; |
---|
1148 | wire wr_en; |
---|
1149 | wire wr_en2; |
---|
1150 | |
---|
1151 | assign clk = rclk; |
---|
1152 | assign {ren1_s, ren2_s, ren3_s, rs1_s[4:0], rs2_s[4:0], rs3_s[4:0], |
---|
1153 | tid_s[1:0], tid_g[1:0], tid_m[1:0], rd_m[4:0], rd_g[4:0]} = ( |
---|
1154 | sehold ? {ifu_exu_ren1_d, ifu_exu_ren2_d, ifu_exu_ren3_d, |
---|
1155 | ifu_exu_rs1_d[4:0], ifu_exu_rs2_d[4:0], ifu_exu_rs3_d[4:0], |
---|
1156 | ifu_exu_thr_d[1:0], ecl_irf_tid_w2[1:0], ecl_irf_tid_w[1:0], |
---|
1157 | ecl_irf_rd_w[4:0], ecl_irf_rd_w2[4:0]} : {ifu_exu_ren1_s, |
---|
1158 | ifu_exu_ren2_s, ifu_exu_ren3_s, ifu_exu_rs1_s[4:0], |
---|
1159 | ifu_exu_rs2_s[4:0], ifu_exu_rs3_s[4:0], ifu_exu_tid_s2[1:0], |
---|
1160 | ecl_irf_tid_g[1:0], ecl_irf_tid_m[1:0], ecl_irf_rd_m[4:0], |
---|
1161 | ecl_irf_rd_g[4:0]}); |
---|
1162 | assign thr_rs1[6:0] = {ifu_exu_thr_d, ifu_exu_rs1_d}; |
---|
1163 | assign thr_rs2[6:0] = {ifu_exu_thr_d, ifu_exu_rs2_d}; |
---|
1164 | assign thr_rs3[6:0] = {ifu_exu_thr_d, ifu_exu_rs3_d[4:0]}; |
---|
1165 | assign thr_rs3h[6:0] = {ifu_exu_thr_d[1:0], ifu_exu_rs3_d[4:1], 1'b1}; |
---|
1166 | assign thr_rd_w[6:0] = {ecl_irf_tid_w, ecl_irf_rd_w}; |
---|
1167 | assign thr_rd_w2[6:0] = {ecl_irf_tid_w2, ecl_irf_rd_w2}; |
---|
1168 | assign irf_byp_rs1_data_d_l[71:0] = (~irf_byp_rs1_data_d[71:0]); |
---|
1169 | assign irf_byp_rs2_data_d_l[71:0] = (~irf_byp_rs2_data_d[71:0]); |
---|
1170 | assign irf_byp_rs3_data_d_l[71:0] = (~irf_byp_rs3_data_d[71:0]); |
---|
1171 | assign irf_byp_rs3h_data_d_l[31:0] = (~irf_byp_rs3h_data_d[31:0]); |
---|
1172 | assign kill_restore_w = (sehold ? kill_restore_d1 : |
---|
1173 | rml_irf_kill_restore_w); |
---|
1174 | assign swap_local_m_vld = (swap_local_m & (~rst_tri_en)); |
---|
1175 | assign swap_odd_m_vld = (swap_odd_m & (~rst_tri_en)); |
---|
1176 | assign swap_even_m_vld = (swap_even_m & (~rst_tri_en)); |
---|
1177 | assign swap_global_d1_vld = (swap_global_d1 & (~rst_tri_en)); |
---|
1178 | assign wr_en = (active_win_thr_rd_w_neg_wr_en & ((~rst_tri_en) | (~ |
---|
1179 | rst_tri_en_neg))); |
---|
1180 | assign wr_en2 = (active_win_thr_rd_w2_neg_wr_en & ((~rst_tri_en) | (~ |
---|
1181 | rst_tri_en_neg))); |
---|
1182 | |
---|
1183 | dff_s dff_ren1_s2d( |
---|
1184 | .din (ren1_s), |
---|
1185 | .clk (clk), |
---|
1186 | .q (ifu_exu_ren1_d), |
---|
1187 | .se (se), |
---|
1188 | .si (), |
---|
1189 | .so ()); |
---|
1190 | dff_s dff_ren2_s2d( |
---|
1191 | .din (ren2_s), |
---|
1192 | .clk (clk), |
---|
1193 | .q (ifu_exu_ren2_d), |
---|
1194 | .se (se), |
---|
1195 | .si (), |
---|
1196 | .so ()); |
---|
1197 | dff_s dff_ren3_s2d( |
---|
1198 | .din (ren3_s), |
---|
1199 | .clk (clk), |
---|
1200 | .q (ifu_exu_ren3_d), |
---|
1201 | .se (se), |
---|
1202 | .si (), |
---|
1203 | .so ()); |
---|
1204 | dff_s #(5) dff_rs1_s2d( |
---|
1205 | .din (rs1_s[4:0]), |
---|
1206 | .clk (clk), |
---|
1207 | .q (ifu_exu_rs1_d[4:0]), |
---|
1208 | .se (se), |
---|
1209 | .si (), |
---|
1210 | .so ()); |
---|
1211 | dff_s #(5) dff_rs2_s2d( |
---|
1212 | .din (rs2_s[4:0]), |
---|
1213 | .clk (clk), |
---|
1214 | .q (ifu_exu_rs2_d[4:0]), |
---|
1215 | .se (se), |
---|
1216 | .si (), |
---|
1217 | .so ()); |
---|
1218 | dff_s #(5) dff_rs3_s2d( |
---|
1219 | .din (rs3_s[4:0]), |
---|
1220 | .clk (clk), |
---|
1221 | .q (ifu_exu_rs3_d[4:0]), |
---|
1222 | .se (se), |
---|
1223 | .si (), |
---|
1224 | .so ()); |
---|
1225 | dff_s #(2) dff_thr_s2d( |
---|
1226 | .din (tid_s[1:0]), |
---|
1227 | .clk (clk), |
---|
1228 | .q (ifu_exu_thr_d[1:0]), |
---|
1229 | .se (se), |
---|
1230 | .si (), |
---|
1231 | .so ()); |
---|
1232 | dff_s #(2) dff_thr_g2w2( |
---|
1233 | .din (tid_g[1:0]), |
---|
1234 | .clk (clk), |
---|
1235 | .q (ecl_irf_tid_w2[1:0]), |
---|
1236 | .se (se), |
---|
1237 | .si (), |
---|
1238 | .so ()); |
---|
1239 | dff_s #(2) dff_thr_m2w( |
---|
1240 | .din (tid_m[1:0]), |
---|
1241 | .clk (clk), |
---|
1242 | .q (ecl_irf_tid_w[1:0]), |
---|
1243 | .se (se), |
---|
1244 | .si (), |
---|
1245 | .so ()); |
---|
1246 | dff_s #(5) dff_rd_m2w( |
---|
1247 | .din (rd_m[4:0]), |
---|
1248 | .clk (clk), |
---|
1249 | .q (ecl_irf_rd_w[4:0]), |
---|
1250 | .se (se), |
---|
1251 | .si (), |
---|
1252 | .so ()); |
---|
1253 | dff_s #(5) dff_rd_g2w2( |
---|
1254 | .din (rd_g[4:0]), |
---|
1255 | .clk (clk), |
---|
1256 | .q (ecl_irf_rd_w2[4:0]), |
---|
1257 | .se (se), |
---|
1258 | .si (), |
---|
1259 | .so ()); |
---|
1260 | bw_r_irf_core bw_r_irf_core( |
---|
1261 | .clk (clk), |
---|
1262 | .ifu_exu_ren1_d (ifu_exu_ren1_d), |
---|
1263 | .ifu_exu_ren2_d (ifu_exu_ren2_d), |
---|
1264 | .ifu_exu_ren3_d (ifu_exu_ren3_d), |
---|
1265 | .thr_rs1 (thr_rs1), |
---|
1266 | .thr_rs2 (thr_rs2), |
---|
1267 | .thr_rs3 (thr_rs3), |
---|
1268 | .thr_rs3h (thr_rs3h), |
---|
1269 | .irf_byp_rs1_data_d (irf_byp_rs1_data_d), |
---|
1270 | .irf_byp_rs2_data_d (irf_byp_rs2_data_d), |
---|
1271 | .irf_byp_rs3_data_d (irf_byp_rs3_data_d), |
---|
1272 | .irf_byp_rs3h_data_d (irf_byp_rs3h_data_d), |
---|
1273 | .wr_en (wr_en), |
---|
1274 | .wr_en2 (wr_en2), |
---|
1275 | .active_win_thr_rd_w_neg (active_win_thr_rd_w_neg), |
---|
1276 | .active_win_thr_rd_w2_neg (active_win_thr_rd_w2_neg), |
---|
1277 | .thr_rd_w_neg (thr_rd_w_neg), |
---|
1278 | .thr_rd_w2_neg (thr_rd_w2_neg), |
---|
1279 | .swap_global_d1_vld (swap_global_d1_vld), |
---|
1280 | .swap_global_d2 (swap_global_d2), |
---|
1281 | .global_tid_d1 (global_tid_d1), |
---|
1282 | .global_tid_d2 (global_tid_d2), |
---|
1283 | .old_agp_d1 (old_agp_d1), |
---|
1284 | .new_agp_d2 (new_agp_d2), |
---|
1285 | .swap_local_m_vld (swap_local_m_vld), |
---|
1286 | .swap_local_w (swap_local_w), |
---|
1287 | .old_lo_cwp_m (old_lo_cwp_m), |
---|
1288 | .new_lo_cwp_w (new_lo_cwp_w), |
---|
1289 | .swap_even_m_vld (swap_even_m_vld), |
---|
1290 | .swap_even_w (swap_even_w), |
---|
1291 | .old_e_cwp_m (old_e_cwp_m), |
---|
1292 | .new_e_cwp_w (new_e_cwp_w), |
---|
1293 | .swap_odd_m_vld (swap_odd_m_vld), |
---|
1294 | .swap_odd_w (swap_odd_w), |
---|
1295 | .cwpswap_tid_m (cwpswap_tid_m), |
---|
1296 | .cwpswap_tid_w (cwpswap_tid_w), |
---|
1297 | .kill_restore_w (kill_restore_w)); |
---|
1298 | |
---|
1299 | always @(negedge clk) begin |
---|
1300 | rst_tri_en_neg <= rst_tri_en; |
---|
1301 | if ((ecl_irf_wen_w & ecl_irf_wen_w2) & (thr_rd_w[6:0] == |
---|
1302 | thr_rd_w2[6:0])) begin |
---|
1303 | active_win_thr_rd_w_neg <= {72 {1'bx}}; |
---|
1304 | thr_rd_w_neg <= thr_rd_w; |
---|
1305 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
1306 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
1307 | end |
---|
1308 | else |
---|
1309 | begin |
---|
1310 | if (ecl_irf_wen_w & (thr_rd_w[4:0] != 5'b0)) begin |
---|
1311 | active_win_thr_rd_w_neg <= byp_irf_rd_data_w; |
---|
1312 | thr_rd_w_neg <= thr_rd_w; |
---|
1313 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
1314 | end |
---|
1315 | else begin |
---|
1316 | active_win_thr_rd_w_neg_wr_en <= 1'b0; |
---|
1317 | end |
---|
1318 | if (ecl_irf_wen_w2 & (thr_rd_w2[4:0] != 5'b0)) begin |
---|
1319 | active_win_thr_rd_w2_neg <= byp_irf_rd_data_w2; |
---|
1320 | thr_rd_w2_neg <= thr_rd_w2; |
---|
1321 | active_win_thr_rd_w2_neg_wr_en <= 1'b1; |
---|
1322 | end |
---|
1323 | else begin |
---|
1324 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
1325 | end |
---|
1326 | end |
---|
1327 | end |
---|
1328 | always @(posedge clk) begin |
---|
1329 | cwpswap_tid_m[1:0] <= (sehold ? cwpswap_tid_m[1:0] : |
---|
1330 | rml_irf_cwpswap_tid_e[1:0]); |
---|
1331 | cwpswap_tid_w[1:0] <= cwpswap_tid_m[1:0]; |
---|
1332 | old_lo_cwp_m[2:0] <= (sehold ? old_lo_cwp_m[2:0] : |
---|
1333 | rml_irf_old_lo_cwp_e[2:0]); |
---|
1334 | new_lo_cwp_m[2:0] <= (sehold ? new_lo_cwp_m[2:0] : |
---|
1335 | rml_irf_new_lo_cwp_e[2:0]); |
---|
1336 | new_lo_cwp_w[2:0] <= new_lo_cwp_m[2:0]; |
---|
1337 | old_e_cwp_m[1:0] <= (sehold ? old_e_cwp_m[1:0] : |
---|
1338 | rml_irf_old_e_cwp_e[2:1]); |
---|
1339 | new_e_cwp_m[1:0] <= (sehold ? new_e_cwp_m[1:0] : |
---|
1340 | rml_irf_new_e_cwp_e[2:1]); |
---|
1341 | new_e_cwp_w[1:0] <= new_e_cwp_m[1:0]; |
---|
1342 | swap_local_m <= (sehold ? (swap_local_m & rst_tri_en) : |
---|
1343 | rml_irf_swap_local_e); |
---|
1344 | swap_local_w <= swap_local_m_vld; |
---|
1345 | swap_odd_m <= (sehold ? (swap_odd_m & rst_tri_en) : rml_irf_swap_odd_e |
---|
1346 | ); |
---|
1347 | swap_odd_w <= swap_odd_m_vld; |
---|
1348 | swap_even_m <= (sehold ? (swap_even_m & rst_tri_en) : |
---|
1349 | rml_irf_swap_even_e); |
---|
1350 | swap_even_w <= swap_even_m_vld; |
---|
1351 | kill_restore_d1 <= kill_restore_w; |
---|
1352 | end |
---|
1353 | always @(posedge clk) begin |
---|
1354 | swap_global_d1 <= (sehold ? (swap_global_d1 & rst_tri_en) : |
---|
1355 | rml_irf_swap_global); |
---|
1356 | swap_global_d2 <= swap_global_d1_vld; |
---|
1357 | global_tid_d1[1:0] <= (sehold ? global_tid_d1[1:0] : |
---|
1358 | rml_irf_global_tid[1:0]); |
---|
1359 | global_tid_d2[1:0] <= global_tid_d1[1:0]; |
---|
1360 | old_agp_d1[1:0] <= (sehold ? old_agp_d1[1:0] : rml_irf_old_agp[1:0]); |
---|
1361 | new_agp_d1[1:0] <= (sehold ? new_agp_d1[1:0] : rml_irf_new_agp[1:0]); |
---|
1362 | new_agp_d2[1:0] <= new_agp_d1[1:0]; |
---|
1363 | end |
---|
1364 | |
---|
1365 | // synthesis traslate off |
---|
1366 | `ifdef DEBUG |
---|
1367 | |
---|
1368 | always @(posedge clk) begin |
---|
1369 | if (wr_en) begin |
---|
1370 | $display("Write Port 1: %h %h", active_win_thr_rd_w_neg, |
---|
1371 | thr_rd_w_neg); |
---|
1372 | end |
---|
1373 | if (wr_en2) begin |
---|
1374 | $display("Write Port 2: %h %h", active_win_thr_rd_w2_neg, |
---|
1375 | thr_rd_w2_neg); |
---|
1376 | end |
---|
1377 | if (ifu_exu_ren1_d) begin |
---|
1378 | @(posedge clk) ; |
---|
1379 | $display("Read Port 1: %h %h", irf_byp_rs1_data_d, thr_rs1); |
---|
1380 | end |
---|
1381 | if (ifu_exu_ren2_d) begin |
---|
1382 | @(posedge clk) ; |
---|
1383 | $display("Read Port 2: %h %h", irf_byp_rs2_data_d, thr_rs2); |
---|
1384 | end |
---|
1385 | if (ifu_exu_ren3_d) begin |
---|
1386 | @(posedge clk) ; |
---|
1387 | $display("Read Port 3: %h %h", irf_byp_rs3_data_d, thr_rs3); |
---|
1388 | end |
---|
1389 | end |
---|
1390 | |
---|
1391 | // synthesis traslate on |
---|
1392 | `endif |
---|
1393 | |
---|
1394 | endmodule |
---|
1395 | |
---|
1396 | module bw_r_irf_core(clk, ifu_exu_ren1_d, ifu_exu_ren2_d, ifu_exu_ren3_d, |
---|
1397 | thr_rs1, thr_rs2, thr_rs3, thr_rs3h, irf_byp_rs1_data_d, |
---|
1398 | irf_byp_rs2_data_d, irf_byp_rs3_data_d, irf_byp_rs3h_data_d, wr_en, |
---|
1399 | wr_en2, active_win_thr_rd_w_neg, active_win_thr_rd_w2_neg, thr_rd_w_neg, |
---|
1400 | thr_rd_w2_neg, swap_global_d1_vld, swap_global_d2, global_tid_d1, |
---|
1401 | global_tid_d2, old_agp_d1, new_agp_d2, swap_local_m_vld, swap_local_w, |
---|
1402 | old_lo_cwp_m, new_lo_cwp_w, swap_even_m_vld, swap_even_w, old_e_cwp_m, |
---|
1403 | new_e_cwp_w, swap_odd_m_vld, swap_odd_w, cwpswap_tid_m, cwpswap_tid_w, |
---|
1404 | kill_restore_w); |
---|
1405 | |
---|
1406 | input clk; |
---|
1407 | input ifu_exu_ren1_d; |
---|
1408 | input ifu_exu_ren2_d; |
---|
1409 | input ifu_exu_ren3_d; |
---|
1410 | input [6:0] thr_rs1; |
---|
1411 | input [6:0] thr_rs2; |
---|
1412 | input [6:0] thr_rs3; |
---|
1413 | input [6:0] thr_rs3h; |
---|
1414 | output [71:0] irf_byp_rs1_data_d; |
---|
1415 | output [71:0] irf_byp_rs2_data_d; |
---|
1416 | output [71:0] irf_byp_rs3_data_d; |
---|
1417 | output [71:0] irf_byp_rs3h_data_d; |
---|
1418 | input wr_en; |
---|
1419 | input wr_en2; |
---|
1420 | input [71:0] active_win_thr_rd_w_neg; |
---|
1421 | input [71:0] active_win_thr_rd_w2_neg; |
---|
1422 | input [6:0] thr_rd_w_neg; |
---|
1423 | input [6:0] thr_rd_w2_neg; |
---|
1424 | input swap_global_d1_vld; |
---|
1425 | input swap_global_d2; |
---|
1426 | input [1:0] global_tid_d1; |
---|
1427 | input [1:0] global_tid_d2; |
---|
1428 | input [1:0] old_agp_d1; |
---|
1429 | input [1:0] new_agp_d2; |
---|
1430 | input swap_local_m_vld; |
---|
1431 | input swap_local_w; |
---|
1432 | input [2:0] old_lo_cwp_m; |
---|
1433 | input [2:0] new_lo_cwp_w; |
---|
1434 | input swap_even_m_vld; |
---|
1435 | input swap_even_w; |
---|
1436 | input [1:0] old_e_cwp_m; |
---|
1437 | input [1:0] new_e_cwp_w; |
---|
1438 | input swap_odd_m_vld; |
---|
1439 | input swap_odd_w; |
---|
1440 | input [1:0] cwpswap_tid_m; |
---|
1441 | input [1:0] cwpswap_tid_w; |
---|
1442 | input kill_restore_w; |
---|
1443 | |
---|
1444 | reg [71:0] irf_byp_rs1_data_d; |
---|
1445 | reg [71:0] irf_byp_rs2_data_d; |
---|
1446 | reg [71:0] irf_byp_rs3_data_d; |
---|
1447 | reg [71:0] irf_byp_rs3h_data_d; |
---|
1448 | wire [71:0] rd_data00; |
---|
1449 | wire [71:0] rd_data01; |
---|
1450 | wire [71:0] rd_data02; |
---|
1451 | wire [71:0] rd_data03; |
---|
1452 | wire [71:0] rd_data04; |
---|
1453 | wire [71:0] rd_data05; |
---|
1454 | wire [71:0] rd_data06; |
---|
1455 | wire [71:0] rd_data07; |
---|
1456 | wire [71:0] rd_data08; |
---|
1457 | wire [71:0] rd_data09; |
---|
1458 | wire [71:0] rd_data10; |
---|
1459 | wire [71:0] rd_data11; |
---|
1460 | wire [71:0] rd_data12; |
---|
1461 | wire [71:0] rd_data13; |
---|
1462 | wire [71:0] rd_data14; |
---|
1463 | wire [71:0] rd_data15; |
---|
1464 | wire [71:0] rd_data16; |
---|
1465 | wire [71:0] rd_data17; |
---|
1466 | wire [71:0] rd_data18; |
---|
1467 | wire [71:0] rd_data19; |
---|
1468 | wire [71:0] rd_data20; |
---|
1469 | wire [71:0] rd_data21; |
---|
1470 | wire [71:0] rd_data22; |
---|
1471 | wire [71:0] rd_data23; |
---|
1472 | wire [71:0] rd_data24; |
---|
1473 | wire [71:0] rd_data25; |
---|
1474 | wire [71:0] rd_data26; |
---|
1475 | wire [71:0] rd_data27; |
---|
1476 | wire [71:0] rd_data28; |
---|
1477 | wire [71:0] rd_data29; |
---|
1478 | wire [71:0] rd_data30; |
---|
1479 | wire [71:0] rd_data31; |
---|
1480 | wire wren; |
---|
1481 | wire [4:0] wr_addr; |
---|
1482 | wire [71:0] wr_data; |
---|
1483 | |
---|
1484 | |
---|
1485 | wire [127:0] wr_en1s = (wr_en << {thr_rd_w_neg[4:0],thr_rd_w_neg[6:5]}); |
---|
1486 | wire [127:0] wr_en2s = (wr_en2 << {thr_rd_w2_neg[4:0],thr_rd_w2_neg[6:5]}); |
---|
1487 | wire [127:0] wrens = wr_en1s | wr_en2s; |
---|
1488 | |
---|
1489 | wire [3:0] wr_th1 = wr_en << thr_rd_w_neg[6:5]; |
---|
1490 | |
---|
1491 | wire [71:0] wr_data0 = wr_th1[0] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
1492 | wire [71:0] wr_data1 = wr_th1[1] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
1493 | wire [71:0] wr_data2 = wr_th1[2] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
1494 | wire [71:0] wr_data3 = wr_th1[3] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
1495 | |
---|
1496 | |
---|
1497 | bw_r_irf_register register00( |
---|
1498 | .clk (clk), |
---|
1499 | .wrens (wrens[3:0]), |
---|
1500 | .save (swap_global_d1_vld), |
---|
1501 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1502 | .restore (swap_global_d2), |
---|
1503 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1504 | .wr_data0 (72'b0), |
---|
1505 | .wr_data1 (72'b0), |
---|
1506 | .wr_data2 (72'b0), |
---|
1507 | .wr_data3 (72'b0), |
---|
1508 | .rd_thread (thr_rs1[6:5]), |
---|
1509 | .rd_data (rd_data00)); |
---|
1510 | bw_r_irf_register register01( |
---|
1511 | .clk (clk), |
---|
1512 | .wrens (wrens[7:4]), |
---|
1513 | .save (swap_global_d1_vld), |
---|
1514 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1515 | .restore (swap_global_d2), |
---|
1516 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1517 | .wr_data0 (wr_data0), |
---|
1518 | .wr_data1 (wr_data1), |
---|
1519 | .wr_data2 (wr_data2), |
---|
1520 | .wr_data3 (wr_data3), |
---|
1521 | .rd_thread (thr_rs1[6:5]), |
---|
1522 | .rd_data (rd_data01)); |
---|
1523 | bw_r_irf_register register02( |
---|
1524 | .clk (clk), |
---|
1525 | .wrens (wrens[11:8]), |
---|
1526 | .save (swap_global_d1_vld), |
---|
1527 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1528 | .restore (swap_global_d2), |
---|
1529 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1530 | .wr_data0 (wr_data0), |
---|
1531 | .wr_data1 (wr_data1), |
---|
1532 | .wr_data2 (wr_data2), |
---|
1533 | .wr_data3 (wr_data3), |
---|
1534 | .rd_thread (thr_rs1[6:5]), |
---|
1535 | .rd_data (rd_data02)); |
---|
1536 | bw_r_irf_register register03( |
---|
1537 | .clk (clk), |
---|
1538 | .wrens (wrens[15:12]), |
---|
1539 | .save (swap_global_d1_vld), |
---|
1540 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1541 | .restore (swap_global_d2), |
---|
1542 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1543 | .wr_data0 (wr_data0), |
---|
1544 | .wr_data1 (wr_data1), |
---|
1545 | .wr_data2 (wr_data2), |
---|
1546 | .wr_data3 (wr_data3), |
---|
1547 | .rd_thread (thr_rs1[6:5]), |
---|
1548 | .rd_data (rd_data03)); |
---|
1549 | bw_r_irf_register register04( |
---|
1550 | .clk (clk), |
---|
1551 | .wrens (wrens[19:16]), |
---|
1552 | .save (swap_global_d1_vld), |
---|
1553 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1554 | .restore (swap_global_d2), |
---|
1555 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1556 | .wr_data0 (wr_data0), |
---|
1557 | .wr_data1 (wr_data1), |
---|
1558 | .wr_data2 (wr_data2), |
---|
1559 | .wr_data3 (wr_data3), |
---|
1560 | .rd_thread (thr_rs1[6:5]), |
---|
1561 | .rd_data (rd_data04)); |
---|
1562 | bw_r_irf_register register05( |
---|
1563 | .clk (clk), |
---|
1564 | .wrens (wrens[23:20]), |
---|
1565 | .save (swap_global_d1_vld), |
---|
1566 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1567 | .restore (swap_global_d2), |
---|
1568 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1569 | .wr_data0 (wr_data0), |
---|
1570 | .wr_data1 (wr_data1), |
---|
1571 | .wr_data2 (wr_data2), |
---|
1572 | .wr_data3 (wr_data3), |
---|
1573 | .rd_thread (thr_rs1[6:5]), |
---|
1574 | .rd_data (rd_data05)); |
---|
1575 | bw_r_irf_register register06( |
---|
1576 | .clk (clk), |
---|
1577 | .wrens (wrens[27:24]), |
---|
1578 | .save (swap_global_d1_vld), |
---|
1579 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1580 | .restore (swap_global_d2), |
---|
1581 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1582 | .wr_data0 (wr_data0), |
---|
1583 | .wr_data1 (wr_data1), |
---|
1584 | .wr_data2 (wr_data2), |
---|
1585 | .wr_data3 (wr_data3), |
---|
1586 | .rd_thread (thr_rs1[6:5]), |
---|
1587 | .rd_data (rd_data06)); |
---|
1588 | bw_r_irf_register register07( |
---|
1589 | .clk (clk), |
---|
1590 | .wrens (wrens[31:28]), |
---|
1591 | .save (swap_global_d1_vld), |
---|
1592 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
1593 | .restore (swap_global_d2), |
---|
1594 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
1595 | .wr_data0 (wr_data0), |
---|
1596 | .wr_data1 (wr_data1), |
---|
1597 | .wr_data2 (wr_data2), |
---|
1598 | .wr_data3 (wr_data3), |
---|
1599 | .rd_thread (thr_rs1[6:5]), |
---|
1600 | .rd_data (rd_data07)); |
---|
1601 | |
---|
1602 | bw_r_irf_register register08( |
---|
1603 | .clk (clk), |
---|
1604 | .wrens (wrens[35:32]), |
---|
1605 | .save (swap_odd_m_vld), |
---|
1606 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1607 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1608 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1609 | .wr_data0 (wr_data0), |
---|
1610 | .wr_data1 (wr_data1), |
---|
1611 | .wr_data2 (wr_data2), |
---|
1612 | .wr_data3 (wr_data3), |
---|
1613 | .rd_thread (thr_rs1[6:5]), |
---|
1614 | .rd_data (rd_data08)); |
---|
1615 | bw_r_irf_register register09( |
---|
1616 | .clk (clk), |
---|
1617 | .wrens (wrens[39:36]), |
---|
1618 | .save (swap_odd_m_vld), |
---|
1619 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1620 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1621 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1622 | .wr_data0 (wr_data0), |
---|
1623 | .wr_data1 (wr_data1), |
---|
1624 | .wr_data2 (wr_data2), |
---|
1625 | .wr_data3 (wr_data3), |
---|
1626 | .rd_thread (thr_rs1[6:5]), |
---|
1627 | .rd_data (rd_data09)); |
---|
1628 | bw_r_irf_register register10( |
---|
1629 | .clk (clk), |
---|
1630 | .wrens (wrens[43:40]), |
---|
1631 | .save (swap_odd_m_vld), |
---|
1632 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1633 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1634 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1635 | .wr_data0 (wr_data0), |
---|
1636 | .wr_data1 (wr_data1), |
---|
1637 | .wr_data2 (wr_data2), |
---|
1638 | .wr_data3 (wr_data3), |
---|
1639 | .rd_thread (thr_rs1[6:5]), |
---|
1640 | .rd_data (rd_data10)); |
---|
1641 | bw_r_irf_register register11( |
---|
1642 | .clk (clk), |
---|
1643 | .wrens (wrens[47:44]), |
---|
1644 | .save (swap_odd_m_vld), |
---|
1645 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1646 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1647 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1648 | .wr_data0 (wr_data0), |
---|
1649 | .wr_data1 (wr_data1), |
---|
1650 | .wr_data2 (wr_data2), |
---|
1651 | .wr_data3 (wr_data3), |
---|
1652 | .rd_thread (thr_rs1[6:5]), |
---|
1653 | .rd_data (rd_data11)); |
---|
1654 | bw_r_irf_register register12( |
---|
1655 | .clk (clk), |
---|
1656 | .wrens (wrens[51:48]), |
---|
1657 | .save (swap_odd_m_vld), |
---|
1658 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1659 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1660 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1661 | .wr_data0 (wr_data0), |
---|
1662 | .wr_data1 (wr_data1), |
---|
1663 | .wr_data2 (wr_data2), |
---|
1664 | .wr_data3 (wr_data3), |
---|
1665 | .rd_thread (thr_rs1[6:5]), |
---|
1666 | .rd_data (rd_data12)); |
---|
1667 | bw_r_irf_register register13( |
---|
1668 | .clk (clk), |
---|
1669 | .wrens (wrens[55:52]), |
---|
1670 | .save (swap_odd_m_vld), |
---|
1671 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1672 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1673 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1674 | .wr_data0 (wr_data0), |
---|
1675 | .wr_data1 (wr_data1), |
---|
1676 | .wr_data2 (wr_data2), |
---|
1677 | .wr_data3 (wr_data3), |
---|
1678 | .rd_thread (thr_rs1[6:5]), |
---|
1679 | .rd_data (rd_data13)); |
---|
1680 | bw_r_irf_register register14( |
---|
1681 | .clk (clk), |
---|
1682 | .wrens (wrens[59:56]), |
---|
1683 | .save (swap_odd_m_vld), |
---|
1684 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1685 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1686 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1687 | .wr_data0 (wr_data0), |
---|
1688 | .wr_data1 (wr_data1), |
---|
1689 | .wr_data2 (wr_data2), |
---|
1690 | .wr_data3 (wr_data3), |
---|
1691 | .rd_thread (thr_rs1[6:5]), |
---|
1692 | .rd_data (rd_data14)); |
---|
1693 | bw_r_irf_register register15( |
---|
1694 | .clk (clk), |
---|
1695 | .wrens (wrens[63:60]), |
---|
1696 | .save (swap_odd_m_vld), |
---|
1697 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
1698 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
1699 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
1700 | .wr_data0 (wr_data0), |
---|
1701 | .wr_data1 (wr_data1), |
---|
1702 | .wr_data2 (wr_data2), |
---|
1703 | .wr_data3 (wr_data3), |
---|
1704 | .rd_thread (thr_rs1[6:5]), |
---|
1705 | .rd_data (rd_data15)); |
---|
1706 | |
---|
1707 | bw_r_irf_register register16( |
---|
1708 | .clk (clk), |
---|
1709 | .wrens (wrens[67:64]), |
---|
1710 | .save (swap_local_m_vld), |
---|
1711 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1712 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1713 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1714 | .wr_data0 (wr_data0), |
---|
1715 | .wr_data1 (wr_data1), |
---|
1716 | .wr_data2 (wr_data2), |
---|
1717 | .wr_data3 (wr_data3), |
---|
1718 | .rd_thread (thr_rs1[6:5]), |
---|
1719 | .rd_data (rd_data16)); |
---|
1720 | bw_r_irf_register register17( |
---|
1721 | .clk (clk), |
---|
1722 | .wrens (wrens[71:68]), |
---|
1723 | .save (swap_local_m_vld), |
---|
1724 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1725 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1726 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1727 | .wr_data0 (wr_data0), |
---|
1728 | .wr_data1 (wr_data1), |
---|
1729 | .wr_data2 (wr_data2), |
---|
1730 | .wr_data3 (wr_data3), |
---|
1731 | .rd_thread (thr_rs1[6:5]), |
---|
1732 | .rd_data (rd_data17)); |
---|
1733 | bw_r_irf_register register18( |
---|
1734 | .clk (clk), |
---|
1735 | .wrens (wrens[75:72]), |
---|
1736 | .save (swap_local_m_vld), |
---|
1737 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1738 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1739 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1740 | .wr_data0 (wr_data0), |
---|
1741 | .wr_data1 (wr_data1), |
---|
1742 | .wr_data2 (wr_data2), |
---|
1743 | .wr_data3 (wr_data3), |
---|
1744 | .rd_thread (thr_rs1[6:5]), |
---|
1745 | .rd_data (rd_data18)); |
---|
1746 | bw_r_irf_register register19( |
---|
1747 | .clk (clk), |
---|
1748 | .wrens (wrens[79:76]), |
---|
1749 | .save (swap_local_m_vld), |
---|
1750 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1751 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1752 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1753 | .wr_data0 (wr_data0), |
---|
1754 | .wr_data1 (wr_data1), |
---|
1755 | .wr_data2 (wr_data2), |
---|
1756 | .wr_data3 (wr_data3), |
---|
1757 | .rd_thread (thr_rs1[6:5]), |
---|
1758 | .rd_data (rd_data19)); |
---|
1759 | bw_r_irf_register register20( |
---|
1760 | .clk (clk), |
---|
1761 | .wrens (wrens[83:80]), |
---|
1762 | .save (swap_local_m_vld), |
---|
1763 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1764 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1765 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1766 | .wr_data0 (wr_data0), |
---|
1767 | .wr_data1 (wr_data1), |
---|
1768 | .wr_data2 (wr_data2), |
---|
1769 | .wr_data3 (wr_data3), |
---|
1770 | .rd_thread (thr_rs1[6:5]), |
---|
1771 | .rd_data (rd_data20)); |
---|
1772 | bw_r_irf_register register21( |
---|
1773 | .clk (clk), |
---|
1774 | .wrens (wrens[87:84]), |
---|
1775 | .save (swap_local_m_vld), |
---|
1776 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1777 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1778 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1779 | .wr_data0 (wr_data0), |
---|
1780 | .wr_data1 (wr_data1), |
---|
1781 | .wr_data2 (wr_data2), |
---|
1782 | .wr_data3 (wr_data3), |
---|
1783 | .rd_thread (thr_rs1[6:5]), |
---|
1784 | .rd_data (rd_data21)); |
---|
1785 | bw_r_irf_register register22( |
---|
1786 | .clk (clk), |
---|
1787 | .wrens (wrens[91:88]), |
---|
1788 | .save (swap_local_m_vld), |
---|
1789 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1790 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1791 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1792 | .wr_data0 (wr_data0), |
---|
1793 | .wr_data1 (wr_data1), |
---|
1794 | .wr_data2 (wr_data2), |
---|
1795 | .wr_data3 (wr_data3), |
---|
1796 | .rd_thread (thr_rs1[6:5]), |
---|
1797 | .rd_data (rd_data22)); |
---|
1798 | bw_r_irf_register register23( |
---|
1799 | .clk (clk), |
---|
1800 | .wrens (wrens[95:92]), |
---|
1801 | .save (swap_local_m_vld), |
---|
1802 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
1803 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
1804 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
1805 | .wr_data0 (wr_data0), |
---|
1806 | .wr_data1 (wr_data1), |
---|
1807 | .wr_data2 (wr_data2), |
---|
1808 | .wr_data3 (wr_data3), |
---|
1809 | .rd_thread (thr_rs1[6:5]), |
---|
1810 | .rd_data (rd_data23)); |
---|
1811 | |
---|
1812 | bw_r_irf_register register24( |
---|
1813 | .clk (clk), |
---|
1814 | .wrens (wrens[99:96]), |
---|
1815 | .save (swap_even_m_vld), |
---|
1816 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1817 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1818 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1819 | .wr_data0 (wr_data0), |
---|
1820 | .wr_data1 (wr_data1), |
---|
1821 | .wr_data2 (wr_data2), |
---|
1822 | .wr_data3 (wr_data3), |
---|
1823 | .rd_thread (thr_rs1[6:5]), |
---|
1824 | .rd_data (rd_data24)); |
---|
1825 | bw_r_irf_register register25( |
---|
1826 | .clk (clk), |
---|
1827 | .wrens (wrens[103:100]), |
---|
1828 | .save (swap_even_m_vld), |
---|
1829 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1830 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1831 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1832 | .wr_data0 (wr_data0), |
---|
1833 | .wr_data1 (wr_data1), |
---|
1834 | .wr_data2 (wr_data2), |
---|
1835 | .wr_data3 (wr_data3), |
---|
1836 | .rd_thread (thr_rs1[6:5]), |
---|
1837 | .rd_data (rd_data25)); |
---|
1838 | bw_r_irf_register register26( |
---|
1839 | .clk (clk), |
---|
1840 | .wrens (wrens[107:104]), |
---|
1841 | .save (swap_even_m_vld), |
---|
1842 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1843 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1844 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1845 | .wr_data0 (wr_data0), |
---|
1846 | .wr_data1 (wr_data1), |
---|
1847 | .wr_data2 (wr_data2), |
---|
1848 | .wr_data3 (wr_data3), |
---|
1849 | .rd_thread (thr_rs1[6:5]), |
---|
1850 | .rd_data (rd_data26)); |
---|
1851 | bw_r_irf_register register27( |
---|
1852 | .clk (clk), |
---|
1853 | .wrens (wrens[111:108]), |
---|
1854 | .save (swap_even_m_vld), |
---|
1855 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1856 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1857 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1858 | .wr_data0 (wr_data0), |
---|
1859 | .wr_data1 (wr_data1), |
---|
1860 | .wr_data2 (wr_data2), |
---|
1861 | .wr_data3 (wr_data3), |
---|
1862 | .rd_thread (thr_rs1[6:5]), |
---|
1863 | .rd_data (rd_data27)); |
---|
1864 | bw_r_irf_register register28( |
---|
1865 | .clk (clk), |
---|
1866 | .wrens (wrens[115:112]), |
---|
1867 | .save (swap_even_m_vld), |
---|
1868 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1869 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1870 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1871 | .wr_data0 (wr_data0), |
---|
1872 | .wr_data1 (wr_data1), |
---|
1873 | .wr_data2 (wr_data2), |
---|
1874 | .wr_data3 (wr_data3), |
---|
1875 | .rd_thread (thr_rs1[6:5]), |
---|
1876 | .rd_data (rd_data28)); |
---|
1877 | bw_r_irf_register register29( |
---|
1878 | .clk (clk), |
---|
1879 | .wrens (wrens[119:116]), |
---|
1880 | .save (swap_even_m_vld), |
---|
1881 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1882 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1883 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1884 | .wr_data0 (wr_data0), |
---|
1885 | .wr_data1 (wr_data1), |
---|
1886 | .wr_data2 (wr_data2), |
---|
1887 | .wr_data3 (wr_data3), |
---|
1888 | .rd_thread (thr_rs1[6:5]), |
---|
1889 | .rd_data (rd_data29)); |
---|
1890 | bw_r_irf_register register30( |
---|
1891 | .clk (clk), |
---|
1892 | .wrens (wrens[123:120]), |
---|
1893 | .save (swap_even_m_vld), |
---|
1894 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1895 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1896 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1897 | .wr_data0 (wr_data0), |
---|
1898 | .wr_data1 (wr_data1), |
---|
1899 | .wr_data2 (wr_data2), |
---|
1900 | .wr_data3 (wr_data3), |
---|
1901 | .rd_thread (thr_rs1[6:5]), |
---|
1902 | .rd_data (rd_data30)); |
---|
1903 | bw_r_irf_register register31( |
---|
1904 | .clk (clk), |
---|
1905 | .wrens (wrens[127:124]), |
---|
1906 | .save (swap_even_m_vld), |
---|
1907 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
1908 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
1909 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
1910 | .wr_data0 (wr_data0), |
---|
1911 | .wr_data1 (wr_data1), |
---|
1912 | .wr_data2 (wr_data2), |
---|
1913 | .wr_data3 (wr_data3), |
---|
1914 | .rd_thread (thr_rs1[6:5]), |
---|
1915 | .rd_data (rd_data31)); |
---|
1916 | |
---|
1917 | |
---|
1918 | always @(negedge clk) if (ifu_exu_ren1_d) begin |
---|
1919 | case (thr_rs1[4:0]) |
---|
1920 | 5'b0: |
---|
1921 | irf_byp_rs1_data_d <= rd_data00; |
---|
1922 | 5'b1: |
---|
1923 | irf_byp_rs1_data_d <= rd_data01; |
---|
1924 | 5'b00010: |
---|
1925 | irf_byp_rs1_data_d <= rd_data02; |
---|
1926 | 5'b00011: |
---|
1927 | irf_byp_rs1_data_d <= rd_data03; |
---|
1928 | 5'b00100: |
---|
1929 | irf_byp_rs1_data_d <= rd_data04; |
---|
1930 | 5'b00101: |
---|
1931 | irf_byp_rs1_data_d <= rd_data05; |
---|
1932 | 5'b00110: |
---|
1933 | irf_byp_rs1_data_d <= rd_data06; |
---|
1934 | 5'b00111: |
---|
1935 | irf_byp_rs1_data_d <= rd_data07; |
---|
1936 | 5'b01000: |
---|
1937 | irf_byp_rs1_data_d <= rd_data08; |
---|
1938 | 5'b01001: |
---|
1939 | irf_byp_rs1_data_d <= rd_data09; |
---|
1940 | 5'b01010: |
---|
1941 | irf_byp_rs1_data_d <= rd_data10; |
---|
1942 | 5'b01011: |
---|
1943 | irf_byp_rs1_data_d <= rd_data11; |
---|
1944 | 5'b01100: |
---|
1945 | irf_byp_rs1_data_d <= rd_data12; |
---|
1946 | 5'b01101: |
---|
1947 | irf_byp_rs1_data_d <= rd_data13; |
---|
1948 | 5'b01110: |
---|
1949 | irf_byp_rs1_data_d <= rd_data14; |
---|
1950 | 5'b01111: |
---|
1951 | irf_byp_rs1_data_d <= rd_data15; |
---|
1952 | 5'b10000: |
---|
1953 | irf_byp_rs1_data_d <= rd_data16; |
---|
1954 | 5'b10001: |
---|
1955 | irf_byp_rs1_data_d <= rd_data17; |
---|
1956 | 5'b10010: |
---|
1957 | irf_byp_rs1_data_d <= rd_data18; |
---|
1958 | 5'b10011: |
---|
1959 | irf_byp_rs1_data_d <= rd_data19; |
---|
1960 | 5'b10100: |
---|
1961 | irf_byp_rs1_data_d <= rd_data20; |
---|
1962 | 5'b10101: |
---|
1963 | irf_byp_rs1_data_d <= rd_data21; |
---|
1964 | 5'b10110: |
---|
1965 | irf_byp_rs1_data_d <= rd_data22; |
---|
1966 | 5'b10111: |
---|
1967 | irf_byp_rs1_data_d <= rd_data23; |
---|
1968 | 5'b11000: |
---|
1969 | irf_byp_rs1_data_d <= rd_data24; |
---|
1970 | 5'b11001: |
---|
1971 | irf_byp_rs1_data_d <= rd_data25; |
---|
1972 | 5'b11010: |
---|
1973 | irf_byp_rs1_data_d <= rd_data26; |
---|
1974 | 5'b11011: |
---|
1975 | irf_byp_rs1_data_d <= rd_data27; |
---|
1976 | 5'b11100: |
---|
1977 | irf_byp_rs1_data_d <= rd_data28; |
---|
1978 | 5'b11101: |
---|
1979 | irf_byp_rs1_data_d <= rd_data29; |
---|
1980 | 5'b11110: |
---|
1981 | irf_byp_rs1_data_d <= rd_data30; |
---|
1982 | 5'b11111: |
---|
1983 | irf_byp_rs1_data_d <= rd_data31; |
---|
1984 | endcase |
---|
1985 | end |
---|
1986 | always @(negedge clk) if (ifu_exu_ren2_d) begin |
---|
1987 | case (thr_rs2[4:0]) |
---|
1988 | 5'b0: |
---|
1989 | irf_byp_rs2_data_d <= rd_data00; |
---|
1990 | 5'b1: |
---|
1991 | irf_byp_rs2_data_d <= rd_data01; |
---|
1992 | 5'b00010: |
---|
1993 | irf_byp_rs2_data_d <= rd_data02; |
---|
1994 | 5'b00011: |
---|
1995 | irf_byp_rs2_data_d <= rd_data03; |
---|
1996 | 5'b00100: |
---|
1997 | irf_byp_rs2_data_d <= rd_data04; |
---|
1998 | 5'b00101: |
---|
1999 | irf_byp_rs2_data_d <= rd_data05; |
---|
2000 | 5'b00110: |
---|
2001 | irf_byp_rs2_data_d <= rd_data06; |
---|
2002 | 5'b00111: |
---|
2003 | irf_byp_rs2_data_d <= rd_data07; |
---|
2004 | 5'b01000: |
---|
2005 | irf_byp_rs2_data_d <= rd_data08; |
---|
2006 | 5'b01001: |
---|
2007 | irf_byp_rs2_data_d <= rd_data09; |
---|
2008 | 5'b01010: |
---|
2009 | irf_byp_rs2_data_d <= rd_data10; |
---|
2010 | 5'b01011: |
---|
2011 | irf_byp_rs2_data_d <= rd_data11; |
---|
2012 | 5'b01100: |
---|
2013 | irf_byp_rs2_data_d <= rd_data12; |
---|
2014 | 5'b01101: |
---|
2015 | irf_byp_rs2_data_d <= rd_data13; |
---|
2016 | 5'b01110: |
---|
2017 | irf_byp_rs2_data_d <= rd_data14; |
---|
2018 | 5'b01111: |
---|
2019 | irf_byp_rs2_data_d <= rd_data15; |
---|
2020 | 5'b10000: |
---|
2021 | irf_byp_rs2_data_d <= rd_data16; |
---|
2022 | 5'b10001: |
---|
2023 | irf_byp_rs2_data_d <= rd_data17; |
---|
2024 | 5'b10010: |
---|
2025 | irf_byp_rs2_data_d <= rd_data18; |
---|
2026 | 5'b10011: |
---|
2027 | irf_byp_rs2_data_d <= rd_data19; |
---|
2028 | 5'b10100: |
---|
2029 | irf_byp_rs2_data_d <= rd_data20; |
---|
2030 | 5'b10101: |
---|
2031 | irf_byp_rs2_data_d <= rd_data21; |
---|
2032 | 5'b10110: |
---|
2033 | irf_byp_rs2_data_d <= rd_data22; |
---|
2034 | 5'b10111: |
---|
2035 | irf_byp_rs2_data_d <= rd_data23; |
---|
2036 | 5'b11000: |
---|
2037 | irf_byp_rs2_data_d <= rd_data24; |
---|
2038 | 5'b11001: |
---|
2039 | irf_byp_rs2_data_d <= rd_data25; |
---|
2040 | 5'b11010: |
---|
2041 | irf_byp_rs2_data_d <= rd_data26; |
---|
2042 | 5'b11011: |
---|
2043 | irf_byp_rs2_data_d <= rd_data27; |
---|
2044 | 5'b11100: |
---|
2045 | irf_byp_rs2_data_d <= rd_data28; |
---|
2046 | 5'b11101: |
---|
2047 | irf_byp_rs2_data_d <= rd_data29; |
---|
2048 | 5'b11110: |
---|
2049 | irf_byp_rs2_data_d <= rd_data30; |
---|
2050 | 5'b11111: |
---|
2051 | irf_byp_rs2_data_d <= rd_data31; |
---|
2052 | endcase |
---|
2053 | end |
---|
2054 | always @(negedge clk) if (ifu_exu_ren3_d) begin |
---|
2055 | case (thr_rs3[4:0]) |
---|
2056 | 5'b0: |
---|
2057 | irf_byp_rs3_data_d <= rd_data00; |
---|
2058 | 5'b1: |
---|
2059 | irf_byp_rs3_data_d <= rd_data01; |
---|
2060 | 5'b00010: |
---|
2061 | irf_byp_rs3_data_d <= rd_data02; |
---|
2062 | 5'b00011: |
---|
2063 | irf_byp_rs3_data_d <= rd_data03; |
---|
2064 | 5'b00100: |
---|
2065 | irf_byp_rs3_data_d <= rd_data04; |
---|
2066 | 5'b00101: |
---|
2067 | irf_byp_rs3_data_d <= rd_data05; |
---|
2068 | 5'b00110: |
---|
2069 | irf_byp_rs3_data_d <= rd_data06; |
---|
2070 | 5'b00111: |
---|
2071 | irf_byp_rs3_data_d <= rd_data07; |
---|
2072 | 5'b01000: |
---|
2073 | irf_byp_rs3_data_d <= rd_data08; |
---|
2074 | 5'b01001: |
---|
2075 | irf_byp_rs3_data_d <= rd_data09; |
---|
2076 | 5'b01010: |
---|
2077 | irf_byp_rs3_data_d <= rd_data10; |
---|
2078 | 5'b01011: |
---|
2079 | irf_byp_rs3_data_d <= rd_data11; |
---|
2080 | 5'b01100: |
---|
2081 | irf_byp_rs3_data_d <= rd_data12; |
---|
2082 | 5'b01101: |
---|
2083 | irf_byp_rs3_data_d <= rd_data13; |
---|
2084 | 5'b01110: |
---|
2085 | irf_byp_rs3_data_d <= rd_data14; |
---|
2086 | 5'b01111: |
---|
2087 | irf_byp_rs3_data_d <= rd_data15; |
---|
2088 | 5'b10000: |
---|
2089 | irf_byp_rs3_data_d <= rd_data16; |
---|
2090 | 5'b10001: |
---|
2091 | irf_byp_rs3_data_d <= rd_data17; |
---|
2092 | 5'b10010: |
---|
2093 | irf_byp_rs3_data_d <= rd_data18; |
---|
2094 | 5'b10011: |
---|
2095 | irf_byp_rs3_data_d <= rd_data19; |
---|
2096 | 5'b10100: |
---|
2097 | irf_byp_rs3_data_d <= rd_data20; |
---|
2098 | 5'b10101: |
---|
2099 | irf_byp_rs3_data_d <= rd_data21; |
---|
2100 | 5'b10110: |
---|
2101 | irf_byp_rs3_data_d <= rd_data22; |
---|
2102 | 5'b10111: |
---|
2103 | irf_byp_rs3_data_d <= rd_data23; |
---|
2104 | 5'b11000: |
---|
2105 | irf_byp_rs3_data_d <= rd_data24; |
---|
2106 | 5'b11001: |
---|
2107 | irf_byp_rs3_data_d <= rd_data25; |
---|
2108 | 5'b11010: |
---|
2109 | irf_byp_rs3_data_d <= rd_data26; |
---|
2110 | 5'b11011: |
---|
2111 | irf_byp_rs3_data_d <= rd_data27; |
---|
2112 | 5'b11100: |
---|
2113 | irf_byp_rs3_data_d <= rd_data28; |
---|
2114 | 5'b11101: |
---|
2115 | irf_byp_rs3_data_d <= rd_data29; |
---|
2116 | 5'b11110: |
---|
2117 | irf_byp_rs3_data_d <= rd_data30; |
---|
2118 | 5'b11111: |
---|
2119 | irf_byp_rs3_data_d <= rd_data31; |
---|
2120 | endcase |
---|
2121 | end |
---|
2122 | always @(negedge clk) if (ifu_exu_ren3_d) begin |
---|
2123 | case (thr_rs3h[4:1]) |
---|
2124 | 4'b0: |
---|
2125 | irf_byp_rs3h_data_d <= rd_data01; |
---|
2126 | 4'b1: |
---|
2127 | irf_byp_rs3h_data_d <= rd_data03; |
---|
2128 | 4'b0010: |
---|
2129 | irf_byp_rs3h_data_d <= rd_data05; |
---|
2130 | 4'b0011: |
---|
2131 | irf_byp_rs3h_data_d <= rd_data07; |
---|
2132 | 4'b0100: |
---|
2133 | irf_byp_rs3h_data_d <= rd_data09; |
---|
2134 | 4'b0101: |
---|
2135 | irf_byp_rs3h_data_d <= rd_data11; |
---|
2136 | 4'b0110: |
---|
2137 | irf_byp_rs3h_data_d <= rd_data13; |
---|
2138 | 4'b0111: |
---|
2139 | irf_byp_rs3h_data_d <= rd_data15; |
---|
2140 | 4'b1000: |
---|
2141 | irf_byp_rs3h_data_d <= rd_data17; |
---|
2142 | 4'b1001: |
---|
2143 | irf_byp_rs3h_data_d <= rd_data19; |
---|
2144 | 4'b1010: |
---|
2145 | irf_byp_rs3h_data_d <= rd_data21; |
---|
2146 | 4'b1011: |
---|
2147 | irf_byp_rs3h_data_d <= rd_data23; |
---|
2148 | 4'b1100: |
---|
2149 | irf_byp_rs3h_data_d <= rd_data25; |
---|
2150 | 4'b1101: |
---|
2151 | irf_byp_rs3h_data_d <= rd_data27; |
---|
2152 | 4'b1110: |
---|
2153 | irf_byp_rs3h_data_d <= rd_data29; |
---|
2154 | 4'b1111: |
---|
2155 | irf_byp_rs3h_data_d <= rd_data31; |
---|
2156 | endcase |
---|
2157 | end |
---|
2158 | endmodule |
---|
2159 | |
---|
2160 | `endif |
---|
2161 | `else |
---|
2162 | |
---|
2163 | module bw_r_irf (/*AUTOARG*/ |
---|
2164 | // Outputs |
---|
2165 | so, irf_byp_rs1_data_d_l, irf_byp_rs2_data_d_l, |
---|
2166 | irf_byp_rs3_data_d_l, irf_byp_rs3h_data_d_l, |
---|
2167 | // Inputs |
---|
2168 | rclk, reset_l, si, se, sehold, rst_tri_en, ifu_exu_tid_s2, |
---|
2169 | ifu_exu_rs1_s, ifu_exu_rs2_s, ifu_exu_rs3_s, ifu_exu_ren1_s, |
---|
2170 | ifu_exu_ren2_s, ifu_exu_ren3_s, ecl_irf_wen_w, ecl_irf_wen_w2, |
---|
2171 | ecl_irf_rd_m, ecl_irf_rd_g, byp_irf_rd_data_w, byp_irf_rd_data_w2, |
---|
2172 | ecl_irf_tid_m, ecl_irf_tid_g, rml_irf_old_lo_cwp_e, |
---|
2173 | rml_irf_new_lo_cwp_e, rml_irf_old_e_cwp_e, rml_irf_new_e_cwp_e, |
---|
2174 | rml_irf_swap_even_e, rml_irf_swap_odd_e, rml_irf_swap_local_e, |
---|
2175 | rml_irf_kill_restore_w, rml_irf_cwpswap_tid_e, rml_irf_old_agp, |
---|
2176 | rml_irf_new_agp, rml_irf_swap_global, rml_irf_global_tid |
---|
2177 | ) ; |
---|
2178 | input rclk; |
---|
2179 | input reset_l; |
---|
2180 | input si; |
---|
2181 | input se; |
---|
2182 | input sehold; |
---|
2183 | input rst_tri_en; |
---|
2184 | input [1:0] ifu_exu_tid_s2; // s stage thread |
---|
2185 | input [4:0] ifu_exu_rs1_s; // source addresses |
---|
2186 | input [4:0] ifu_exu_rs2_s; |
---|
2187 | input [4:0] ifu_exu_rs3_s; |
---|
2188 | input ifu_exu_ren1_s; // read enables for all 3 ports |
---|
2189 | input ifu_exu_ren2_s; |
---|
2190 | input ifu_exu_ren3_s; |
---|
2191 | input ecl_irf_wen_w; // write enables for both write ports |
---|
2192 | input ecl_irf_wen_w2; |
---|
2193 | input [4:0] ecl_irf_rd_m; // w destination |
---|
2194 | input [4:0] ecl_irf_rd_g; // w2 destination |
---|
2195 | input [71:0] byp_irf_rd_data_w;// write data from w1 |
---|
2196 | input [71:0] byp_irf_rd_data_w2; // write data from w2 |
---|
2197 | input [1:0] ecl_irf_tid_m; // w stage thread |
---|
2198 | input [1:0] ecl_irf_tid_g; // w2 thread |
---|
2199 | |
---|
2200 | input [2:0] rml_irf_old_lo_cwp_e; // current window pointer for locals and odds |
---|
2201 | input [2:0] rml_irf_new_lo_cwp_e; // target window pointer for locals and odds |
---|
2202 | input [2:1] rml_irf_old_e_cwp_e; // current window pointer for evens |
---|
2203 | input [2:1] rml_irf_new_e_cwp_e; // target window pointer for evens |
---|
2204 | input rml_irf_swap_even_e; |
---|
2205 | input rml_irf_swap_odd_e; |
---|
2206 | input rml_irf_swap_local_e; |
---|
2207 | input rml_irf_kill_restore_w; |
---|
2208 | input [1:0] rml_irf_cwpswap_tid_e; |
---|
2209 | |
---|
2210 | input [1:0] rml_irf_old_agp; // alternate global pointer |
---|
2211 | input [1:0] rml_irf_new_agp; // alternate global pointer |
---|
2212 | input rml_irf_swap_global; |
---|
2213 | input [1:0] rml_irf_global_tid; |
---|
2214 | |
---|
2215 | output so; |
---|
2216 | output [71:0] irf_byp_rs1_data_d_l; |
---|
2217 | output [71:0] irf_byp_rs2_data_d_l; |
---|
2218 | output [71:0] irf_byp_rs3_data_d_l; |
---|
2219 | output [31:0] irf_byp_rs3h_data_d_l; |
---|
2220 | reg [71:0] irf_byp_rs1_data_d; |
---|
2221 | reg [71:0] irf_byp_rs2_data_d; |
---|
2222 | reg [71:0] irf_byp_rs3_data_d; |
---|
2223 | reg [71:0] irf_byp_rs3h_data_d; |
---|
2224 | |
---|
2225 | reg [71:0] active_window [127:0];// 32x4 72 bit registers |
---|
2226 | reg [71:0] locals[255:0]; // 4x8x8 registers |
---|
2227 | reg [71:0] evens[127:0]; // 4x4x8 registers |
---|
2228 | reg [71:0] odds[127:0]; // 4x4x8 registers |
---|
2229 | reg [71:0] globals[127:0]; // 4x4x8 registers |
---|
2230 | // registers for manipulating windows |
---|
2231 | reg [6:0] active_pointer; |
---|
2232 | reg [7:0] regfile_pointer; |
---|
2233 | reg [5:0] i; |
---|
2234 | |
---|
2235 | wire [1:0] ecl_irf_tid_w; // w stage thread |
---|
2236 | wire [1:0] ecl_irf_tid_w2; // w2 thread |
---|
2237 | wire [4:0] ecl_irf_rd_w; // w destination |
---|
2238 | wire [4:0] ecl_irf_rd_w2; // w2 destination |
---|
2239 | wire [1:0] ifu_exu_thr_d; // d stage thread |
---|
2240 | wire ifu_exu_ren1_d; // read enables for all 3 ports |
---|
2241 | wire ifu_exu_ren2_d; |
---|
2242 | wire ifu_exu_ren3_d; |
---|
2243 | wire [4:0] ifu_exu_rs1_d; // source addresses |
---|
2244 | wire [4:0] ifu_exu_rs2_d; |
---|
2245 | wire [4:0] ifu_exu_rs3_d; |
---|
2246 | wire [6:0] thr_rs1; // these 5 are a combination of the thr and reg |
---|
2247 | wire [6:0] thr_rs2; // so that comparison can be done more easily |
---|
2248 | wire [6:0] thr_rs3; |
---|
2249 | wire [6:0] thr_rs3h; |
---|
2250 | wire [6:0] thr_rd_w; |
---|
2251 | wire [6:0] thr_rd_w2; |
---|
2252 | |
---|
2253 | reg [1:0] cwpswap_tid_m; |
---|
2254 | reg [1:0] cwpswap_tid_w; |
---|
2255 | reg [2:0] old_lo_cwp_m; |
---|
2256 | reg [2:0] new_lo_cwp_m; |
---|
2257 | reg [2:0] new_lo_cwp_w; |
---|
2258 | reg [1:0] old_e_cwp_m; |
---|
2259 | reg [1:0] new_e_cwp_m; |
---|
2260 | reg [1:0] new_e_cwp_w; |
---|
2261 | reg swap_local_m; |
---|
2262 | reg swap_local_w; |
---|
2263 | reg swap_even_m; |
---|
2264 | reg swap_even_w; |
---|
2265 | reg swap_odd_m; |
---|
2266 | reg swap_odd_w; |
---|
2267 | reg kill_restore_d1; |
---|
2268 | reg swap_global_d1; |
---|
2269 | reg swap_global_d2; |
---|
2270 | reg [1:0] global_tid_d1; |
---|
2271 | reg [1:0] global_tid_d2; |
---|
2272 | reg [1:0] old_agp_d1, |
---|
2273 | new_agp_d1, |
---|
2274 | new_agp_d2; |
---|
2275 | |
---|
2276 | reg [71:0] active_win_thr_rd_w_neg; |
---|
2277 | reg active_win_thr_rd_w_neg_wr_en; |
---|
2278 | reg [6:0] thr_rd_w_neg; |
---|
2279 | reg [71:0] active_win_thr_rd_w2_neg; |
---|
2280 | reg active_win_thr_rd_w2_neg_wr_en; |
---|
2281 | reg [6:0] thr_rd_w2_neg; |
---|
2282 | reg rst_tri_en_neg; |
---|
2283 | |
---|
2284 | wire se; |
---|
2285 | wire clk; |
---|
2286 | assign clk = rclk & reset_l; |
---|
2287 | wire ren1_s; |
---|
2288 | wire ren2_s; |
---|
2289 | wire ren3_s; |
---|
2290 | wire [4:0] rs1_s; |
---|
2291 | wire [4:0] rs2_s; |
---|
2292 | wire [4:0] rs3_s; |
---|
2293 | wire [1:0] tid_s; |
---|
2294 | wire [1:0] tid_g; |
---|
2295 | wire [1:0] tid_m; |
---|
2296 | wire [4:0] rd_m; |
---|
2297 | wire [4:0] rd_g; |
---|
2298 | wire kill_restore_w; |
---|
2299 | wire swap_global_d1_vld; |
---|
2300 | wire swap_local_m_vld; |
---|
2301 | wire swap_even_m_vld; |
---|
2302 | wire swap_odd_m_vld; |
---|
2303 | |
---|
2304 | assign {ren1_s,ren2_s,ren3_s,rs1_s[4:0],rs2_s[4:0],rs3_s[4:0],tid_s[1:0],tid_g[1:0],tid_m[1:0], |
---|
2305 | rd_m[4:0], rd_g[4:0]} = (sehold)? |
---|
2306 | {ifu_exu_ren1_d,ifu_exu_ren2_d,ifu_exu_ren3_d,ifu_exu_rs1_d[4:0],ifu_exu_rs2_d[4:0], |
---|
2307 | ifu_exu_rs3_d[4:0],ifu_exu_thr_d[1:0],ecl_irf_tid_w2[1:0],ecl_irf_tid_w[1:0], |
---|
2308 | ecl_irf_rd_w[4:0],ecl_irf_rd_w2[4:0]}: |
---|
2309 | {ifu_exu_ren1_s,ifu_exu_ren2_s,ifu_exu_ren3_s,ifu_exu_rs1_s[4:0],ifu_exu_rs2_s[4:0], |
---|
2310 | ifu_exu_rs3_s[4:0],ifu_exu_tid_s2[1:0],ecl_irf_tid_g[1:0],ecl_irf_tid_m[1:0], |
---|
2311 | ecl_irf_rd_m[4:0],ecl_irf_rd_g[4:0]}; |
---|
2312 | // Pipeline flops for irf control signals |
---|
2313 | dff_s dff_ren1_s2d(.din(ren1_s), .clk(clk), .q(ifu_exu_ren1_d), .se(se), |
---|
2314 | .si(), .so()); |
---|
2315 | dff_s dff_ren2_s2d(.din(ren2_s), .clk(clk), .q(ifu_exu_ren2_d), .se(se), |
---|
2316 | .si(), .so()); |
---|
2317 | dff_s dff_ren3_s2d(.din(ren3_s), .clk(clk), .q(ifu_exu_ren3_d), .se(se), |
---|
2318 | .si(), .so()); |
---|
2319 | dff_s #5 dff_rs1_s2d(.din(rs1_s[4:0]), .clk(clk), .q(ifu_exu_rs1_d[4:0]), .se(se), |
---|
2320 | .si(),.so()); |
---|
2321 | dff_s #5 dff_rs2_s2d(.din(rs2_s[4:0]), .clk(clk), .q(ifu_exu_rs2_d[4:0]), .se(se), |
---|
2322 | .si(),.so()); |
---|
2323 | dff_s #5 dff_rs3_s2d(.din(rs3_s[4:0]), .clk(clk), .q(ifu_exu_rs3_d[4:0]), .se(se), |
---|
2324 | .si(),.so()); |
---|
2325 | dff_s #2 dff_thr_s2d(.din(tid_s[1:0]), .clk(clk), .q(ifu_exu_thr_d[1:0]), .se(se), |
---|
2326 | .si(),.so()); |
---|
2327 | dff_s #2 dff_thr_g2w2(.din(tid_g[1:0]), .clk(clk), .q(ecl_irf_tid_w2[1:0]), .se(se), |
---|
2328 | .si(),.so()); |
---|
2329 | dff_s #2 dff_thr_m2w(.din(tid_m[1:0]), .clk(clk), .q(ecl_irf_tid_w[1:0]), .se(se), |
---|
2330 | .si(),.so()); |
---|
2331 | dff_s #5 dff_rd_m2w(.din(rd_m[4:0]), .clk(clk), .q(ecl_irf_rd_w[4:0]), .se(se), |
---|
2332 | .si(),.so()); |
---|
2333 | dff_s #5 dff_rd_g2w2(.din(rd_g[4:0]), .clk(clk), .q(ecl_irf_rd_w2[4:0]), .se(se), |
---|
2334 | .si(),.so()); |
---|
2335 | |
---|
2336 | // Concatenate the thread and rs1/rd bits together |
---|
2337 | assign thr_rs1[6:0] = {ifu_exu_thr_d, ifu_exu_rs1_d}; |
---|
2338 | assign thr_rs2[6:0] = {ifu_exu_thr_d, ifu_exu_rs2_d}; |
---|
2339 | assign thr_rs3[6:0] = {ifu_exu_thr_d, ifu_exu_rs3_d[4:0]}; |
---|
2340 | assign thr_rs3h[6:0] = {ifu_exu_thr_d[1:0], ifu_exu_rs3_d[4:1], 1'b1}; |
---|
2341 | assign thr_rd_w[6:0] = {ecl_irf_tid_w, ecl_irf_rd_w}; |
---|
2342 | assign thr_rd_w2[6:0] = {ecl_irf_tid_w2, ecl_irf_rd_w2}; |
---|
2343 | |
---|
2344 | // Active low outputs |
---|
2345 | assign irf_byp_rs1_data_d_l[71:0] = ~irf_byp_rs1_data_d[71:0]; |
---|
2346 | assign irf_byp_rs2_data_d_l[71:0] = ~irf_byp_rs2_data_d[71:0]; |
---|
2347 | assign irf_byp_rs3_data_d_l[71:0] = ~irf_byp_rs3_data_d[71:0]; |
---|
2348 | assign irf_byp_rs3h_data_d_l[31:0] = ~irf_byp_rs3h_data_d[31:0]; |
---|
2349 | |
---|
2350 | // Read port 1 |
---|
2351 | always @ ( clk ) begin |
---|
2352 | if (clk) irf_byp_rs1_data_d <= {72{1'bx}}; |
---|
2353 | else begin |
---|
2354 | if (ifu_exu_ren1_d) begin // read enable must be high |
---|
2355 | if (thr_rs1[4:0] == 5'b0) irf_byp_rs1_data_d <= {72{1'b0}}; |
---|
2356 | else begin |
---|
2357 | if ((ecl_irf_wen_w && (thr_rs1 == thr_rd_w)) || // check r/w conflict |
---|
2358 | (ecl_irf_wen_w2 && (thr_rs1 == thr_rd_w2))) begin |
---|
2359 | irf_byp_rs1_data_d <= {72{1'bx}}; // rw conflict gives x |
---|
2360 | end |
---|
2361 | else begin |
---|
2362 | irf_byp_rs1_data_d <= active_window[thr_rs1[6:0]]; |
---|
2363 | end |
---|
2364 | end |
---|
2365 | end |
---|
2366 | // output disabled |
---|
2367 | else begin |
---|
2368 | irf_byp_rs1_data_d <= {72{1'bx}}; |
---|
2369 | end |
---|
2370 | end |
---|
2371 | end |
---|
2372 | |
---|
2373 | // Read port 2 |
---|
2374 | always @ ( clk ) begin |
---|
2375 | if (clk) irf_byp_rs2_data_d <= {72{1'bx}}; |
---|
2376 | else begin |
---|
2377 | if (ifu_exu_ren2_d) begin |
---|
2378 | if (thr_rs2[4:0] == 5'b0) irf_byp_rs2_data_d <= {72{1'b0}}; |
---|
2379 | else if ((ecl_irf_wen_w && (thr_rs2 == thr_rd_w)) || |
---|
2380 | (ecl_irf_wen_w2 && (thr_rs2 == thr_rd_w2))) |
---|
2381 | irf_byp_rs2_data_d <= {72{1'bx}}; |
---|
2382 | else begin |
---|
2383 | irf_byp_rs2_data_d <= active_window[thr_rs2]; |
---|
2384 | end |
---|
2385 | end |
---|
2386 | // output disabled |
---|
2387 | else irf_byp_rs2_data_d <= {72{1'bx}}; |
---|
2388 | end |
---|
2389 | end |
---|
2390 | |
---|
2391 | // Read port 3 |
---|
2392 | always @ ( clk ) begin |
---|
2393 | if (clk) irf_byp_rs3_data_d <= {72{1'bx}}; |
---|
2394 | else begin |
---|
2395 | if (ifu_exu_ren3_d) begin |
---|
2396 | if (thr_rs3[4:0] == 5'b0) irf_byp_rs3_data_d[71:0] <= {72{1'b0}}; |
---|
2397 | else if ((ecl_irf_wen_w && (thr_rs3 == thr_rd_w)) || |
---|
2398 | (ecl_irf_wen_w2 && (thr_rs3 == thr_rd_w2))) |
---|
2399 | begin |
---|
2400 | irf_byp_rs3_data_d[71:0] <= {72{1'bx}}; |
---|
2401 | end |
---|
2402 | else begin |
---|
2403 | irf_byp_rs3_data_d[71:0] <= active_window[thr_rs3]; |
---|
2404 | end |
---|
2405 | end |
---|
2406 | // output disabled |
---|
2407 | else begin |
---|
2408 | irf_byp_rs3_data_d[71:0] <= {72{1'bx}}; |
---|
2409 | end |
---|
2410 | end |
---|
2411 | end |
---|
2412 | |
---|
2413 | // Read port 3h |
---|
2414 | always @ ( clk ) begin |
---|
2415 | if (clk) irf_byp_rs3h_data_d[71:0] <= {72{1'bx}}; |
---|
2416 | else begin |
---|
2417 | if (ifu_exu_ren3_d) begin |
---|
2418 | if (thr_rs3h[4:0] == 5'b0) irf_byp_rs3h_data_d[71:0] <= 72'b0; |
---|
2419 | else if ((ecl_irf_wen_w && (thr_rs3h == thr_rd_w)) || |
---|
2420 | (ecl_irf_wen_w2 && (thr_rs3h == thr_rd_w2))) |
---|
2421 | begin |
---|
2422 | irf_byp_rs3h_data_d[71:0] <= {72{1'bx}}; |
---|
2423 | end |
---|
2424 | else begin |
---|
2425 | irf_byp_rs3h_data_d[71:0] <= active_window[thr_rs3h]; |
---|
2426 | end |
---|
2427 | end |
---|
2428 | // output disabled |
---|
2429 | else begin |
---|
2430 | irf_byp_rs3h_data_d[71:0] <= {72{1'bx}}; |
---|
2431 | end |
---|
2432 | end |
---|
2433 | end |
---|
2434 | |
---|
2435 | ///////////////////////////////////////////////////////////////// |
---|
2436 | /// Write ports |
---|
2437 | //////////////////////////////////////////////////////////////// |
---|
2438 | // This is a latch that works if both wen is high and clk is low |
---|
2439 | |
---|
2440 | always @(negedge clk) begin |
---|
2441 | rst_tri_en_neg <= rst_tri_en; |
---|
2442 | // write conflict results in X written to destination |
---|
2443 | if (ecl_irf_wen_w & ecl_irf_wen_w2 & (thr_rd_w[6:0] == thr_rd_w2[6:0])) begin |
---|
2444 | active_win_thr_rd_w_neg <= {72{1'bx}}; |
---|
2445 | thr_rd_w_neg <= thr_rd_w; |
---|
2446 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
2447 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
2448 | end |
---|
2449 | else begin |
---|
2450 | // W1 write port |
---|
2451 | if (ecl_irf_wen_w & (thr_rd_w[4:0] != 5'b0)) begin |
---|
2452 | active_win_thr_rd_w_neg <= byp_irf_rd_data_w; |
---|
2453 | thr_rd_w_neg <= thr_rd_w; |
---|
2454 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
2455 | end |
---|
2456 | else |
---|
2457 | active_win_thr_rd_w_neg_wr_en <= 1'b0; |
---|
2458 | |
---|
2459 | // W2 write port |
---|
2460 | if (ecl_irf_wen_w2 & (thr_rd_w2[4:0] != 5'b0)) begin |
---|
2461 | active_win_thr_rd_w2_neg <= byp_irf_rd_data_w2; |
---|
2462 | thr_rd_w2_neg <= thr_rd_w2; |
---|
2463 | active_win_thr_rd_w2_neg_wr_en <= 1'b1; |
---|
2464 | end |
---|
2465 | else |
---|
2466 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
2467 | end |
---|
2468 | end |
---|
2469 | |
---|
2470 | |
---|
2471 | |
---|
2472 | /* MOVED TO CMP ENVIRONMENT |
---|
2473 | initial begin |
---|
2474 | // Hardcode R0 to zero |
---|
2475 | active_window[{2'b00, 5'b00000}] = 72'b0; |
---|
2476 | active_window[{2'b01, 5'b00000}] = 72'b0; |
---|
2477 | active_window[{2'b10, 5'b00000}] = 72'b0; |
---|
2478 | active_window[{2'b11, 5'b00000}] = 72'b0; |
---|
2479 | end |
---|
2480 | */ |
---|
2481 | ////////////////////////////////////////////////// |
---|
2482 | // Window management logic |
---|
2483 | ////////////////////////////////////////////////// |
---|
2484 | // Pipeline flops for control signals |
---|
2485 | |
---|
2486 | // cwp swap signals |
---|
2487 | assign kill_restore_w = (sehold)? kill_restore_d1: rml_irf_kill_restore_w; |
---|
2488 | assign swap_local_m_vld = swap_local_m & ~rst_tri_en; |
---|
2489 | assign swap_odd_m_vld = swap_odd_m & ~rst_tri_en; |
---|
2490 | assign swap_even_m_vld = swap_even_m & ~rst_tri_en; |
---|
2491 | assign swap_global_d1_vld = swap_global_d1 & ~rst_tri_en; |
---|
2492 | |
---|
2493 | always @ (posedge clk) begin |
---|
2494 | cwpswap_tid_m[1:0] <= (sehold)? cwpswap_tid_m[1:0]: rml_irf_cwpswap_tid_e[1:0]; |
---|
2495 | cwpswap_tid_w[1:0] <= cwpswap_tid_m[1:0]; |
---|
2496 | old_lo_cwp_m[2:0] <= (sehold)? old_lo_cwp_m[2:0]: rml_irf_old_lo_cwp_e[2:0]; |
---|
2497 | new_lo_cwp_m[2:0] <= (sehold)? new_lo_cwp_m[2:0]: rml_irf_new_lo_cwp_e[2:0]; |
---|
2498 | new_lo_cwp_w[2:0] <= new_lo_cwp_m[2:0]; |
---|
2499 | old_e_cwp_m[1:0] <= (sehold)? old_e_cwp_m[1:0]: rml_irf_old_e_cwp_e[2:1]; |
---|
2500 | new_e_cwp_m[1:0] <= (sehold)? new_e_cwp_m[1:0]: rml_irf_new_e_cwp_e[2:1]; |
---|
2501 | new_e_cwp_w[1:0] <= new_e_cwp_m[1:0]; |
---|
2502 | swap_local_m <= (sehold)? swap_local_m & rst_tri_en: rml_irf_swap_local_e; |
---|
2503 | swap_local_w <= swap_local_m_vld; |
---|
2504 | swap_odd_m <= (sehold)? swap_odd_m & rst_tri_en: rml_irf_swap_odd_e; |
---|
2505 | swap_odd_w <= swap_odd_m_vld; |
---|
2506 | swap_even_m <= (sehold)? swap_even_m & rst_tri_en: rml_irf_swap_even_e; |
---|
2507 | swap_even_w <= swap_even_m_vld; |
---|
2508 | kill_restore_d1 <= kill_restore_w; |
---|
2509 | end |
---|
2510 | // global swap signals |
---|
2511 | always @ (posedge clk) begin |
---|
2512 | swap_global_d1 <= (sehold)? swap_global_d1 & rst_tri_en: rml_irf_swap_global; |
---|
2513 | swap_global_d2 <= swap_global_d1_vld; |
---|
2514 | global_tid_d1[1:0] <= (sehold)? global_tid_d1[1:0]: rml_irf_global_tid[1:0]; |
---|
2515 | global_tid_d2[1:0] <= global_tid_d1[1:0]; |
---|
2516 | old_agp_d1[1:0] <= (sehold)? old_agp_d1[1:0]: rml_irf_old_agp[1:0]; |
---|
2517 | new_agp_d1[1:0] <= (sehold)? new_agp_d1[1:0]: rml_irf_new_agp[1:0]; |
---|
2518 | new_agp_d2[1:0] <= new_agp_d1[1:0]; |
---|
2519 | end |
---|
2520 | |
---|
2521 | |
---|
2522 | ///////////////////////////////////////////// |
---|
2523 | // Globals |
---|
2524 | //----------------------------------- |
---|
2525 | // rml inputs are latched on rising edge |
---|
2526 | // 1st cycle used for decode |
---|
2527 | // 2nd cycle stores active window in phase 1 |
---|
2528 | // 3rd cycle loads new globals in phase 1 |
---|
2529 | ///////////////////////////////////////////// |
---|
2530 | |
---|
2531 | always @ (posedge clk) begin |
---|
2532 | |
---|
2533 | if (active_win_thr_rd_w_neg_wr_en & (~rst_tri_en | ~rst_tri_en_neg)) begin |
---|
2534 | active_window[thr_rd_w_neg] = active_win_thr_rd_w_neg; |
---|
2535 | end |
---|
2536 | if (active_win_thr_rd_w2_neg_wr_en & (~rst_tri_en | ~rst_tri_en_neg)) begin |
---|
2537 | active_window[thr_rd_w2_neg] = active_win_thr_rd_w2_neg; |
---|
2538 | end |
---|
2539 | // save active globals in phase 1 |
---|
2540 | if (swap_global_d1_vld) begin |
---|
2541 | for (i = 6'd0; i < 6'd8; i = i + 1) begin |
---|
2542 | active_pointer[6:0] = {global_tid_d1[1:0], i[4:0]}; |
---|
2543 | regfile_pointer[7:0] = {1'b0, global_tid_d1[1:0], old_agp_d1[1:0], i[2:0]}; |
---|
2544 | // prevent back to back swaps on same thread |
---|
2545 | if (swap_global_d2 & (global_tid_d1[1:0] == global_tid_d2[1:0])) begin |
---|
2546 | globals[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
2547 | end |
---|
2548 | else globals[regfile_pointer[6:0]] = active_window[active_pointer[6:0]]; |
---|
2549 | end |
---|
2550 | end |
---|
2551 | |
---|
2552 | // load in new active globals in phase 2 |
---|
2553 | if (swap_global_d2) begin |
---|
2554 | for (i = 6'd0; i < 6'd8; i = i + 1) begin |
---|
2555 | active_pointer[6:0] = {global_tid_d2[1:0], i[4:0]}; |
---|
2556 | regfile_pointer[7:0] = {1'b0, global_tid_d2[1:0], new_agp_d2[1:0], i[2:0]}; |
---|
2557 | if (swap_global_d1_vld & (global_tid_d1[1:0] == global_tid_d2[1:0])) begin |
---|
2558 | active_window[active_pointer] = {72{1'bx}}; |
---|
2559 | globals[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
2560 | end |
---|
2561 | else active_window[active_pointer] = globals[regfile_pointer[6:0]]; |
---|
2562 | end |
---|
2563 | end |
---|
2564 | |
---|
2565 | //////////////////////////// |
---|
2566 | // locals, ins and outs |
---|
2567 | //------------------------- |
---|
2568 | // E - set up inputs to flop |
---|
2569 | // M - Decode |
---|
2570 | // W (phase 1) - Save |
---|
2571 | // W (phase 2) - write is allowed for save because restore will get killed |
---|
2572 | // W2 (phase 1) - Restore |
---|
2573 | // W2 (phase 2) - write is allowed |
---|
2574 | // |
---|
2575 | // actions that occur in phase one are modelled as occurring on the |
---|
2576 | // rising edge |
---|
2577 | // |
---|
2578 | // swaps to the same thread in consecutive cycles not allowed |
---|
2579 | ///////////////////////////// |
---|
2580 | if (swap_local_m_vld) begin |
---|
2581 | // save the locals (16-23 in active window) |
---|
2582 | for (i = 6'd16; i < 6'd24; i = i + 1) begin |
---|
2583 | active_pointer[6:0] = {cwpswap_tid_m[1:0], i[4:0]}; |
---|
2584 | regfile_pointer[7:0] = {cwpswap_tid_m[1:0], old_lo_cwp_m[2:0], i[2:0]}; |
---|
2585 | if (swap_local_w & ~kill_restore_w & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) |
---|
2586 | locals[regfile_pointer[7:0]] = {72{1'bx}}; |
---|
2587 | else |
---|
2588 | locals[regfile_pointer[7:0]] = active_window[active_pointer]; |
---|
2589 | end |
---|
2590 | end |
---|
2591 | if (swap_even_m_vld) begin |
---|
2592 | // save the ins in even window (24-31 in active window) |
---|
2593 | for (i = 6'd24; i < 6'd32; i = i + 1) begin |
---|
2594 | active_pointer[6:0] = {cwpswap_tid_m[1:0], i[4:0]}; |
---|
2595 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_m[1:0], old_e_cwp_m[1:0], i[2:0]}; |
---|
2596 | if (swap_even_w & ~kill_restore_w & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) |
---|
2597 | evens[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
2598 | else |
---|
2599 | evens[regfile_pointer[6:0]] = active_window[active_pointer]; |
---|
2600 | end |
---|
2601 | end |
---|
2602 | if (swap_odd_m_vld) begin |
---|
2603 | // save the ins in odd window (8-15 in active window) |
---|
2604 | for (i = 6'd8; i < 6'd16; i = i + 1) begin |
---|
2605 | active_pointer[6:0] = {cwpswap_tid_m[1:0], i[4:0]}; |
---|
2606 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_m[1:0], old_lo_cwp_m[2:1], i[2:0]}; |
---|
2607 | if (swap_odd_w & ~kill_restore_w & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) |
---|
2608 | odds[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
2609 | else |
---|
2610 | odds[regfile_pointer[6:0]] = active_window[active_pointer]; |
---|
2611 | end |
---|
2612 | end |
---|
2613 | if(~kill_restore_w) begin |
---|
2614 | if (swap_local_w) begin |
---|
2615 | // restore the locals (16-23 in active window) |
---|
2616 | for (i = 6'd16; i < 6'd24; i = i + 1) begin |
---|
2617 | active_pointer[6:0] = {cwpswap_tid_w[1:0], i[4:0]}; |
---|
2618 | regfile_pointer[7:0] = {cwpswap_tid_w[1:0], new_lo_cwp_w[2:0], i[2:0]}; |
---|
2619 | if (swap_local_m_vld & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) begin |
---|
2620 | active_window[active_pointer] = {72{1'bx}}; |
---|
2621 | locals[regfile_pointer[7:0]] = {72{1'bx}}; |
---|
2622 | end |
---|
2623 | else |
---|
2624 | active_window[active_pointer] = locals[regfile_pointer[7:0]]; |
---|
2625 | end |
---|
2626 | end |
---|
2627 | if (swap_even_w) begin |
---|
2628 | // restore the ins in even window (24-32 in active window) |
---|
2629 | for (i = 6'd24; i < 6'd32; i = i + 1) begin |
---|
2630 | active_pointer[6:0] = {cwpswap_tid_w[1:0], i[4:0]}; |
---|
2631 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_w[1:0], new_e_cwp_w[1:0], i[2:0]}; |
---|
2632 | if (swap_even_m_vld & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) begin |
---|
2633 | active_window[active_pointer] = {72{1'bx}}; |
---|
2634 | evens[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
2635 | end |
---|
2636 | else |
---|
2637 | active_window[active_pointer] = evens[regfile_pointer[6:0]]; |
---|
2638 | end |
---|
2639 | end |
---|
2640 | if (swap_odd_w) begin |
---|
2641 | // restore the ins in odd window (8-16 in active window) |
---|
2642 | for (i = 6'd8; i < 6'd16; i = i + 1) begin |
---|
2643 | active_pointer[6:0] = {cwpswap_tid_w[1:0], i[4:0]}; |
---|
2644 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_w[1:0], new_lo_cwp_w[2:1], i[2:0]}; |
---|
2645 | if (swap_odd_m_vld & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) begin |
---|
2646 | active_window[active_pointer] = {72{1'bx}}; |
---|
2647 | odds[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
2648 | end |
---|
2649 | else |
---|
2650 | active_window[active_pointer] = odds[regfile_pointer[6:0]]; |
---|
2651 | end |
---|
2652 | end |
---|
2653 | end |
---|
2654 | end // always @ (posedge clk) |
---|
2655 | |
---|
2656 | endmodule // bw_r_irf |
---|
2657 | |
---|
2658 | `endif |
---|