[6] | 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), |
---|
[22] | 1187 | .se (se), |
---|
| 1188 | .si (), |
---|
| 1189 | .so ()); |
---|
[6] | 1190 | dff_s dff_ren2_s2d( |
---|
| 1191 | .din (ren2_s), |
---|
| 1192 | .clk (clk), |
---|
| 1193 | .q (ifu_exu_ren2_d), |
---|
[22] | 1194 | .se (se), |
---|
| 1195 | .si (), |
---|
| 1196 | .so ()); |
---|
[6] | 1197 | dff_s dff_ren3_s2d( |
---|
| 1198 | .din (ren3_s), |
---|
| 1199 | .clk (clk), |
---|
| 1200 | .q (ifu_exu_ren3_d), |
---|
[22] | 1201 | .se (se), |
---|
| 1202 | .si (), |
---|
| 1203 | .so ()); |
---|
[6] | 1204 | dff_s #(5) dff_rs1_s2d( |
---|
| 1205 | .din (rs1_s[4:0]), |
---|
| 1206 | .clk (clk), |
---|
| 1207 | .q (ifu_exu_rs1_d[4:0]), |
---|
[22] | 1208 | .se (se), |
---|
| 1209 | .si (), |
---|
| 1210 | .so ()); |
---|
[6] | 1211 | dff_s #(5) dff_rs2_s2d( |
---|
| 1212 | .din (rs2_s[4:0]), |
---|
| 1213 | .clk (clk), |
---|
| 1214 | .q (ifu_exu_rs2_d[4:0]), |
---|
[22] | 1215 | .se (se), |
---|
| 1216 | .si (), |
---|
| 1217 | .so ()); |
---|
[6] | 1218 | dff_s #(5) dff_rs3_s2d( |
---|
| 1219 | .din (rs3_s[4:0]), |
---|
| 1220 | .clk (clk), |
---|
| 1221 | .q (ifu_exu_rs3_d[4:0]), |
---|
[22] | 1222 | .se (se), |
---|
| 1223 | .si (), |
---|
| 1224 | .so ()); |
---|
[6] | 1225 | dff_s #(2) dff_thr_s2d( |
---|
| 1226 | .din (tid_s[1:0]), |
---|
| 1227 | .clk (clk), |
---|
| 1228 | .q (ifu_exu_thr_d[1:0]), |
---|
[22] | 1229 | .se (se), |
---|
| 1230 | .si (), |
---|
| 1231 | .so ()); |
---|
[6] | 1232 | dff_s #(2) dff_thr_g2w2( |
---|
| 1233 | .din (tid_g[1:0]), |
---|
| 1234 | .clk (clk), |
---|
| 1235 | .q (ecl_irf_tid_w2[1:0]), |
---|
[22] | 1236 | .se (se), |
---|
| 1237 | .si (), |
---|
| 1238 | .so ()); |
---|
[6] | 1239 | dff_s #(2) dff_thr_m2w( |
---|
| 1240 | .din (tid_m[1:0]), |
---|
| 1241 | .clk (clk), |
---|
| 1242 | .q (ecl_irf_tid_w[1:0]), |
---|
[22] | 1243 | .se (se), |
---|
| 1244 | .si (), |
---|
| 1245 | .so ()); |
---|
[6] | 1246 | dff_s #(5) dff_rd_m2w( |
---|
| 1247 | .din (rd_m[4:0]), |
---|
| 1248 | .clk (clk), |
---|
| 1249 | .q (ecl_irf_rd_w[4:0]), |
---|
[22] | 1250 | .se (se), |
---|
| 1251 | .si (), |
---|
| 1252 | .so ()); |
---|
[6] | 1253 | dff_s #(5) dff_rd_g2w2( |
---|
| 1254 | .din (rd_g[4:0]), |
---|
| 1255 | .clk (clk), |
---|
| 1256 | .q (ecl_irf_rd_w2[4:0]), |
---|
[22] | 1257 | .se (se), |
---|
| 1258 | .si (), |
---|
| 1259 | .so ()); |
---|
[6] | 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 | always @(posedge clk) begin |
---|
| 1366 | if (wr_en) begin |
---|
| 1367 | $display("Write Port 1: %h %h", active_win_thr_rd_w_neg, |
---|
| 1368 | thr_rd_w_neg); |
---|
| 1369 | end |
---|
| 1370 | if (wr_en2) begin |
---|
| 1371 | $display("Write Port 2: %h %h", active_win_thr_rd_w2_neg, |
---|
| 1372 | thr_rd_w2_neg); |
---|
| 1373 | end |
---|
| 1374 | if (ifu_exu_ren1_d) begin |
---|
| 1375 | @(posedge clk) ; |
---|
| 1376 | $display("Read Port 1: %h %h", irf_byp_rs1_data_d, thr_rs1); |
---|
| 1377 | end |
---|
| 1378 | if (ifu_exu_ren2_d) begin |
---|
| 1379 | @(posedge clk) ; |
---|
| 1380 | $display("Read Port 2: %h %h", irf_byp_rs2_data_d, thr_rs2); |
---|
| 1381 | end |
---|
| 1382 | if (ifu_exu_ren3_d) begin |
---|
| 1383 | @(posedge clk) ; |
---|
| 1384 | $display("Read Port 3: %h %h", irf_byp_rs3_data_d, thr_rs3); |
---|
| 1385 | end |
---|
| 1386 | end |
---|
| 1387 | */ |
---|
| 1388 | endmodule |
---|
| 1389 | |
---|
| 1390 | module bw_r_irf_core(clk, ifu_exu_ren1_d, ifu_exu_ren2_d, ifu_exu_ren3_d, |
---|
| 1391 | thr_rs1, thr_rs2, thr_rs3, thr_rs3h, irf_byp_rs1_data_d, |
---|
| 1392 | irf_byp_rs2_data_d, irf_byp_rs3_data_d, irf_byp_rs3h_data_d, wr_en, |
---|
| 1393 | wr_en2, active_win_thr_rd_w_neg, active_win_thr_rd_w2_neg, thr_rd_w_neg, |
---|
| 1394 | thr_rd_w2_neg, swap_global_d1_vld, swap_global_d2, global_tid_d1, |
---|
| 1395 | global_tid_d2, old_agp_d1, new_agp_d2, swap_local_m_vld, swap_local_w, |
---|
| 1396 | old_lo_cwp_m, new_lo_cwp_w, swap_even_m_vld, swap_even_w, old_e_cwp_m, |
---|
| 1397 | new_e_cwp_w, swap_odd_m_vld, swap_odd_w, cwpswap_tid_m, cwpswap_tid_w, |
---|
| 1398 | kill_restore_w); |
---|
| 1399 | |
---|
| 1400 | input clk; |
---|
| 1401 | input ifu_exu_ren1_d; |
---|
| 1402 | input ifu_exu_ren2_d; |
---|
| 1403 | input ifu_exu_ren3_d; |
---|
| 1404 | input [6:0] thr_rs1; |
---|
| 1405 | input [6:0] thr_rs2; |
---|
| 1406 | input [6:0] thr_rs3; |
---|
| 1407 | input [6:0] thr_rs3h; |
---|
| 1408 | output [71:0] irf_byp_rs1_data_d; |
---|
| 1409 | output [71:0] irf_byp_rs2_data_d; |
---|
| 1410 | output [71:0] irf_byp_rs3_data_d; |
---|
| 1411 | output [71:0] irf_byp_rs3h_data_d; |
---|
| 1412 | input wr_en; |
---|
| 1413 | input wr_en2; |
---|
| 1414 | input [71:0] active_win_thr_rd_w_neg; |
---|
| 1415 | input [71:0] active_win_thr_rd_w2_neg; |
---|
| 1416 | input [6:0] thr_rd_w_neg; |
---|
| 1417 | input [6:0] thr_rd_w2_neg; |
---|
| 1418 | input swap_global_d1_vld; |
---|
| 1419 | input swap_global_d2; |
---|
| 1420 | input [1:0] global_tid_d1; |
---|
| 1421 | input [1:0] global_tid_d2; |
---|
| 1422 | input [1:0] old_agp_d1; |
---|
| 1423 | input [1:0] new_agp_d2; |
---|
| 1424 | input swap_local_m_vld; |
---|
| 1425 | input swap_local_w; |
---|
| 1426 | input [2:0] old_lo_cwp_m; |
---|
| 1427 | input [2:0] new_lo_cwp_w; |
---|
| 1428 | input swap_even_m_vld; |
---|
| 1429 | input swap_even_w; |
---|
| 1430 | input [1:0] old_e_cwp_m; |
---|
| 1431 | input [1:0] new_e_cwp_w; |
---|
| 1432 | input swap_odd_m_vld; |
---|
| 1433 | input swap_odd_w; |
---|
| 1434 | input [1:0] cwpswap_tid_m; |
---|
| 1435 | input [1:0] cwpswap_tid_w; |
---|
| 1436 | input kill_restore_w; |
---|
| 1437 | |
---|
| 1438 | reg [71:0] irf_byp_rs1_data_d; |
---|
| 1439 | reg [71:0] irf_byp_rs2_data_d; |
---|
| 1440 | reg [71:0] irf_byp_rs3_data_d; |
---|
| 1441 | reg [71:0] irf_byp_rs3h_data_d; |
---|
| 1442 | wire [71:0] rd_data00; |
---|
| 1443 | wire [71:0] rd_data01; |
---|
| 1444 | wire [71:0] rd_data02; |
---|
| 1445 | wire [71:0] rd_data03; |
---|
| 1446 | wire [71:0] rd_data04; |
---|
| 1447 | wire [71:0] rd_data05; |
---|
| 1448 | wire [71:0] rd_data06; |
---|
| 1449 | wire [71:0] rd_data07; |
---|
| 1450 | wire [71:0] rd_data08; |
---|
| 1451 | wire [71:0] rd_data09; |
---|
| 1452 | wire [71:0] rd_data10; |
---|
| 1453 | wire [71:0] rd_data11; |
---|
| 1454 | wire [71:0] rd_data12; |
---|
| 1455 | wire [71:0] rd_data13; |
---|
| 1456 | wire [71:0] rd_data14; |
---|
| 1457 | wire [71:0] rd_data15; |
---|
| 1458 | wire [71:0] rd_data16; |
---|
| 1459 | wire [71:0] rd_data17; |
---|
| 1460 | wire [71:0] rd_data18; |
---|
| 1461 | wire [71:0] rd_data19; |
---|
| 1462 | wire [71:0] rd_data20; |
---|
| 1463 | wire [71:0] rd_data21; |
---|
| 1464 | wire [71:0] rd_data22; |
---|
| 1465 | wire [71:0] rd_data23; |
---|
| 1466 | wire [71:0] rd_data24; |
---|
| 1467 | wire [71:0] rd_data25; |
---|
| 1468 | wire [71:0] rd_data26; |
---|
| 1469 | wire [71:0] rd_data27; |
---|
| 1470 | wire [71:0] rd_data28; |
---|
| 1471 | wire [71:0] rd_data29; |
---|
| 1472 | wire [71:0] rd_data30; |
---|
| 1473 | wire [71:0] rd_data31; |
---|
| 1474 | wire wren; |
---|
| 1475 | wire [4:0] wr_addr; |
---|
| 1476 | wire [71:0] wr_data; |
---|
| 1477 | |
---|
| 1478 | |
---|
| 1479 | wire [127:0] wr_en1s = (wr_en << {thr_rd_w_neg[4:0],thr_rd_w_neg[6:5]}); |
---|
| 1480 | wire [127:0] wr_en2s = (wr_en2 << {thr_rd_w2_neg[4:0],thr_rd_w2_neg[6:5]}); |
---|
| 1481 | wire [127:0] wrens = wr_en1s | wr_en2s; |
---|
| 1482 | |
---|
| 1483 | wire [3:0] wr_th1 = wr_en << thr_rd_w_neg[6:5]; |
---|
| 1484 | |
---|
| 1485 | wire [71:0] wr_data0 = wr_th1[0] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
| 1486 | wire [71:0] wr_data1 = wr_th1[1] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
| 1487 | wire [71:0] wr_data2 = wr_th1[2] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
| 1488 | wire [71:0] wr_data3 = wr_th1[3] ? active_win_thr_rd_w_neg : active_win_thr_rd_w2_neg; |
---|
| 1489 | |
---|
| 1490 | |
---|
| 1491 | bw_r_irf_register register00( |
---|
| 1492 | .clk (clk), |
---|
| 1493 | .wrens (wrens[3:0]), |
---|
| 1494 | .save (swap_global_d1_vld), |
---|
| 1495 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1496 | .restore (swap_global_d2), |
---|
| 1497 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1498 | .wr_data0 (72'b0), |
---|
| 1499 | .wr_data1 (72'b0), |
---|
| 1500 | .wr_data2 (72'b0), |
---|
| 1501 | .wr_data3 (72'b0), |
---|
| 1502 | .rd_thread (thr_rs1[6:5]), |
---|
| 1503 | .rd_data (rd_data00)); |
---|
| 1504 | bw_r_irf_register register01( |
---|
| 1505 | .clk (clk), |
---|
| 1506 | .wrens (wrens[7:4]), |
---|
| 1507 | .save (swap_global_d1_vld), |
---|
| 1508 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1509 | .restore (swap_global_d2), |
---|
| 1510 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1511 | .wr_data0 (wr_data0), |
---|
| 1512 | .wr_data1 (wr_data1), |
---|
| 1513 | .wr_data2 (wr_data2), |
---|
| 1514 | .wr_data3 (wr_data3), |
---|
| 1515 | .rd_thread (thr_rs1[6:5]), |
---|
| 1516 | .rd_data (rd_data01)); |
---|
| 1517 | bw_r_irf_register register02( |
---|
| 1518 | .clk (clk), |
---|
| 1519 | .wrens (wrens[11:8]), |
---|
| 1520 | .save (swap_global_d1_vld), |
---|
| 1521 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1522 | .restore (swap_global_d2), |
---|
| 1523 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1524 | .wr_data0 (wr_data0), |
---|
| 1525 | .wr_data1 (wr_data1), |
---|
| 1526 | .wr_data2 (wr_data2), |
---|
| 1527 | .wr_data3 (wr_data3), |
---|
| 1528 | .rd_thread (thr_rs1[6:5]), |
---|
| 1529 | .rd_data (rd_data02)); |
---|
| 1530 | bw_r_irf_register register03( |
---|
| 1531 | .clk (clk), |
---|
| 1532 | .wrens (wrens[15:12]), |
---|
| 1533 | .save (swap_global_d1_vld), |
---|
| 1534 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1535 | .restore (swap_global_d2), |
---|
| 1536 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1537 | .wr_data0 (wr_data0), |
---|
| 1538 | .wr_data1 (wr_data1), |
---|
| 1539 | .wr_data2 (wr_data2), |
---|
| 1540 | .wr_data3 (wr_data3), |
---|
| 1541 | .rd_thread (thr_rs1[6:5]), |
---|
| 1542 | .rd_data (rd_data03)); |
---|
| 1543 | bw_r_irf_register register04( |
---|
| 1544 | .clk (clk), |
---|
| 1545 | .wrens (wrens[19:16]), |
---|
| 1546 | .save (swap_global_d1_vld), |
---|
| 1547 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1548 | .restore (swap_global_d2), |
---|
| 1549 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1550 | .wr_data0 (wr_data0), |
---|
| 1551 | .wr_data1 (wr_data1), |
---|
| 1552 | .wr_data2 (wr_data2), |
---|
| 1553 | .wr_data3 (wr_data3), |
---|
| 1554 | .rd_thread (thr_rs1[6:5]), |
---|
| 1555 | .rd_data (rd_data04)); |
---|
| 1556 | bw_r_irf_register register05( |
---|
| 1557 | .clk (clk), |
---|
| 1558 | .wrens (wrens[23:20]), |
---|
| 1559 | .save (swap_global_d1_vld), |
---|
| 1560 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1561 | .restore (swap_global_d2), |
---|
| 1562 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1563 | .wr_data0 (wr_data0), |
---|
| 1564 | .wr_data1 (wr_data1), |
---|
| 1565 | .wr_data2 (wr_data2), |
---|
| 1566 | .wr_data3 (wr_data3), |
---|
| 1567 | .rd_thread (thr_rs1[6:5]), |
---|
| 1568 | .rd_data (rd_data05)); |
---|
| 1569 | bw_r_irf_register register06( |
---|
| 1570 | .clk (clk), |
---|
| 1571 | .wrens (wrens[27:24]), |
---|
| 1572 | .save (swap_global_d1_vld), |
---|
| 1573 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1574 | .restore (swap_global_d2), |
---|
| 1575 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1576 | .wr_data0 (wr_data0), |
---|
| 1577 | .wr_data1 (wr_data1), |
---|
| 1578 | .wr_data2 (wr_data2), |
---|
| 1579 | .wr_data3 (wr_data3), |
---|
| 1580 | .rd_thread (thr_rs1[6:5]), |
---|
| 1581 | .rd_data (rd_data06)); |
---|
| 1582 | bw_r_irf_register register07( |
---|
| 1583 | .clk (clk), |
---|
| 1584 | .wrens (wrens[31:28]), |
---|
| 1585 | .save (swap_global_d1_vld), |
---|
| 1586 | .save_addr ({global_tid_d1, 1'b0, old_agp_d1[1:0]}), |
---|
| 1587 | .restore (swap_global_d2), |
---|
| 1588 | .restore_addr ({global_tid_d2, 1'b0, new_agp_d2[1:0]}), |
---|
| 1589 | .wr_data0 (wr_data0), |
---|
| 1590 | .wr_data1 (wr_data1), |
---|
| 1591 | .wr_data2 (wr_data2), |
---|
| 1592 | .wr_data3 (wr_data3), |
---|
| 1593 | .rd_thread (thr_rs1[6:5]), |
---|
| 1594 | .rd_data (rd_data07)); |
---|
| 1595 | |
---|
| 1596 | bw_r_irf_register register08( |
---|
| 1597 | .clk (clk), |
---|
| 1598 | .wrens (wrens[35:32]), |
---|
| 1599 | .save (swap_odd_m_vld), |
---|
| 1600 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1601 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1602 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1603 | .wr_data0 (wr_data0), |
---|
| 1604 | .wr_data1 (wr_data1), |
---|
| 1605 | .wr_data2 (wr_data2), |
---|
| 1606 | .wr_data3 (wr_data3), |
---|
| 1607 | .rd_thread (thr_rs1[6:5]), |
---|
| 1608 | .rd_data (rd_data08)); |
---|
| 1609 | bw_r_irf_register register09( |
---|
| 1610 | .clk (clk), |
---|
| 1611 | .wrens (wrens[39:36]), |
---|
| 1612 | .save (swap_odd_m_vld), |
---|
| 1613 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1614 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1615 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1616 | .wr_data0 (wr_data0), |
---|
| 1617 | .wr_data1 (wr_data1), |
---|
| 1618 | .wr_data2 (wr_data2), |
---|
| 1619 | .wr_data3 (wr_data3), |
---|
| 1620 | .rd_thread (thr_rs1[6:5]), |
---|
| 1621 | .rd_data (rd_data09)); |
---|
| 1622 | bw_r_irf_register register10( |
---|
| 1623 | .clk (clk), |
---|
| 1624 | .wrens (wrens[43:40]), |
---|
| 1625 | .save (swap_odd_m_vld), |
---|
| 1626 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1627 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1628 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1629 | .wr_data0 (wr_data0), |
---|
| 1630 | .wr_data1 (wr_data1), |
---|
| 1631 | .wr_data2 (wr_data2), |
---|
| 1632 | .wr_data3 (wr_data3), |
---|
| 1633 | .rd_thread (thr_rs1[6:5]), |
---|
| 1634 | .rd_data (rd_data10)); |
---|
| 1635 | bw_r_irf_register register11( |
---|
| 1636 | .clk (clk), |
---|
| 1637 | .wrens (wrens[47:44]), |
---|
| 1638 | .save (swap_odd_m_vld), |
---|
| 1639 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1640 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1641 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1642 | .wr_data0 (wr_data0), |
---|
| 1643 | .wr_data1 (wr_data1), |
---|
| 1644 | .wr_data2 (wr_data2), |
---|
| 1645 | .wr_data3 (wr_data3), |
---|
| 1646 | .rd_thread (thr_rs1[6:5]), |
---|
| 1647 | .rd_data (rd_data11)); |
---|
| 1648 | bw_r_irf_register register12( |
---|
| 1649 | .clk (clk), |
---|
| 1650 | .wrens (wrens[51:48]), |
---|
| 1651 | .save (swap_odd_m_vld), |
---|
| 1652 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1653 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1654 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1655 | .wr_data0 (wr_data0), |
---|
| 1656 | .wr_data1 (wr_data1), |
---|
| 1657 | .wr_data2 (wr_data2), |
---|
| 1658 | .wr_data3 (wr_data3), |
---|
| 1659 | .rd_thread (thr_rs1[6:5]), |
---|
| 1660 | .rd_data (rd_data12)); |
---|
| 1661 | bw_r_irf_register register13( |
---|
| 1662 | .clk (clk), |
---|
| 1663 | .wrens (wrens[55:52]), |
---|
| 1664 | .save (swap_odd_m_vld), |
---|
| 1665 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1666 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1667 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1668 | .wr_data0 (wr_data0), |
---|
| 1669 | .wr_data1 (wr_data1), |
---|
| 1670 | .wr_data2 (wr_data2), |
---|
| 1671 | .wr_data3 (wr_data3), |
---|
| 1672 | .rd_thread (thr_rs1[6:5]), |
---|
| 1673 | .rd_data (rd_data13)); |
---|
| 1674 | bw_r_irf_register register14( |
---|
| 1675 | .clk (clk), |
---|
| 1676 | .wrens (wrens[59:56]), |
---|
| 1677 | .save (swap_odd_m_vld), |
---|
| 1678 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1679 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1680 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1681 | .wr_data0 (wr_data0), |
---|
| 1682 | .wr_data1 (wr_data1), |
---|
| 1683 | .wr_data2 (wr_data2), |
---|
| 1684 | .wr_data3 (wr_data3), |
---|
| 1685 | .rd_thread (thr_rs1[6:5]), |
---|
| 1686 | .rd_data (rd_data14)); |
---|
| 1687 | bw_r_irf_register register15( |
---|
| 1688 | .clk (clk), |
---|
| 1689 | .wrens (wrens[63:60]), |
---|
| 1690 | .save (swap_odd_m_vld), |
---|
| 1691 | .save_addr ({cwpswap_tid_m, 1'b0, old_lo_cwp_m[2:1]}), |
---|
| 1692 | .restore ((swap_odd_w & (~kill_restore_w))), |
---|
| 1693 | .restore_addr ({cwpswap_tid_w,1'b0, new_lo_cwp_w[2:1]}), |
---|
| 1694 | .wr_data0 (wr_data0), |
---|
| 1695 | .wr_data1 (wr_data1), |
---|
| 1696 | .wr_data2 (wr_data2), |
---|
| 1697 | .wr_data3 (wr_data3), |
---|
| 1698 | .rd_thread (thr_rs1[6:5]), |
---|
| 1699 | .rd_data (rd_data15)); |
---|
| 1700 | |
---|
| 1701 | bw_r_irf_register register16( |
---|
| 1702 | .clk (clk), |
---|
| 1703 | .wrens (wrens[67:64]), |
---|
| 1704 | .save (swap_local_m_vld), |
---|
| 1705 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1706 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1707 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1708 | .wr_data0 (wr_data0), |
---|
| 1709 | .wr_data1 (wr_data1), |
---|
| 1710 | .wr_data2 (wr_data2), |
---|
| 1711 | .wr_data3 (wr_data3), |
---|
| 1712 | .rd_thread (thr_rs1[6:5]), |
---|
| 1713 | .rd_data (rd_data16)); |
---|
| 1714 | bw_r_irf_register register17( |
---|
| 1715 | .clk (clk), |
---|
| 1716 | .wrens (wrens[71:68]), |
---|
| 1717 | .save (swap_local_m_vld), |
---|
| 1718 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1719 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1720 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1721 | .wr_data0 (wr_data0), |
---|
| 1722 | .wr_data1 (wr_data1), |
---|
| 1723 | .wr_data2 (wr_data2), |
---|
| 1724 | .wr_data3 (wr_data3), |
---|
| 1725 | .rd_thread (thr_rs1[6:5]), |
---|
| 1726 | .rd_data (rd_data17)); |
---|
| 1727 | bw_r_irf_register register18( |
---|
| 1728 | .clk (clk), |
---|
| 1729 | .wrens (wrens[75:72]), |
---|
| 1730 | .save (swap_local_m_vld), |
---|
| 1731 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1732 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1733 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1734 | .wr_data0 (wr_data0), |
---|
| 1735 | .wr_data1 (wr_data1), |
---|
| 1736 | .wr_data2 (wr_data2), |
---|
| 1737 | .wr_data3 (wr_data3), |
---|
| 1738 | .rd_thread (thr_rs1[6:5]), |
---|
| 1739 | .rd_data (rd_data18)); |
---|
| 1740 | bw_r_irf_register register19( |
---|
| 1741 | .clk (clk), |
---|
| 1742 | .wrens (wrens[79:76]), |
---|
| 1743 | .save (swap_local_m_vld), |
---|
| 1744 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1745 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1746 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1747 | .wr_data0 (wr_data0), |
---|
| 1748 | .wr_data1 (wr_data1), |
---|
| 1749 | .wr_data2 (wr_data2), |
---|
| 1750 | .wr_data3 (wr_data3), |
---|
| 1751 | .rd_thread (thr_rs1[6:5]), |
---|
| 1752 | .rd_data (rd_data19)); |
---|
| 1753 | bw_r_irf_register register20( |
---|
| 1754 | .clk (clk), |
---|
| 1755 | .wrens (wrens[83:80]), |
---|
| 1756 | .save (swap_local_m_vld), |
---|
| 1757 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1758 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1759 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1760 | .wr_data0 (wr_data0), |
---|
| 1761 | .wr_data1 (wr_data1), |
---|
| 1762 | .wr_data2 (wr_data2), |
---|
| 1763 | .wr_data3 (wr_data3), |
---|
| 1764 | .rd_thread (thr_rs1[6:5]), |
---|
| 1765 | .rd_data (rd_data20)); |
---|
| 1766 | bw_r_irf_register register21( |
---|
| 1767 | .clk (clk), |
---|
| 1768 | .wrens (wrens[87:84]), |
---|
| 1769 | .save (swap_local_m_vld), |
---|
| 1770 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1771 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1772 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1773 | .wr_data0 (wr_data0), |
---|
| 1774 | .wr_data1 (wr_data1), |
---|
| 1775 | .wr_data2 (wr_data2), |
---|
| 1776 | .wr_data3 (wr_data3), |
---|
| 1777 | .rd_thread (thr_rs1[6:5]), |
---|
| 1778 | .rd_data (rd_data21)); |
---|
| 1779 | bw_r_irf_register register22( |
---|
| 1780 | .clk (clk), |
---|
| 1781 | .wrens (wrens[91:88]), |
---|
| 1782 | .save (swap_local_m_vld), |
---|
| 1783 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1784 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1785 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1786 | .wr_data0 (wr_data0), |
---|
| 1787 | .wr_data1 (wr_data1), |
---|
| 1788 | .wr_data2 (wr_data2), |
---|
| 1789 | .wr_data3 (wr_data3), |
---|
| 1790 | .rd_thread (thr_rs1[6:5]), |
---|
| 1791 | .rd_data (rd_data22)); |
---|
| 1792 | bw_r_irf_register register23( |
---|
| 1793 | .clk (clk), |
---|
| 1794 | .wrens (wrens[95:92]), |
---|
| 1795 | .save (swap_local_m_vld), |
---|
| 1796 | .save_addr ({cwpswap_tid_m, old_lo_cwp_m[2:0]}), |
---|
| 1797 | .restore ((swap_local_w & (~kill_restore_w))), |
---|
| 1798 | .restore_addr ({cwpswap_tid_w, new_lo_cwp_w[2:0]}), |
---|
| 1799 | .wr_data0 (wr_data0), |
---|
| 1800 | .wr_data1 (wr_data1), |
---|
| 1801 | .wr_data2 (wr_data2), |
---|
| 1802 | .wr_data3 (wr_data3), |
---|
| 1803 | .rd_thread (thr_rs1[6:5]), |
---|
| 1804 | .rd_data (rd_data23)); |
---|
| 1805 | |
---|
| 1806 | bw_r_irf_register register24( |
---|
| 1807 | .clk (clk), |
---|
| 1808 | .wrens (wrens[99:96]), |
---|
| 1809 | .save (swap_even_m_vld), |
---|
| 1810 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1811 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1812 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1813 | .wr_data0 (wr_data0), |
---|
| 1814 | .wr_data1 (wr_data1), |
---|
| 1815 | .wr_data2 (wr_data2), |
---|
| 1816 | .wr_data3 (wr_data3), |
---|
| 1817 | .rd_thread (thr_rs1[6:5]), |
---|
| 1818 | .rd_data (rd_data24)); |
---|
| 1819 | bw_r_irf_register register25( |
---|
| 1820 | .clk (clk), |
---|
| 1821 | .wrens (wrens[103:100]), |
---|
| 1822 | .save (swap_even_m_vld), |
---|
| 1823 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1824 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1825 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1826 | .wr_data0 (wr_data0), |
---|
| 1827 | .wr_data1 (wr_data1), |
---|
| 1828 | .wr_data2 (wr_data2), |
---|
| 1829 | .wr_data3 (wr_data3), |
---|
| 1830 | .rd_thread (thr_rs1[6:5]), |
---|
| 1831 | .rd_data (rd_data25)); |
---|
| 1832 | bw_r_irf_register register26( |
---|
| 1833 | .clk (clk), |
---|
| 1834 | .wrens (wrens[107:104]), |
---|
| 1835 | .save (swap_even_m_vld), |
---|
| 1836 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1837 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1838 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1839 | .wr_data0 (wr_data0), |
---|
| 1840 | .wr_data1 (wr_data1), |
---|
| 1841 | .wr_data2 (wr_data2), |
---|
| 1842 | .wr_data3 (wr_data3), |
---|
| 1843 | .rd_thread (thr_rs1[6:5]), |
---|
| 1844 | .rd_data (rd_data26)); |
---|
| 1845 | bw_r_irf_register register27( |
---|
| 1846 | .clk (clk), |
---|
| 1847 | .wrens (wrens[111:108]), |
---|
| 1848 | .save (swap_even_m_vld), |
---|
| 1849 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1850 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1851 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1852 | .wr_data0 (wr_data0), |
---|
| 1853 | .wr_data1 (wr_data1), |
---|
| 1854 | .wr_data2 (wr_data2), |
---|
| 1855 | .wr_data3 (wr_data3), |
---|
| 1856 | .rd_thread (thr_rs1[6:5]), |
---|
| 1857 | .rd_data (rd_data27)); |
---|
| 1858 | bw_r_irf_register register28( |
---|
| 1859 | .clk (clk), |
---|
| 1860 | .wrens (wrens[115:112]), |
---|
| 1861 | .save (swap_even_m_vld), |
---|
| 1862 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1863 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1864 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1865 | .wr_data0 (wr_data0), |
---|
| 1866 | .wr_data1 (wr_data1), |
---|
| 1867 | .wr_data2 (wr_data2), |
---|
| 1868 | .wr_data3 (wr_data3), |
---|
| 1869 | .rd_thread (thr_rs1[6:5]), |
---|
| 1870 | .rd_data (rd_data28)); |
---|
| 1871 | bw_r_irf_register register29( |
---|
| 1872 | .clk (clk), |
---|
| 1873 | .wrens (wrens[119:116]), |
---|
| 1874 | .save (swap_even_m_vld), |
---|
| 1875 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1876 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1877 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1878 | .wr_data0 (wr_data0), |
---|
| 1879 | .wr_data1 (wr_data1), |
---|
| 1880 | .wr_data2 (wr_data2), |
---|
| 1881 | .wr_data3 (wr_data3), |
---|
| 1882 | .rd_thread (thr_rs1[6:5]), |
---|
| 1883 | .rd_data (rd_data29)); |
---|
| 1884 | bw_r_irf_register register30( |
---|
| 1885 | .clk (clk), |
---|
| 1886 | .wrens (wrens[123:120]), |
---|
| 1887 | .save (swap_even_m_vld), |
---|
| 1888 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1889 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1890 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1891 | .wr_data0 (wr_data0), |
---|
| 1892 | .wr_data1 (wr_data1), |
---|
| 1893 | .wr_data2 (wr_data2), |
---|
| 1894 | .wr_data3 (wr_data3), |
---|
| 1895 | .rd_thread (thr_rs1[6:5]), |
---|
| 1896 | .rd_data (rd_data30)); |
---|
| 1897 | bw_r_irf_register register31( |
---|
| 1898 | .clk (clk), |
---|
| 1899 | .wrens (wrens[127:124]), |
---|
| 1900 | .save (swap_even_m_vld), |
---|
| 1901 | .save_addr ({cwpswap_tid_m[1:0], 1'b0, old_e_cwp_m[1:0]}), |
---|
| 1902 | .restore ((swap_even_w & (~kill_restore_w))), |
---|
| 1903 | .restore_addr ({cwpswap_tid_w[1:0], 1'b0, new_e_cwp_w[1:0]}), |
---|
| 1904 | .wr_data0 (wr_data0), |
---|
| 1905 | .wr_data1 (wr_data1), |
---|
| 1906 | .wr_data2 (wr_data2), |
---|
| 1907 | .wr_data3 (wr_data3), |
---|
| 1908 | .rd_thread (thr_rs1[6:5]), |
---|
| 1909 | .rd_data (rd_data31)); |
---|
| 1910 | |
---|
| 1911 | |
---|
| 1912 | always @(negedge clk) if (ifu_exu_ren1_d) begin |
---|
| 1913 | case (thr_rs1[4:0]) |
---|
| 1914 | 5'b0: |
---|
| 1915 | irf_byp_rs1_data_d <= rd_data00; |
---|
| 1916 | 5'b1: |
---|
| 1917 | irf_byp_rs1_data_d <= rd_data01; |
---|
| 1918 | 5'b00010: |
---|
| 1919 | irf_byp_rs1_data_d <= rd_data02; |
---|
| 1920 | 5'b00011: |
---|
| 1921 | irf_byp_rs1_data_d <= rd_data03; |
---|
| 1922 | 5'b00100: |
---|
| 1923 | irf_byp_rs1_data_d <= rd_data04; |
---|
| 1924 | 5'b00101: |
---|
| 1925 | irf_byp_rs1_data_d <= rd_data05; |
---|
| 1926 | 5'b00110: |
---|
| 1927 | irf_byp_rs1_data_d <= rd_data06; |
---|
| 1928 | 5'b00111: |
---|
| 1929 | irf_byp_rs1_data_d <= rd_data07; |
---|
| 1930 | 5'b01000: |
---|
| 1931 | irf_byp_rs1_data_d <= rd_data08; |
---|
| 1932 | 5'b01001: |
---|
| 1933 | irf_byp_rs1_data_d <= rd_data09; |
---|
| 1934 | 5'b01010: |
---|
| 1935 | irf_byp_rs1_data_d <= rd_data10; |
---|
| 1936 | 5'b01011: |
---|
| 1937 | irf_byp_rs1_data_d <= rd_data11; |
---|
| 1938 | 5'b01100: |
---|
| 1939 | irf_byp_rs1_data_d <= rd_data12; |
---|
| 1940 | 5'b01101: |
---|
| 1941 | irf_byp_rs1_data_d <= rd_data13; |
---|
| 1942 | 5'b01110: |
---|
| 1943 | irf_byp_rs1_data_d <= rd_data14; |
---|
| 1944 | 5'b01111: |
---|
| 1945 | irf_byp_rs1_data_d <= rd_data15; |
---|
| 1946 | 5'b10000: |
---|
| 1947 | irf_byp_rs1_data_d <= rd_data16; |
---|
| 1948 | 5'b10001: |
---|
| 1949 | irf_byp_rs1_data_d <= rd_data17; |
---|
| 1950 | 5'b10010: |
---|
| 1951 | irf_byp_rs1_data_d <= rd_data18; |
---|
| 1952 | 5'b10011: |
---|
| 1953 | irf_byp_rs1_data_d <= rd_data19; |
---|
| 1954 | 5'b10100: |
---|
| 1955 | irf_byp_rs1_data_d <= rd_data20; |
---|
| 1956 | 5'b10101: |
---|
| 1957 | irf_byp_rs1_data_d <= rd_data21; |
---|
| 1958 | 5'b10110: |
---|
| 1959 | irf_byp_rs1_data_d <= rd_data22; |
---|
| 1960 | 5'b10111: |
---|
| 1961 | irf_byp_rs1_data_d <= rd_data23; |
---|
| 1962 | 5'b11000: |
---|
| 1963 | irf_byp_rs1_data_d <= rd_data24; |
---|
| 1964 | 5'b11001: |
---|
| 1965 | irf_byp_rs1_data_d <= rd_data25; |
---|
| 1966 | 5'b11010: |
---|
| 1967 | irf_byp_rs1_data_d <= rd_data26; |
---|
| 1968 | 5'b11011: |
---|
| 1969 | irf_byp_rs1_data_d <= rd_data27; |
---|
| 1970 | 5'b11100: |
---|
| 1971 | irf_byp_rs1_data_d <= rd_data28; |
---|
| 1972 | 5'b11101: |
---|
| 1973 | irf_byp_rs1_data_d <= rd_data29; |
---|
| 1974 | 5'b11110: |
---|
| 1975 | irf_byp_rs1_data_d <= rd_data30; |
---|
| 1976 | 5'b11111: |
---|
| 1977 | irf_byp_rs1_data_d <= rd_data31; |
---|
| 1978 | endcase |
---|
| 1979 | end |
---|
| 1980 | always @(negedge clk) if (ifu_exu_ren2_d) begin |
---|
| 1981 | case (thr_rs2[4:0]) |
---|
| 1982 | 5'b0: |
---|
| 1983 | irf_byp_rs2_data_d <= rd_data00; |
---|
| 1984 | 5'b1: |
---|
| 1985 | irf_byp_rs2_data_d <= rd_data01; |
---|
| 1986 | 5'b00010: |
---|
| 1987 | irf_byp_rs2_data_d <= rd_data02; |
---|
| 1988 | 5'b00011: |
---|
| 1989 | irf_byp_rs2_data_d <= rd_data03; |
---|
| 1990 | 5'b00100: |
---|
| 1991 | irf_byp_rs2_data_d <= rd_data04; |
---|
| 1992 | 5'b00101: |
---|
| 1993 | irf_byp_rs2_data_d <= rd_data05; |
---|
| 1994 | 5'b00110: |
---|
| 1995 | irf_byp_rs2_data_d <= rd_data06; |
---|
| 1996 | 5'b00111: |
---|
| 1997 | irf_byp_rs2_data_d <= rd_data07; |
---|
| 1998 | 5'b01000: |
---|
| 1999 | irf_byp_rs2_data_d <= rd_data08; |
---|
| 2000 | 5'b01001: |
---|
| 2001 | irf_byp_rs2_data_d <= rd_data09; |
---|
| 2002 | 5'b01010: |
---|
| 2003 | irf_byp_rs2_data_d <= rd_data10; |
---|
| 2004 | 5'b01011: |
---|
| 2005 | irf_byp_rs2_data_d <= rd_data11; |
---|
| 2006 | 5'b01100: |
---|
| 2007 | irf_byp_rs2_data_d <= rd_data12; |
---|
| 2008 | 5'b01101: |
---|
| 2009 | irf_byp_rs2_data_d <= rd_data13; |
---|
| 2010 | 5'b01110: |
---|
| 2011 | irf_byp_rs2_data_d <= rd_data14; |
---|
| 2012 | 5'b01111: |
---|
| 2013 | irf_byp_rs2_data_d <= rd_data15; |
---|
| 2014 | 5'b10000: |
---|
| 2015 | irf_byp_rs2_data_d <= rd_data16; |
---|
| 2016 | 5'b10001: |
---|
| 2017 | irf_byp_rs2_data_d <= rd_data17; |
---|
| 2018 | 5'b10010: |
---|
| 2019 | irf_byp_rs2_data_d <= rd_data18; |
---|
| 2020 | 5'b10011: |
---|
| 2021 | irf_byp_rs2_data_d <= rd_data19; |
---|
| 2022 | 5'b10100: |
---|
| 2023 | irf_byp_rs2_data_d <= rd_data20; |
---|
| 2024 | 5'b10101: |
---|
| 2025 | irf_byp_rs2_data_d <= rd_data21; |
---|
| 2026 | 5'b10110: |
---|
| 2027 | irf_byp_rs2_data_d <= rd_data22; |
---|
| 2028 | 5'b10111: |
---|
| 2029 | irf_byp_rs2_data_d <= rd_data23; |
---|
| 2030 | 5'b11000: |
---|
| 2031 | irf_byp_rs2_data_d <= rd_data24; |
---|
| 2032 | 5'b11001: |
---|
| 2033 | irf_byp_rs2_data_d <= rd_data25; |
---|
| 2034 | 5'b11010: |
---|
| 2035 | irf_byp_rs2_data_d <= rd_data26; |
---|
| 2036 | 5'b11011: |
---|
| 2037 | irf_byp_rs2_data_d <= rd_data27; |
---|
| 2038 | 5'b11100: |
---|
| 2039 | irf_byp_rs2_data_d <= rd_data28; |
---|
| 2040 | 5'b11101: |
---|
| 2041 | irf_byp_rs2_data_d <= rd_data29; |
---|
| 2042 | 5'b11110: |
---|
| 2043 | irf_byp_rs2_data_d <= rd_data30; |
---|
| 2044 | 5'b11111: |
---|
| 2045 | irf_byp_rs2_data_d <= rd_data31; |
---|
| 2046 | endcase |
---|
| 2047 | end |
---|
| 2048 | always @(negedge clk) if (ifu_exu_ren3_d) begin |
---|
| 2049 | case (thr_rs3[4:0]) |
---|
| 2050 | 5'b0: |
---|
| 2051 | irf_byp_rs3_data_d <= rd_data00; |
---|
| 2052 | 5'b1: |
---|
| 2053 | irf_byp_rs3_data_d <= rd_data01; |
---|
| 2054 | 5'b00010: |
---|
| 2055 | irf_byp_rs3_data_d <= rd_data02; |
---|
| 2056 | 5'b00011: |
---|
| 2057 | irf_byp_rs3_data_d <= rd_data03; |
---|
| 2058 | 5'b00100: |
---|
| 2059 | irf_byp_rs3_data_d <= rd_data04; |
---|
| 2060 | 5'b00101: |
---|
| 2061 | irf_byp_rs3_data_d <= rd_data05; |
---|
| 2062 | 5'b00110: |
---|
| 2063 | irf_byp_rs3_data_d <= rd_data06; |
---|
| 2064 | 5'b00111: |
---|
| 2065 | irf_byp_rs3_data_d <= rd_data07; |
---|
| 2066 | 5'b01000: |
---|
| 2067 | irf_byp_rs3_data_d <= rd_data08; |
---|
| 2068 | 5'b01001: |
---|
| 2069 | irf_byp_rs3_data_d <= rd_data09; |
---|
| 2070 | 5'b01010: |
---|
| 2071 | irf_byp_rs3_data_d <= rd_data10; |
---|
| 2072 | 5'b01011: |
---|
| 2073 | irf_byp_rs3_data_d <= rd_data11; |
---|
| 2074 | 5'b01100: |
---|
| 2075 | irf_byp_rs3_data_d <= rd_data12; |
---|
| 2076 | 5'b01101: |
---|
| 2077 | irf_byp_rs3_data_d <= rd_data13; |
---|
| 2078 | 5'b01110: |
---|
| 2079 | irf_byp_rs3_data_d <= rd_data14; |
---|
| 2080 | 5'b01111: |
---|
| 2081 | irf_byp_rs3_data_d <= rd_data15; |
---|
| 2082 | 5'b10000: |
---|
| 2083 | irf_byp_rs3_data_d <= rd_data16; |
---|
| 2084 | 5'b10001: |
---|
| 2085 | irf_byp_rs3_data_d <= rd_data17; |
---|
| 2086 | 5'b10010: |
---|
| 2087 | irf_byp_rs3_data_d <= rd_data18; |
---|
| 2088 | 5'b10011: |
---|
| 2089 | irf_byp_rs3_data_d <= rd_data19; |
---|
| 2090 | 5'b10100: |
---|
| 2091 | irf_byp_rs3_data_d <= rd_data20; |
---|
| 2092 | 5'b10101: |
---|
| 2093 | irf_byp_rs3_data_d <= rd_data21; |
---|
| 2094 | 5'b10110: |
---|
| 2095 | irf_byp_rs3_data_d <= rd_data22; |
---|
| 2096 | 5'b10111: |
---|
| 2097 | irf_byp_rs3_data_d <= rd_data23; |
---|
| 2098 | 5'b11000: |
---|
| 2099 | irf_byp_rs3_data_d <= rd_data24; |
---|
| 2100 | 5'b11001: |
---|
| 2101 | irf_byp_rs3_data_d <= rd_data25; |
---|
| 2102 | 5'b11010: |
---|
| 2103 | irf_byp_rs3_data_d <= rd_data26; |
---|
| 2104 | 5'b11011: |
---|
| 2105 | irf_byp_rs3_data_d <= rd_data27; |
---|
| 2106 | 5'b11100: |
---|
| 2107 | irf_byp_rs3_data_d <= rd_data28; |
---|
| 2108 | 5'b11101: |
---|
| 2109 | irf_byp_rs3_data_d <= rd_data29; |
---|
| 2110 | 5'b11110: |
---|
| 2111 | irf_byp_rs3_data_d <= rd_data30; |
---|
| 2112 | 5'b11111: |
---|
| 2113 | irf_byp_rs3_data_d <= rd_data31; |
---|
| 2114 | endcase |
---|
| 2115 | end |
---|
| 2116 | always @(negedge clk) if (ifu_exu_ren3_d) begin |
---|
| 2117 | case (thr_rs3h[4:1]) |
---|
| 2118 | 4'b0: |
---|
| 2119 | irf_byp_rs3h_data_d <= rd_data01; |
---|
| 2120 | 4'b1: |
---|
| 2121 | irf_byp_rs3h_data_d <= rd_data03; |
---|
| 2122 | 4'b0010: |
---|
| 2123 | irf_byp_rs3h_data_d <= rd_data05; |
---|
| 2124 | 4'b0011: |
---|
| 2125 | irf_byp_rs3h_data_d <= rd_data07; |
---|
| 2126 | 4'b0100: |
---|
| 2127 | irf_byp_rs3h_data_d <= rd_data09; |
---|
| 2128 | 4'b0101: |
---|
| 2129 | irf_byp_rs3h_data_d <= rd_data11; |
---|
| 2130 | 4'b0110: |
---|
| 2131 | irf_byp_rs3h_data_d <= rd_data13; |
---|
| 2132 | 4'b0111: |
---|
| 2133 | irf_byp_rs3h_data_d <= rd_data15; |
---|
| 2134 | 4'b1000: |
---|
| 2135 | irf_byp_rs3h_data_d <= rd_data17; |
---|
| 2136 | 4'b1001: |
---|
| 2137 | irf_byp_rs3h_data_d <= rd_data19; |
---|
| 2138 | 4'b1010: |
---|
| 2139 | irf_byp_rs3h_data_d <= rd_data21; |
---|
| 2140 | 4'b1011: |
---|
| 2141 | irf_byp_rs3h_data_d <= rd_data23; |
---|
| 2142 | 4'b1100: |
---|
| 2143 | irf_byp_rs3h_data_d <= rd_data25; |
---|
| 2144 | 4'b1101: |
---|
| 2145 | irf_byp_rs3h_data_d <= rd_data27; |
---|
| 2146 | 4'b1110: |
---|
| 2147 | irf_byp_rs3h_data_d <= rd_data29; |
---|
| 2148 | 4'b1111: |
---|
| 2149 | irf_byp_rs3h_data_d <= rd_data31; |
---|
| 2150 | endcase |
---|
| 2151 | end |
---|
| 2152 | endmodule |
---|
| 2153 | |
---|
| 2154 | `endif |
---|
| 2155 | `else |
---|
| 2156 | |
---|
| 2157 | module bw_r_irf (/*AUTOARG*/ |
---|
| 2158 | // Outputs |
---|
| 2159 | so, irf_byp_rs1_data_d_l, irf_byp_rs2_data_d_l, |
---|
| 2160 | irf_byp_rs3_data_d_l, irf_byp_rs3h_data_d_l, |
---|
| 2161 | // Inputs |
---|
| 2162 | rclk, reset_l, si, se, sehold, rst_tri_en, ifu_exu_tid_s2, |
---|
| 2163 | ifu_exu_rs1_s, ifu_exu_rs2_s, ifu_exu_rs3_s, ifu_exu_ren1_s, |
---|
| 2164 | ifu_exu_ren2_s, ifu_exu_ren3_s, ecl_irf_wen_w, ecl_irf_wen_w2, |
---|
| 2165 | ecl_irf_rd_m, ecl_irf_rd_g, byp_irf_rd_data_w, byp_irf_rd_data_w2, |
---|
| 2166 | ecl_irf_tid_m, ecl_irf_tid_g, rml_irf_old_lo_cwp_e, |
---|
| 2167 | rml_irf_new_lo_cwp_e, rml_irf_old_e_cwp_e, rml_irf_new_e_cwp_e, |
---|
| 2168 | rml_irf_swap_even_e, rml_irf_swap_odd_e, rml_irf_swap_local_e, |
---|
| 2169 | rml_irf_kill_restore_w, rml_irf_cwpswap_tid_e, rml_irf_old_agp, |
---|
| 2170 | rml_irf_new_agp, rml_irf_swap_global, rml_irf_global_tid |
---|
| 2171 | ) ; |
---|
| 2172 | input rclk; |
---|
| 2173 | input reset_l; |
---|
| 2174 | input si; |
---|
| 2175 | input se; |
---|
| 2176 | input sehold; |
---|
| 2177 | input rst_tri_en; |
---|
| 2178 | input [1:0] ifu_exu_tid_s2; // s stage thread |
---|
| 2179 | input [4:0] ifu_exu_rs1_s; // source addresses |
---|
| 2180 | input [4:0] ifu_exu_rs2_s; |
---|
| 2181 | input [4:0] ifu_exu_rs3_s; |
---|
| 2182 | input ifu_exu_ren1_s; // read enables for all 3 ports |
---|
| 2183 | input ifu_exu_ren2_s; |
---|
| 2184 | input ifu_exu_ren3_s; |
---|
| 2185 | input ecl_irf_wen_w; // write enables for both write ports |
---|
| 2186 | input ecl_irf_wen_w2; |
---|
| 2187 | input [4:0] ecl_irf_rd_m; // w destination |
---|
| 2188 | input [4:0] ecl_irf_rd_g; // w2 destination |
---|
| 2189 | input [71:0] byp_irf_rd_data_w;// write data from w1 |
---|
| 2190 | input [71:0] byp_irf_rd_data_w2; // write data from w2 |
---|
| 2191 | input [1:0] ecl_irf_tid_m; // w stage thread |
---|
| 2192 | input [1:0] ecl_irf_tid_g; // w2 thread |
---|
| 2193 | |
---|
| 2194 | input [2:0] rml_irf_old_lo_cwp_e; // current window pointer for locals and odds |
---|
| 2195 | input [2:0] rml_irf_new_lo_cwp_e; // target window pointer for locals and odds |
---|
| 2196 | input [2:1] rml_irf_old_e_cwp_e; // current window pointer for evens |
---|
| 2197 | input [2:1] rml_irf_new_e_cwp_e; // target window pointer for evens |
---|
| 2198 | input rml_irf_swap_even_e; |
---|
| 2199 | input rml_irf_swap_odd_e; |
---|
| 2200 | input rml_irf_swap_local_e; |
---|
| 2201 | input rml_irf_kill_restore_w; |
---|
| 2202 | input [1:0] rml_irf_cwpswap_tid_e; |
---|
| 2203 | |
---|
| 2204 | input [1:0] rml_irf_old_agp; // alternate global pointer |
---|
| 2205 | input [1:0] rml_irf_new_agp; // alternate global pointer |
---|
| 2206 | input rml_irf_swap_global; |
---|
| 2207 | input [1:0] rml_irf_global_tid; |
---|
| 2208 | |
---|
| 2209 | output so; |
---|
| 2210 | output [71:0] irf_byp_rs1_data_d_l; |
---|
| 2211 | output [71:0] irf_byp_rs2_data_d_l; |
---|
| 2212 | output [71:0] irf_byp_rs3_data_d_l; |
---|
| 2213 | output [31:0] irf_byp_rs3h_data_d_l; |
---|
| 2214 | reg [71:0] irf_byp_rs1_data_d; |
---|
| 2215 | reg [71:0] irf_byp_rs2_data_d; |
---|
| 2216 | reg [71:0] irf_byp_rs3_data_d; |
---|
| 2217 | reg [71:0] irf_byp_rs3h_data_d; |
---|
| 2218 | |
---|
| 2219 | reg [71:0] active_window [127:0];// 32x4 72 bit registers |
---|
| 2220 | reg [71:0] locals[255:0]; // 4x8x8 registers |
---|
| 2221 | reg [71:0] evens[127:0]; // 4x4x8 registers |
---|
| 2222 | reg [71:0] odds[127:0]; // 4x4x8 registers |
---|
| 2223 | reg [71:0] globals[127:0]; // 4x4x8 registers |
---|
| 2224 | // registers for manipulating windows |
---|
| 2225 | reg [6:0] active_pointer; |
---|
| 2226 | reg [7:0] regfile_pointer; |
---|
| 2227 | reg [5:0] i; |
---|
| 2228 | |
---|
| 2229 | wire [1:0] ecl_irf_tid_w; // w stage thread |
---|
| 2230 | wire [1:0] ecl_irf_tid_w2; // w2 thread |
---|
| 2231 | wire [4:0] ecl_irf_rd_w; // w destination |
---|
| 2232 | wire [4:0] ecl_irf_rd_w2; // w2 destination |
---|
| 2233 | wire [1:0] ifu_exu_thr_d; // d stage thread |
---|
| 2234 | wire ifu_exu_ren1_d; // read enables for all 3 ports |
---|
| 2235 | wire ifu_exu_ren2_d; |
---|
| 2236 | wire ifu_exu_ren3_d; |
---|
| 2237 | wire [4:0] ifu_exu_rs1_d; // source addresses |
---|
| 2238 | wire [4:0] ifu_exu_rs2_d; |
---|
| 2239 | wire [4:0] ifu_exu_rs3_d; |
---|
| 2240 | wire [6:0] thr_rs1; // these 5 are a combination of the thr and reg |
---|
| 2241 | wire [6:0] thr_rs2; // so that comparison can be done more easily |
---|
| 2242 | wire [6:0] thr_rs3; |
---|
| 2243 | wire [6:0] thr_rs3h; |
---|
| 2244 | wire [6:0] thr_rd_w; |
---|
| 2245 | wire [6:0] thr_rd_w2; |
---|
| 2246 | |
---|
| 2247 | reg [1:0] cwpswap_tid_m; |
---|
| 2248 | reg [1:0] cwpswap_tid_w; |
---|
| 2249 | reg [2:0] old_lo_cwp_m; |
---|
| 2250 | reg [2:0] new_lo_cwp_m; |
---|
| 2251 | reg [2:0] new_lo_cwp_w; |
---|
| 2252 | reg [1:0] old_e_cwp_m; |
---|
| 2253 | reg [1:0] new_e_cwp_m; |
---|
| 2254 | reg [1:0] new_e_cwp_w; |
---|
| 2255 | reg swap_local_m; |
---|
| 2256 | reg swap_local_w; |
---|
| 2257 | reg swap_even_m; |
---|
| 2258 | reg swap_even_w; |
---|
| 2259 | reg swap_odd_m; |
---|
| 2260 | reg swap_odd_w; |
---|
| 2261 | reg kill_restore_d1; |
---|
| 2262 | reg swap_global_d1; |
---|
| 2263 | reg swap_global_d2; |
---|
| 2264 | reg [1:0] global_tid_d1; |
---|
| 2265 | reg [1:0] global_tid_d2; |
---|
| 2266 | reg [1:0] old_agp_d1, |
---|
| 2267 | new_agp_d1, |
---|
| 2268 | new_agp_d2; |
---|
| 2269 | |
---|
| 2270 | reg [71:0] active_win_thr_rd_w_neg; |
---|
| 2271 | reg active_win_thr_rd_w_neg_wr_en; |
---|
| 2272 | reg [6:0] thr_rd_w_neg; |
---|
| 2273 | reg [71:0] active_win_thr_rd_w2_neg; |
---|
| 2274 | reg active_win_thr_rd_w2_neg_wr_en; |
---|
| 2275 | reg [6:0] thr_rd_w2_neg; |
---|
| 2276 | reg rst_tri_en_neg; |
---|
| 2277 | |
---|
| 2278 | wire se; |
---|
| 2279 | wire clk; |
---|
| 2280 | assign clk = rclk & reset_l; |
---|
| 2281 | wire ren1_s; |
---|
| 2282 | wire ren2_s; |
---|
| 2283 | wire ren3_s; |
---|
| 2284 | wire [4:0] rs1_s; |
---|
| 2285 | wire [4:0] rs2_s; |
---|
| 2286 | wire [4:0] rs3_s; |
---|
| 2287 | wire [1:0] tid_s; |
---|
| 2288 | wire [1:0] tid_g; |
---|
| 2289 | wire [1:0] tid_m; |
---|
| 2290 | wire [4:0] rd_m; |
---|
| 2291 | wire [4:0] rd_g; |
---|
| 2292 | wire kill_restore_w; |
---|
| 2293 | wire swap_global_d1_vld; |
---|
| 2294 | wire swap_local_m_vld; |
---|
| 2295 | wire swap_even_m_vld; |
---|
| 2296 | wire swap_odd_m_vld; |
---|
| 2297 | |
---|
| 2298 | 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], |
---|
| 2299 | rd_m[4:0], rd_g[4:0]} = (sehold)? |
---|
| 2300 | {ifu_exu_ren1_d,ifu_exu_ren2_d,ifu_exu_ren3_d,ifu_exu_rs1_d[4:0],ifu_exu_rs2_d[4:0], |
---|
| 2301 | ifu_exu_rs3_d[4:0],ifu_exu_thr_d[1:0],ecl_irf_tid_w2[1:0],ecl_irf_tid_w[1:0], |
---|
| 2302 | ecl_irf_rd_w[4:0],ecl_irf_rd_w2[4:0]}: |
---|
| 2303 | {ifu_exu_ren1_s,ifu_exu_ren2_s,ifu_exu_ren3_s,ifu_exu_rs1_s[4:0],ifu_exu_rs2_s[4:0], |
---|
| 2304 | ifu_exu_rs3_s[4:0],ifu_exu_tid_s2[1:0],ecl_irf_tid_g[1:0],ecl_irf_tid_m[1:0], |
---|
| 2305 | ecl_irf_rd_m[4:0],ecl_irf_rd_g[4:0]}; |
---|
| 2306 | // Pipeline flops for irf control signals |
---|
| 2307 | dff_s dff_ren1_s2d(.din(ren1_s), .clk(clk), .q(ifu_exu_ren1_d), .se(se), |
---|
| 2308 | .si(), .so()); |
---|
| 2309 | dff_s dff_ren2_s2d(.din(ren2_s), .clk(clk), .q(ifu_exu_ren2_d), .se(se), |
---|
| 2310 | .si(), .so()); |
---|
| 2311 | dff_s dff_ren3_s2d(.din(ren3_s), .clk(clk), .q(ifu_exu_ren3_d), .se(se), |
---|
| 2312 | .si(), .so()); |
---|
| 2313 | dff_s #5 dff_rs1_s2d(.din(rs1_s[4:0]), .clk(clk), .q(ifu_exu_rs1_d[4:0]), .se(se), |
---|
| 2314 | .si(),.so()); |
---|
| 2315 | dff_s #5 dff_rs2_s2d(.din(rs2_s[4:0]), .clk(clk), .q(ifu_exu_rs2_d[4:0]), .se(se), |
---|
| 2316 | .si(),.so()); |
---|
| 2317 | dff_s #5 dff_rs3_s2d(.din(rs3_s[4:0]), .clk(clk), .q(ifu_exu_rs3_d[4:0]), .se(se), |
---|
| 2318 | .si(),.so()); |
---|
| 2319 | dff_s #2 dff_thr_s2d(.din(tid_s[1:0]), .clk(clk), .q(ifu_exu_thr_d[1:0]), .se(se), |
---|
| 2320 | .si(),.so()); |
---|
| 2321 | dff_s #2 dff_thr_g2w2(.din(tid_g[1:0]), .clk(clk), .q(ecl_irf_tid_w2[1:0]), .se(se), |
---|
| 2322 | .si(),.so()); |
---|
| 2323 | dff_s #2 dff_thr_m2w(.din(tid_m[1:0]), .clk(clk), .q(ecl_irf_tid_w[1:0]), .se(se), |
---|
| 2324 | .si(),.so()); |
---|
| 2325 | dff_s #5 dff_rd_m2w(.din(rd_m[4:0]), .clk(clk), .q(ecl_irf_rd_w[4:0]), .se(se), |
---|
| 2326 | .si(),.so()); |
---|
| 2327 | dff_s #5 dff_rd_g2w2(.din(rd_g[4:0]), .clk(clk), .q(ecl_irf_rd_w2[4:0]), .se(se), |
---|
| 2328 | .si(),.so()); |
---|
| 2329 | |
---|
| 2330 | // Concatenate the thread and rs1/rd bits together |
---|
| 2331 | assign thr_rs1[6:0] = {ifu_exu_thr_d, ifu_exu_rs1_d}; |
---|
| 2332 | assign thr_rs2[6:0] = {ifu_exu_thr_d, ifu_exu_rs2_d}; |
---|
| 2333 | assign thr_rs3[6:0] = {ifu_exu_thr_d, ifu_exu_rs3_d[4:0]}; |
---|
| 2334 | assign thr_rs3h[6:0] = {ifu_exu_thr_d[1:0], ifu_exu_rs3_d[4:1], 1'b1}; |
---|
| 2335 | assign thr_rd_w[6:0] = {ecl_irf_tid_w, ecl_irf_rd_w}; |
---|
| 2336 | assign thr_rd_w2[6:0] = {ecl_irf_tid_w2, ecl_irf_rd_w2}; |
---|
| 2337 | |
---|
| 2338 | // Active low outputs |
---|
| 2339 | assign irf_byp_rs1_data_d_l[71:0] = ~irf_byp_rs1_data_d[71:0]; |
---|
| 2340 | assign irf_byp_rs2_data_d_l[71:0] = ~irf_byp_rs2_data_d[71:0]; |
---|
| 2341 | assign irf_byp_rs3_data_d_l[71:0] = ~irf_byp_rs3_data_d[71:0]; |
---|
| 2342 | assign irf_byp_rs3h_data_d_l[31:0] = ~irf_byp_rs3h_data_d[31:0]; |
---|
| 2343 | |
---|
| 2344 | // Read port 1 |
---|
| 2345 | always @ ( clk ) begin |
---|
| 2346 | if (clk) irf_byp_rs1_data_d <= {72{1'bx}}; |
---|
| 2347 | else begin |
---|
| 2348 | if (ifu_exu_ren1_d) begin // read enable must be high |
---|
| 2349 | if (thr_rs1[4:0] == 5'b0) irf_byp_rs1_data_d <= {72{1'b0}}; |
---|
| 2350 | else begin |
---|
| 2351 | if ((ecl_irf_wen_w && (thr_rs1 == thr_rd_w)) || // check r/w conflict |
---|
| 2352 | (ecl_irf_wen_w2 && (thr_rs1 == thr_rd_w2))) begin |
---|
| 2353 | irf_byp_rs1_data_d <= {72{1'bx}}; // rw conflict gives x |
---|
| 2354 | end |
---|
| 2355 | else begin |
---|
| 2356 | irf_byp_rs1_data_d <= active_window[thr_rs1[6:0]]; |
---|
| 2357 | end |
---|
| 2358 | end |
---|
| 2359 | end |
---|
| 2360 | // output disabled |
---|
| 2361 | else begin |
---|
| 2362 | irf_byp_rs1_data_d <= {72{1'bx}}; |
---|
| 2363 | end |
---|
| 2364 | end |
---|
| 2365 | end |
---|
| 2366 | |
---|
| 2367 | // Read port 2 |
---|
| 2368 | always @ ( clk ) begin |
---|
| 2369 | if (clk) irf_byp_rs2_data_d <= {72{1'bx}}; |
---|
| 2370 | else begin |
---|
| 2371 | if (ifu_exu_ren2_d) begin |
---|
| 2372 | if (thr_rs2[4:0] == 5'b0) irf_byp_rs2_data_d <= {72{1'b0}}; |
---|
| 2373 | else if ((ecl_irf_wen_w && (thr_rs2 == thr_rd_w)) || |
---|
| 2374 | (ecl_irf_wen_w2 && (thr_rs2 == thr_rd_w2))) |
---|
| 2375 | irf_byp_rs2_data_d <= {72{1'bx}}; |
---|
| 2376 | else begin |
---|
| 2377 | irf_byp_rs2_data_d <= active_window[thr_rs2]; |
---|
| 2378 | end |
---|
| 2379 | end |
---|
| 2380 | // output disabled |
---|
| 2381 | else irf_byp_rs2_data_d <= {72{1'bx}}; |
---|
| 2382 | end |
---|
| 2383 | end |
---|
| 2384 | |
---|
| 2385 | // Read port 3 |
---|
| 2386 | always @ ( clk ) begin |
---|
| 2387 | if (clk) irf_byp_rs3_data_d <= {72{1'bx}}; |
---|
| 2388 | else begin |
---|
| 2389 | if (ifu_exu_ren3_d) begin |
---|
| 2390 | if (thr_rs3[4:0] == 5'b0) irf_byp_rs3_data_d[71:0] <= {72{1'b0}}; |
---|
| 2391 | else if ((ecl_irf_wen_w && (thr_rs3 == thr_rd_w)) || |
---|
| 2392 | (ecl_irf_wen_w2 && (thr_rs3 == thr_rd_w2))) |
---|
| 2393 | begin |
---|
| 2394 | irf_byp_rs3_data_d[71:0] <= {72{1'bx}}; |
---|
| 2395 | end |
---|
| 2396 | else begin |
---|
| 2397 | irf_byp_rs3_data_d[71:0] <= active_window[thr_rs3]; |
---|
| 2398 | end |
---|
| 2399 | end |
---|
| 2400 | // output disabled |
---|
| 2401 | else begin |
---|
| 2402 | irf_byp_rs3_data_d[71:0] <= {72{1'bx}}; |
---|
| 2403 | end |
---|
| 2404 | end |
---|
| 2405 | end |
---|
| 2406 | |
---|
| 2407 | // Read port 3h |
---|
| 2408 | always @ ( clk ) begin |
---|
| 2409 | if (clk) irf_byp_rs3h_data_d[71:0] <= {72{1'bx}}; |
---|
| 2410 | else begin |
---|
| 2411 | if (ifu_exu_ren3_d) begin |
---|
| 2412 | if (thr_rs3h[4:0] == 5'b0) irf_byp_rs3h_data_d[71:0] <= 72'b0; |
---|
| 2413 | else if ((ecl_irf_wen_w && (thr_rs3h == thr_rd_w)) || |
---|
| 2414 | (ecl_irf_wen_w2 && (thr_rs3h == thr_rd_w2))) |
---|
| 2415 | begin |
---|
| 2416 | irf_byp_rs3h_data_d[71:0] <= {72{1'bx}}; |
---|
| 2417 | end |
---|
| 2418 | else begin |
---|
| 2419 | irf_byp_rs3h_data_d[71:0] <= active_window[thr_rs3h]; |
---|
| 2420 | end |
---|
| 2421 | end |
---|
| 2422 | // output disabled |
---|
| 2423 | else begin |
---|
| 2424 | irf_byp_rs3h_data_d[71:0] <= {72{1'bx}}; |
---|
| 2425 | end |
---|
| 2426 | end |
---|
| 2427 | end |
---|
| 2428 | |
---|
| 2429 | ///////////////////////////////////////////////////////////////// |
---|
| 2430 | /// Write ports |
---|
| 2431 | //////////////////////////////////////////////////////////////// |
---|
| 2432 | // This is a latch that works if both wen is high and clk is low |
---|
| 2433 | |
---|
| 2434 | always @(negedge clk) begin |
---|
| 2435 | rst_tri_en_neg <= rst_tri_en; |
---|
| 2436 | // write conflict results in X written to destination |
---|
| 2437 | if (ecl_irf_wen_w & ecl_irf_wen_w2 & (thr_rd_w[6:0] == thr_rd_w2[6:0])) begin |
---|
| 2438 | active_win_thr_rd_w_neg <= {72{1'bx}}; |
---|
| 2439 | thr_rd_w_neg <= thr_rd_w; |
---|
| 2440 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
| 2441 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
| 2442 | end |
---|
| 2443 | else begin |
---|
| 2444 | // W1 write port |
---|
| 2445 | if (ecl_irf_wen_w & (thr_rd_w[4:0] != 5'b0)) begin |
---|
| 2446 | active_win_thr_rd_w_neg <= byp_irf_rd_data_w; |
---|
| 2447 | thr_rd_w_neg <= thr_rd_w; |
---|
| 2448 | active_win_thr_rd_w_neg_wr_en <= 1'b1; |
---|
| 2449 | end |
---|
| 2450 | else |
---|
| 2451 | active_win_thr_rd_w_neg_wr_en <= 1'b0; |
---|
| 2452 | |
---|
| 2453 | // W2 write port |
---|
| 2454 | if (ecl_irf_wen_w2 & (thr_rd_w2[4:0] != 5'b0)) begin |
---|
| 2455 | active_win_thr_rd_w2_neg <= byp_irf_rd_data_w2; |
---|
| 2456 | thr_rd_w2_neg <= thr_rd_w2; |
---|
| 2457 | active_win_thr_rd_w2_neg_wr_en <= 1'b1; |
---|
| 2458 | end |
---|
| 2459 | else |
---|
| 2460 | active_win_thr_rd_w2_neg_wr_en <= 1'b0; |
---|
| 2461 | end |
---|
| 2462 | end |
---|
| 2463 | |
---|
| 2464 | |
---|
| 2465 | |
---|
| 2466 | /* MOVED TO CMP ENVIRONMENT |
---|
| 2467 | initial begin |
---|
| 2468 | // Hardcode R0 to zero |
---|
| 2469 | active_window[{2'b00, 5'b00000}] = 72'b0; |
---|
| 2470 | active_window[{2'b01, 5'b00000}] = 72'b0; |
---|
| 2471 | active_window[{2'b10, 5'b00000}] = 72'b0; |
---|
| 2472 | active_window[{2'b11, 5'b00000}] = 72'b0; |
---|
| 2473 | end |
---|
| 2474 | */ |
---|
| 2475 | ////////////////////////////////////////////////// |
---|
| 2476 | // Window management logic |
---|
| 2477 | ////////////////////////////////////////////////// |
---|
| 2478 | // Pipeline flops for control signals |
---|
| 2479 | |
---|
| 2480 | // cwp swap signals |
---|
| 2481 | assign kill_restore_w = (sehold)? kill_restore_d1: rml_irf_kill_restore_w; |
---|
| 2482 | assign swap_local_m_vld = swap_local_m & ~rst_tri_en; |
---|
| 2483 | assign swap_odd_m_vld = swap_odd_m & ~rst_tri_en; |
---|
| 2484 | assign swap_even_m_vld = swap_even_m & ~rst_tri_en; |
---|
| 2485 | assign swap_global_d1_vld = swap_global_d1 & ~rst_tri_en; |
---|
| 2486 | |
---|
| 2487 | always @ (posedge clk) begin |
---|
| 2488 | cwpswap_tid_m[1:0] <= (sehold)? cwpswap_tid_m[1:0]: rml_irf_cwpswap_tid_e[1:0]; |
---|
| 2489 | cwpswap_tid_w[1:0] <= cwpswap_tid_m[1:0]; |
---|
| 2490 | old_lo_cwp_m[2:0] <= (sehold)? old_lo_cwp_m[2:0]: rml_irf_old_lo_cwp_e[2:0]; |
---|
| 2491 | new_lo_cwp_m[2:0] <= (sehold)? new_lo_cwp_m[2:0]: rml_irf_new_lo_cwp_e[2:0]; |
---|
| 2492 | new_lo_cwp_w[2:0] <= new_lo_cwp_m[2:0]; |
---|
| 2493 | old_e_cwp_m[1:0] <= (sehold)? old_e_cwp_m[1:0]: rml_irf_old_e_cwp_e[2:1]; |
---|
| 2494 | new_e_cwp_m[1:0] <= (sehold)? new_e_cwp_m[1:0]: rml_irf_new_e_cwp_e[2:1]; |
---|
| 2495 | new_e_cwp_w[1:0] <= new_e_cwp_m[1:0]; |
---|
| 2496 | swap_local_m <= (sehold)? swap_local_m & rst_tri_en: rml_irf_swap_local_e; |
---|
| 2497 | swap_local_w <= swap_local_m_vld; |
---|
| 2498 | swap_odd_m <= (sehold)? swap_odd_m & rst_tri_en: rml_irf_swap_odd_e; |
---|
| 2499 | swap_odd_w <= swap_odd_m_vld; |
---|
| 2500 | swap_even_m <= (sehold)? swap_even_m & rst_tri_en: rml_irf_swap_even_e; |
---|
| 2501 | swap_even_w <= swap_even_m_vld; |
---|
| 2502 | kill_restore_d1 <= kill_restore_w; |
---|
| 2503 | end |
---|
| 2504 | // global swap signals |
---|
| 2505 | always @ (posedge clk) begin |
---|
| 2506 | swap_global_d1 <= (sehold)? swap_global_d1 & rst_tri_en: rml_irf_swap_global; |
---|
| 2507 | swap_global_d2 <= swap_global_d1_vld; |
---|
| 2508 | global_tid_d1[1:0] <= (sehold)? global_tid_d1[1:0]: rml_irf_global_tid[1:0]; |
---|
| 2509 | global_tid_d2[1:0] <= global_tid_d1[1:0]; |
---|
| 2510 | old_agp_d1[1:0] <= (sehold)? old_agp_d1[1:0]: rml_irf_old_agp[1:0]; |
---|
| 2511 | new_agp_d1[1:0] <= (sehold)? new_agp_d1[1:0]: rml_irf_new_agp[1:0]; |
---|
| 2512 | new_agp_d2[1:0] <= new_agp_d1[1:0]; |
---|
| 2513 | end |
---|
| 2514 | |
---|
| 2515 | |
---|
| 2516 | ///////////////////////////////////////////// |
---|
| 2517 | // Globals |
---|
| 2518 | //----------------------------------- |
---|
| 2519 | // rml inputs are latched on rising edge |
---|
| 2520 | // 1st cycle used for decode |
---|
| 2521 | // 2nd cycle stores active window in phase 1 |
---|
| 2522 | // 3rd cycle loads new globals in phase 1 |
---|
| 2523 | ///////////////////////////////////////////// |
---|
| 2524 | |
---|
| 2525 | always @ (posedge clk) begin |
---|
| 2526 | |
---|
| 2527 | if (active_win_thr_rd_w_neg_wr_en & (~rst_tri_en | ~rst_tri_en_neg)) begin |
---|
| 2528 | active_window[thr_rd_w_neg] = active_win_thr_rd_w_neg; |
---|
| 2529 | end |
---|
| 2530 | if (active_win_thr_rd_w2_neg_wr_en & (~rst_tri_en | ~rst_tri_en_neg)) begin |
---|
| 2531 | active_window[thr_rd_w2_neg] = active_win_thr_rd_w2_neg; |
---|
| 2532 | end |
---|
| 2533 | // save active globals in phase 1 |
---|
| 2534 | if (swap_global_d1_vld) begin |
---|
| 2535 | for (i = 6'd0; i < 6'd8; i = i + 1) begin |
---|
| 2536 | active_pointer[6:0] = {global_tid_d1[1:0], i[4:0]}; |
---|
| 2537 | regfile_pointer[7:0] = {1'b0, global_tid_d1[1:0], old_agp_d1[1:0], i[2:0]}; |
---|
| 2538 | // prevent back to back swaps on same thread |
---|
| 2539 | if (swap_global_d2 & (global_tid_d1[1:0] == global_tid_d2[1:0])) begin |
---|
| 2540 | globals[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
| 2541 | end |
---|
| 2542 | else globals[regfile_pointer[6:0]] = active_window[active_pointer[6:0]]; |
---|
| 2543 | end |
---|
| 2544 | end |
---|
| 2545 | |
---|
| 2546 | // load in new active globals in phase 2 |
---|
| 2547 | if (swap_global_d2) begin |
---|
| 2548 | for (i = 6'd0; i < 6'd8; i = i + 1) begin |
---|
| 2549 | active_pointer[6:0] = {global_tid_d2[1:0], i[4:0]}; |
---|
| 2550 | regfile_pointer[7:0] = {1'b0, global_tid_d2[1:0], new_agp_d2[1:0], i[2:0]}; |
---|
| 2551 | if (swap_global_d1_vld & (global_tid_d1[1:0] == global_tid_d2[1:0])) begin |
---|
| 2552 | active_window[active_pointer] = {72{1'bx}}; |
---|
| 2553 | globals[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
| 2554 | end |
---|
| 2555 | else active_window[active_pointer] = globals[regfile_pointer[6:0]]; |
---|
| 2556 | end |
---|
| 2557 | end |
---|
| 2558 | |
---|
| 2559 | //////////////////////////// |
---|
| 2560 | // locals, ins and outs |
---|
| 2561 | //------------------------- |
---|
| 2562 | // E - set up inputs to flop |
---|
| 2563 | // M - Decode |
---|
| 2564 | // W (phase 1) - Save |
---|
| 2565 | // W (phase 2) - write is allowed for save because restore will get killed |
---|
| 2566 | // W2 (phase 1) - Restore |
---|
| 2567 | // W2 (phase 2) - write is allowed |
---|
| 2568 | // |
---|
| 2569 | // actions that occur in phase one are modelled as occurring on the |
---|
| 2570 | // rising edge |
---|
| 2571 | // |
---|
| 2572 | // swaps to the same thread in consecutive cycles not allowed |
---|
| 2573 | ///////////////////////////// |
---|
| 2574 | if (swap_local_m_vld) begin |
---|
| 2575 | // save the locals (16-23 in active window) |
---|
| 2576 | for (i = 6'd16; i < 6'd24; i = i + 1) begin |
---|
| 2577 | active_pointer[6:0] = {cwpswap_tid_m[1:0], i[4:0]}; |
---|
| 2578 | regfile_pointer[7:0] = {cwpswap_tid_m[1:0], old_lo_cwp_m[2:0], i[2:0]}; |
---|
| 2579 | if (swap_local_w & ~kill_restore_w & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) |
---|
| 2580 | locals[regfile_pointer[7:0]] = {72{1'bx}}; |
---|
| 2581 | else |
---|
| 2582 | locals[regfile_pointer[7:0]] = active_window[active_pointer]; |
---|
| 2583 | end |
---|
| 2584 | end |
---|
| 2585 | if (swap_even_m_vld) begin |
---|
| 2586 | // save the ins in even window (24-31 in active window) |
---|
| 2587 | for (i = 6'd24; i < 6'd32; i = i + 1) begin |
---|
| 2588 | active_pointer[6:0] = {cwpswap_tid_m[1:0], i[4:0]}; |
---|
| 2589 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_m[1:0], old_e_cwp_m[1:0], i[2:0]}; |
---|
| 2590 | if (swap_even_w & ~kill_restore_w & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) |
---|
| 2591 | evens[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
| 2592 | else |
---|
| 2593 | evens[regfile_pointer[6:0]] = active_window[active_pointer]; |
---|
| 2594 | end |
---|
| 2595 | end |
---|
| 2596 | if (swap_odd_m_vld) begin |
---|
| 2597 | // save the ins in odd window (8-15 in active window) |
---|
| 2598 | for (i = 6'd8; i < 6'd16; i = i + 1) begin |
---|
| 2599 | active_pointer[6:0] = {cwpswap_tid_m[1:0], i[4:0]}; |
---|
| 2600 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_m[1:0], old_lo_cwp_m[2:1], i[2:0]}; |
---|
| 2601 | if (swap_odd_w & ~kill_restore_w & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) |
---|
| 2602 | odds[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
| 2603 | else |
---|
| 2604 | odds[regfile_pointer[6:0]] = active_window[active_pointer]; |
---|
| 2605 | end |
---|
| 2606 | end |
---|
| 2607 | if(~kill_restore_w) begin |
---|
| 2608 | if (swap_local_w) begin |
---|
| 2609 | // restore the locals (16-23 in active window) |
---|
| 2610 | for (i = 6'd16; i < 6'd24; i = i + 1) begin |
---|
| 2611 | active_pointer[6:0] = {cwpswap_tid_w[1:0], i[4:0]}; |
---|
| 2612 | regfile_pointer[7:0] = {cwpswap_tid_w[1:0], new_lo_cwp_w[2:0], i[2:0]}; |
---|
| 2613 | if (swap_local_m_vld & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) begin |
---|
| 2614 | active_window[active_pointer] = {72{1'bx}}; |
---|
| 2615 | locals[regfile_pointer[7:0]] = {72{1'bx}}; |
---|
| 2616 | end |
---|
| 2617 | else |
---|
| 2618 | active_window[active_pointer] = locals[regfile_pointer[7:0]]; |
---|
| 2619 | end |
---|
| 2620 | end |
---|
| 2621 | if (swap_even_w) begin |
---|
| 2622 | // restore the ins in even window (24-32 in active window) |
---|
| 2623 | for (i = 6'd24; i < 6'd32; i = i + 1) begin |
---|
| 2624 | active_pointer[6:0] = {cwpswap_tid_w[1:0], i[4:0]}; |
---|
| 2625 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_w[1:0], new_e_cwp_w[1:0], i[2:0]}; |
---|
| 2626 | if (swap_even_m_vld & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) begin |
---|
| 2627 | active_window[active_pointer] = {72{1'bx}}; |
---|
| 2628 | evens[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
| 2629 | end |
---|
| 2630 | else |
---|
| 2631 | active_window[active_pointer] = evens[regfile_pointer[6:0]]; |
---|
| 2632 | end |
---|
| 2633 | end |
---|
| 2634 | if (swap_odd_w) begin |
---|
| 2635 | // restore the ins in odd window (8-16 in active window) |
---|
| 2636 | for (i = 6'd8; i < 6'd16; i = i + 1) begin |
---|
| 2637 | active_pointer[6:0] = {cwpswap_tid_w[1:0], i[4:0]}; |
---|
| 2638 | regfile_pointer[7:0] = {1'b0, cwpswap_tid_w[1:0], new_lo_cwp_w[2:1], i[2:0]}; |
---|
| 2639 | if (swap_odd_m_vld & (cwpswap_tid_m[1:0] == cwpswap_tid_w[1:0])) begin |
---|
| 2640 | active_window[active_pointer] = {72{1'bx}}; |
---|
| 2641 | odds[regfile_pointer[6:0]] = {72{1'bx}}; |
---|
| 2642 | end |
---|
| 2643 | else |
---|
| 2644 | active_window[active_pointer] = odds[regfile_pointer[6:0]]; |
---|
| 2645 | end |
---|
| 2646 | end |
---|
| 2647 | end |
---|
| 2648 | end // always @ (posedge clk) |
---|
| 2649 | |
---|
| 2650 | endmodule // bw_r_irf |
---|
| 2651 | |
---|
| 2652 | `endif |
---|