Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / verilog / ldst_sync / ldst_dma.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ldst_dma.v
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35`ifndef GATESIM
36
37// State Machine states
38parameter STATE_C0 = 5'h0;
39parameter STATE_C1 = 5'h1;
40parameter STATE_C2 = 5'h2;
41parameter STATE_C3 = 5'h3;
42parameter STATE_C4 = 5'h4;
43parameter STATE_C5 = 5'h5;
44parameter STATE_C6 = 5'h6;
45parameter STATE_C7 = 5'h7;
46parameter STATE_C8 = 5'h8;
47parameter STATE_C9 = 5'h9;
48parameter STATE_C10 = 5'h10;
49parameter STATE_C11 = 5'h11;
50parameter STATE_C12 = 5'h12;
51parameter STATE_C13 = 5'h13;
52parameter STATE_C14 = 5'h14;
53parameter STATE_C15 = 5'h15;
54parameter STATE_C16 = 5'h16;
55parameter STATE_C17 = 5'h17;
56parameter STATE_C18 = 5'h18;
57
58`ifdef NO_L2_BNK0
59`else
60 `ifdef NOL2RTL
61 `else
62
63//==========================================================
64//==========================================================
65// L2 RTL Probes
66
67 //----------------------------------------------------------
68 // Signals for L2 RTL Bank0
69
70 //---------------------
71 // SIU store
72
73 wire b0_cam_hit_c5;
74 reg b0_cam_hit_c52;
75 reg b0_cam_hit_c6;
76 reg b0_cam_hit_c7;
77 reg b0_cam_hit_c8;
78 wire b0_cam_hit;
79 wire b0_inst_valid_c2;
80 wire b0_wr8_inst_c2;
81 wire b0_wr64_inst_c2;
82
83 // If the cam hits, then there will be an eviction sent to the core(s)
84 assign b0_cam_hit_c5 = |`CPU.l2t0.dc_cam_hit;
85 assign b0_cam_hit = b0_cam_hit_c8;
86 assign b0_inst_valid_c2 = `CPU.l2t0.arb.arb_inst_vld_c2;
87 assign b0_wr8_inst_c2 = `CPU.l2t0.arb.arb_decdp_wr8_inst_c2;
88 assign b0_wr64_inst_c2 = `CPU.l2t0.arb.arb_decdp_wr64_inst_c2;
89
90 //---------------------
91 // WR8 signals
92 wire b0_first_pass_c2;
93 reg b0_first_pass_c3;
94 reg b0_first_pass_c4;
95 reg b0_first_pass_c5;
96 reg b0_first_pass_c52;
97 reg b0_first_pass_c6;
98 reg b0_first_pass_c7;
99 reg b0_first_pass_c8;
100 wire b0_first_pass;
101 wire b0_wr8_active_c2;
102 reg b0_wr8_active_c3;
103 reg b0_wr8_active_c4;
104 reg b0_wr8_active_c5;
105 reg b0_wr8_active_c52;
106 reg b0_wr8_active_c6;
107 reg b0_wr8_active_c7;
108 reg b0_wr8_active_c8;
109 wire b0_wr8_active;
110
111 wire [39:0] b0_siu_wr8_pa;
112 wire [63:0] b0_siu_wr8_data;
113 wire [7:0] b0_siu_wr8_size;
114
115 assign b0_wr8_active_c2 = `CPU.l2t0.arb_decdp_wr8_inst_c2;
116 assign b0_wr8_active = b0_wr8_active_c8;
117 assign b0_first_pass_c2 = `CPU.l2t0.arbdec.arbdp_inst_c2[39]==0;
118 assign b0_first_pass = b0_first_pass_c8;
119 assign b0_siu_wr8_pa = `CPU.l2t0.arbadr.arbdp_addr_c8;
120 assign b0_siu_wr8_data = `CPU.l2t0.arbdat.arbdp_inst_data_c8;
121 assign b0_siu_wr8_size = `CPU.l2t0.arbdec.arbdec_arbdp_inst_size_c8;
122
123 //---------------------
124 // WRI signals
125 reg [1:0] b0_pop_index; // Index pointing to next entry to be read from IOWB
126 reg [1:0] b0_push_index; // Index pointing to next entry to be written from IOWB
127
128 wire b0_wr64_active_c2;
129 reg b0_wr64_active_c3;
130 reg b0_wr64_active_c4;
131 reg b0_wr64_active_c5;
132 reg b0_wr64_active_c52;
133 reg b0_wr64_active_c6;
134 reg b0_wr64_active_c7;
135 reg b0_wr64_active_c8;
136 wire b0_wr64_active;
137
138 wire b0_sii_l2t_req_vld;
139 wire [31:0] b0_sii_l2t_req_data;
140 wire b0_rdma_wren;
141 //wire [1:0] b0_rdma_index;
142 //wire [3:0] b0_rdma_valid;
143
144 reg [4:0] b0_state_capture;
145 reg [39:0] b0_siu_pa;
146 reg [31:0] b0_siu_d0;
147 reg [31:0] b0_siu_d1;
148 reg [31:0] b0_siu_d2;
149 reg [31:0] b0_siu_d3;
150 reg [31:0] b0_siu_d4;
151 reg [31:0] b0_siu_d5;
152 reg [31:0] b0_siu_d6;
153 reg [31:0] b0_siu_d7;
154 reg [31:0] b0_siu_d8;
155 reg [31:0] b0_siu_d9;
156 reg [31:0] b0_siu_d10;
157 reg [31:0] b0_siu_d11;
158 reg [31:0] b0_siu_d12;
159 reg [31:0] b0_siu_d13;
160 reg [31:0] b0_siu_d14;
161 reg [31:0] b0_siu_d15;
162
163 // IOWB has 4 entries
164 // Each entry has valid bit, pa, 64 Byte data
165 reg b0_iowb0_valid; // Indicates Bench has captured entire packet
166 reg b0_iowb1_valid;
167 reg b0_iowb2_valid;
168 reg b0_iowb3_valid;
169 reg [39:0] b0_iowb0_pa;
170 reg [39:0] b0_iowb1_pa;
171 reg [39:0] b0_iowb2_pa;
172 reg [39:0] b0_iowb3_pa;
173 reg [31:0] b0_iowb0 [0:15];
174 reg [31:0] b0_iowb1 [0:15];
175 reg [31:0] b0_iowb2 [0:15];
176 reg [31:0] b0_iowb3 [0:15];
177
178 assign b0_sii_l2t_req_vld = `CPU.l2t0.sii_l2t_req_vld;
179 assign b0_sii_l2t_req_data = `CPU.l2t0.sii_l2t_req[31:0];
180
181 assign b0_wr64_active_c2 = b0_inst_valid_c2 & b0_wr64_inst_c2;
182 assign b0_wr64_active = b0_wr64_active_c8;
183
184 // Indicates when rdma_index is valid
185 assign b0_rdma_wren = `CPU.l2b0.evict_l2t_l2b_rdma_wren_s3_v1 |
186 `CPU.l2b0.evict_l2t_l2b_rdma_wren_s3_v2 |
187 `CPU.l2b0.evict_l2t_l2b_rdma_wren_s3_v3 |
188 `CPU.l2b0.evict_l2t_l2b_rdma_wren_s3_v4;
189
190
191 // IOWB entry index = 0,1,2,3
192 //assign b0_rdma_index = `CPU.l2b0.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
193 // Indicates that any future transactions will see this entry's store data.
194 // The bit that is asserted corresponds to the index in the IOWB.
195 //assign b0_rdma_valid = `CPU.l2t0.rdmat.rdma_valid[3:0];
196
197//---------------------
198initial
199 begin
200 b0_pop_index = 2'b0;
201 b0_push_index = 2'b0;
202 b0_state_capture = STATE_C0; // Idle state
203 b0_iowb0_valid = 1'h0;
204 b0_iowb1_valid = 1'h0;
205 b0_iowb2_valid = 1'h0;
206 b0_iowb3_valid = 1'h0;
207 b0_iowb0_pa = 40'h0;
208 b0_iowb1_pa = 40'h0;
209 b0_iowb2_pa = 40'h0;
210 b0_iowb3_pa = 40'h0;
211 b0_siu_pa = 40'h0;
212 b0_siu_d0 = 32'b0;
213 b0_siu_d1 = 32'b0;
214 b0_siu_d2 = 32'b0;
215 b0_siu_d3 = 32'b0;
216 b0_siu_d4 = 32'b0;
217 b0_siu_d5 = 32'b0;
218 b0_siu_d6 = 32'b0;
219 b0_siu_d7 = 32'b0;
220 b0_siu_d8 = 32'b0;
221 b0_siu_d9 = 32'b0;
222 b0_siu_d10 = 32'b0;
223 b0_siu_d11 = 32'b0;
224 b0_siu_d12 = 32'b0;
225 b0_siu_d13 = 32'b0;
226 b0_siu_d14 = 32'b0;
227 b0_siu_d15 = 32'b0;
228 end
229
230//==========================================================
231//==========================================================
232
233always @ (posedge `BENCH_L2T0_GCLK) begin // {
234
235 //------------------------------
236 // Pipeline signals
237
238 //------------------------------
239 // L2 RTL Bank0 (not needed for L2 Stub)
240
241 b0_cam_hit_c52 <= b0_cam_hit_c5;
242 b0_cam_hit_c6 <= b0_cam_hit_c52;
243 b0_cam_hit_c7 <= b0_cam_hit_c6;
244 b0_cam_hit_c8 <= b0_cam_hit_c7;
245
246 b0_first_pass_c3 <= b0_first_pass_c2;
247 b0_first_pass_c4 <= b0_first_pass_c3;
248 b0_first_pass_c5 <= b0_first_pass_c4;
249 b0_first_pass_c52 <= b0_first_pass_c5;
250 b0_first_pass_c6 <= b0_first_pass_c52;
251 b0_first_pass_c7 <= b0_first_pass_c6;
252 b0_first_pass_c8 <= b0_first_pass_c7;
253
254 b0_wr8_active_c3 <= b0_wr8_active_c2;
255 b0_wr8_active_c4 <= b0_wr8_active_c3;
256 b0_wr8_active_c5 <= b0_wr8_active_c4;
257 b0_wr8_active_c52 <= b0_wr8_active_c5;
258 b0_wr8_active_c6 <= b0_wr8_active_c52;
259 b0_wr8_active_c7 <= b0_wr8_active_c6;
260 b0_wr8_active_c8 <= b0_wr8_active_c7;
261
262 b0_wr64_active_c3 <= b0_wr64_active_c2;
263 b0_wr64_active_c4 <= b0_wr64_active_c3;
264 b0_wr64_active_c5 <= b0_wr64_active_c4;
265 b0_wr64_active_c52 <= b0_wr64_active_c5;
266 b0_wr64_active_c6 <= b0_wr64_active_c52;
267 b0_wr64_active_c7 <= b0_wr64_active_c6;
268 b0_wr64_active_c8 <= b0_wr64_active_c7;
269
270 //----------------------------------------------------------
271 //----------------------------------------------------------
272 // SIU Store - WR8
273
274
275 // only do this if the transfers don't match up in c8.
276
277 if (b0_wr8_active && b0_first_pass) begin // {
278 // Send msgs to Riesling
279 dma_store (b0_siu_wr8_pa,b0_siu_wr8_data,b0_siu_wr8_size,b0_cam_hit,8'd8,"B0 WR8");
280 end // }
281
282 //----------------------------------------------------------
283 //----------------------------------------------------------
284 // SIU Store - WRI
285
286 //------------------------------
287 // Send MemorySlam message after SIU transaction is complete
288 // Read IOWB data and Send msgs to Riesling
289
290 if (b0_wr64_active && b0_first_pass) begin // {
291
292 // Determine which of the 8 DMA_STOREs will be evicted.
293 // WRI is 64 Bytes.
294 // Eviction is 16 Bytes at a time.
295 // So, there can be 1-4 Evictions for a single WRI.
296 b0_ev_vect0 = b0_ev_invvect[31:0];
297 b0_ev_vect1 = b0_ev_invvect[55:32];
298 b0_ev_vect2 = b0_ev_invvect[87:56];
299 b0_ev_vect3 = b0_ev_invvect[111:88];
300
301 b0_inv_vect[0] = get_vect(b0_ev_vect0);
302 b0_inv_vect[1] = get_vect31(b0_ev_vect1); // different function for odd inval vector
303 b0_inv_vect[2] = get_vect(b0_ev_vect2);
304 b0_inv_vect[3] = get_vect31(b0_ev_vect3); // different function for odd inval vector
305
306 //Get entry from IOWB and send message
307 b0_chk_valid_entry(b0_pop_index);
308 b0_read_iowb(b0_pop_index,
309 {|b0_inv_vect[3],|b0_inv_vect[2],|b0_inv_vect[1],|b0_inv_vect[0]});
310 b0_pop_index = b0_pop_index + 1;
311 end // }
312
313 //------------------------------
314 // Capture state machine
315 // Capture pa and data (64 Bytes) off SIU to L2 interface.
316 // See SIU MAS (about page 49) for WRI packet format.
317 // Put packet in IOWB which had 4 entries.
318 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
319 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
320
321 case (b0_state_capture)
322
323 // Capture pa (part 1)
324 STATE_C0: begin // {
325 // WRI pkt if req_data[26:24]==3'b100
326 if ((b0_sii_l2t_req_vld)&&(b0_sii_l2t_req_data[26:24]==3'b100)) begin // {
327 b0_siu_pa[39:32] <= b0_sii_l2t_req_data[7:0];
328 b0_state_capture <= STATE_C1;
329 end // }
330 end // }
331
332 // Capture pa (part 2)
333 STATE_C1: begin // {
334 b0_siu_pa[31:0] <= b0_sii_l2t_req_data[31:0];
335 b0_state_capture <= STATE_C2;
336 end // }
337
338 // Capture 4 data bytes
339 STATE_C2: begin // {
340 b0_siu_d0 <= b0_sii_l2t_req_data[31:0];
341 b0_state_capture <= STATE_C3;
342 end // }
343
344 // Capture 4 data bytes
345 STATE_C3: begin // {
346 b0_siu_d1 <= b0_sii_l2t_req_data[31:0];
347 b0_state_capture <= STATE_C4;
348 end // }
349
350 // Capture 4 data bytes
351 STATE_C4: begin // {
352 b0_siu_d2 <= b0_sii_l2t_req_data[31:0];
353 b0_state_capture <= STATE_C5;
354 end // }
355
356 // Capture 4 data bytes
357 STATE_C5: begin // {
358 b0_siu_d3 <= b0_sii_l2t_req_data[31:0];
359 b0_state_capture <= STATE_C6;
360 end // }
361
362 // Capture 4 data bytes
363 STATE_C6: begin // {
364 b0_siu_d4 <= b0_sii_l2t_req_data[31:0];
365 b0_state_capture <= STATE_C7;
366 end // }
367
368 // Capture 4 data bytes
369 STATE_C7: begin // {
370 b0_siu_d5 <= b0_sii_l2t_req_data[31:0];
371 b0_state_capture <= STATE_C8;
372 end // }
373
374 // Capture 4 data bytes
375 STATE_C8: begin // {
376 b0_siu_d6 <= b0_sii_l2t_req_data[31:0];
377 b0_state_capture <= STATE_C9;
378 end // }
379
380 // Capture 4 data bytes
381 STATE_C9: begin // {
382 b0_siu_d7 <= b0_sii_l2t_req_data[31:0];
383 b0_state_capture <= STATE_C10;
384 end // }
385
386 // Capture 4 data bytes
387 STATE_C10: begin // {
388 b0_siu_d8 <= b0_sii_l2t_req_data[31:0];
389 b0_state_capture <= STATE_C11;
390 end // }
391
392 // Capture 4 data bytes
393 STATE_C11: begin // {
394 b0_siu_d9 <= b0_sii_l2t_req_data[31:0];
395 b0_state_capture <= STATE_C12;
396 end // }
397
398 // Capture 4 data bytes
399 STATE_C12: begin // {
400 b0_siu_d10 <= b0_sii_l2t_req_data[31:0];
401 b0_state_capture <= STATE_C13;
402 end // }
403
404 // Capture 4 data bytes
405 STATE_C13: begin // {
406 b0_siu_d11 <= b0_sii_l2t_req_data[31:0];
407 b0_state_capture <= STATE_C14;
408 end // }
409
410 // Capture 4 data bytes
411 STATE_C14: begin // {
412 b0_siu_d12 <= b0_sii_l2t_req_data[31:0];
413 b0_state_capture <= STATE_C15;
414 end // }
415
416 // Capture 4 data bytes
417 STATE_C15: begin // {
418 b0_siu_d13 <= b0_sii_l2t_req_data[31:0];
419 b0_state_capture <= STATE_C16;
420 end // }
421
422 // Capture 4 data bytes
423 STATE_C16: begin // {
424 b0_siu_d14 <= b0_sii_l2t_req_data[31:0];
425 b0_state_capture <= STATE_C17;
426 end // }
427
428 // Capture 4 data bytes
429 STATE_C17: begin // {
430 b0_siu_d15 <= b0_sii_l2t_req_data[31:0];
431 b0_state_capture <= STATE_C18;
432 end // }
433
434 // Save WRI packet (pa and data)x to IOWB
435 STATE_C18: begin // {
436 // Extra check to make sure that RTL is writing to its IOWB, too.
437 if (!b0_rdma_wren) begin // {
438 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b0_rdma_wren is not asserted when it is expected to be asserted.");
439 end // }
440 else begin // {
441 b0_write_iowb (b0_push_index);
442 b0_push_index = b0_push_index + 1;
443 end // }
444 b0_state_capture <= STATE_C0;
445 end // }
446
447 default: begin // {
448 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 0 should not hit default state");
449 end // }
450
451 endcase
452
453end // always}
454
455//----------------------------------------------------------
456// Task to save data captured on SIU -> L2 interface into IOWB
457task b0_write_iowb;
458
459input [1:0] index;
460
461 begin
462 `PR_INFO("ldst_dma",`INFO,"Push to B0 IOWB. index=%d pa=%h D0=%h",
463 index,b0_siu_pa,b0_siu_d0);
464 case (index)
465 2'h0: begin
466 if (b0_iowb0_valid) begin
467 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb0 Overflow.");
468 end
469 else begin
470 b0_iowb0_valid <= 1'b1;
471 end
472
473 b0_iowb0_pa <= b0_siu_pa;
474 b0_iowb0[0] <= b0_siu_d0;
475 b0_iowb0[1] <= b0_siu_d1;
476 b0_iowb0[2] <= b0_siu_d2;
477 b0_iowb0[3] <= b0_siu_d3;
478 b0_iowb0[4] <= b0_siu_d4;
479 b0_iowb0[5] <= b0_siu_d5;
480 b0_iowb0[6] <= b0_siu_d6;
481 b0_iowb0[7] <= b0_siu_d7;
482 b0_iowb0[8] <= b0_siu_d8;
483 b0_iowb0[9] <= b0_siu_d9;
484 b0_iowb0[10] <= b0_siu_d10;
485 b0_iowb0[11] <= b0_siu_d11;
486 b0_iowb0[12] <= b0_siu_d12;
487 b0_iowb0[13] <= b0_siu_d13;
488 b0_iowb0[14] <= b0_siu_d14;
489 b0_iowb0[15] <= b0_siu_d15;
490 end
491 2'h1: begin
492 if (b0_iowb1_valid) begin
493 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb1 Overflow.");
494 end
495 else begin
496 b0_iowb1_valid <= 1'b1;
497 end
498
499 b0_iowb1_pa <= b0_siu_pa;
500 b0_iowb1[0] <= b0_siu_d0;
501 b0_iowb1[1] <= b0_siu_d1;
502 b0_iowb1[2] <= b0_siu_d2;
503 b0_iowb1[3] <= b0_siu_d3;
504 b0_iowb1[4] <= b0_siu_d4;
505 b0_iowb1[5] <= b0_siu_d5;
506 b0_iowb1[6] <= b0_siu_d6;
507 b0_iowb1[7] <= b0_siu_d7;
508 b0_iowb1[8] <= b0_siu_d8;
509 b0_iowb1[9] <= b0_siu_d9;
510 b0_iowb1[10] <= b0_siu_d10;
511 b0_iowb1[11] <= b0_siu_d11;
512 b0_iowb1[12] <= b0_siu_d12;
513 b0_iowb1[13] <= b0_siu_d13;
514 b0_iowb1[14] <= b0_siu_d14;
515 b0_iowb1[15] <= b0_siu_d15;
516 end
517 2'h2: begin
518 if (b0_iowb2_valid) begin
519 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb2 Overflow.");
520 end
521 else begin
522 b0_iowb2_valid <= 1'b1;
523 end
524
525 b0_iowb2_pa <= b0_siu_pa;
526 b0_iowb2[0] <= b0_siu_d0;
527 b0_iowb2[1] <= b0_siu_d1;
528 b0_iowb2[2] <= b0_siu_d2;
529 b0_iowb2[3] <= b0_siu_d3;
530 b0_iowb2[4] <= b0_siu_d4;
531 b0_iowb2[5] <= b0_siu_d5;
532 b0_iowb2[6] <= b0_siu_d6;
533 b0_iowb2[7] <= b0_siu_d7;
534 b0_iowb2[8] <= b0_siu_d8;
535 b0_iowb2[9] <= b0_siu_d9;
536 b0_iowb2[10] <= b0_siu_d10;
537 b0_iowb2[11] <= b0_siu_d11;
538 b0_iowb2[12] <= b0_siu_d12;
539 b0_iowb2[13] <= b0_siu_d13;
540 b0_iowb2[14] <= b0_siu_d14;
541 b0_iowb2[15] <= b0_siu_d15;
542 end
543 2'h3: begin
544 if (b0_iowb3_valid) begin
545 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb3 Overflow.");
546 end
547 else begin
548 b0_iowb3_valid <= 1'b1;
549 end
550
551 b0_iowb3_pa <= b0_siu_pa;
552 b0_iowb3[0] <= b0_siu_d0;
553 b0_iowb3[1] <= b0_siu_d1;
554 b0_iowb3[2] <= b0_siu_d2;
555 b0_iowb3[3] <= b0_siu_d3;
556 b0_iowb3[4] <= b0_siu_d4;
557 b0_iowb3[5] <= b0_siu_d5;
558 b0_iowb3[6] <= b0_siu_d6;
559 b0_iowb3[7] <= b0_siu_d7;
560 b0_iowb3[8] <= b0_siu_d8;
561 b0_iowb3[9] <= b0_siu_d9;
562 b0_iowb3[10] <= b0_siu_d10;
563 b0_iowb3[11] <= b0_siu_d11;
564 b0_iowb3[12] <= b0_siu_d12;
565 b0_iowb3[13] <= b0_siu_d13;
566 b0_iowb3[14] <= b0_siu_d14;
567 b0_iowb3[15] <= b0_siu_d15;
568 end
569 default: begin
570 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
571 end
572 endcase
573
574 end
575endtask
576
577//----------------------------------------------------------
578// Task to read data from IOWB and send to Riesling
579task b0_read_iowb;
580
581input [1:0] index;
582input [3:0] tmp_evict;
583
584 begin
585 case (index)
586 2'h0:
587 begin
588 if (!b0_iowb0_valid) begin
589 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb0 Underflow.");
590 end
591 else begin
592 b0_iowb0_valid <= 1'b0;
593 end
594
595 `PR_INFO("ldst_dma",`INFO,"Pop from B0 IOWB. index=%d pa=%h D0=%h",
596 index,b0_iowb0_pa,b0_iowb0[0]);
597
598 // Call task to send NAS message
599 // Send 8 Bytes at a time
600 dma_store (b0_iowb0_pa, {b0_iowb0[0], b0_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 1");
601 dma_store (b0_iowb0_pa+8, {b0_iowb0[2], b0_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 2");
602 dma_store (b0_iowb0_pa+16,{b0_iowb0[4], b0_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 3");
603 dma_store (b0_iowb0_pa+24,{b0_iowb0[6], b0_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 4");
604 dma_store (b0_iowb0_pa+32,{b0_iowb0[8], b0_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B0 WRI 5");
605 dma_store (b0_iowb0_pa+40,{b0_iowb0[10],b0_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B0 WRI 6");
606 dma_store (b0_iowb0_pa+48,{b0_iowb0[12],b0_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B0 WRI 7");
607 dma_store (b0_iowb0_pa+56,{b0_iowb0[14],b0_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B0 WRI 8");
608 end
609 2'h1:
610 begin
611 if (!b0_iowb1_valid) begin
612 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb1 Underflow.");
613 end
614 else begin
615 b0_iowb1_valid <= 1'b0;
616 end
617
618 `PR_INFO("ldst_dma",`INFO,"Pop from B0 IOWB. index=%d pa=%h D0=%h",
619 index,b0_iowb1_pa,b0_iowb1[0]);
620
621 // Call task to send NAS message
622 // Send 8 Bytes at a time
623 dma_store (b0_iowb1_pa, {b0_iowb1[0], b0_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 1");
624 dma_store (b0_iowb1_pa+8, {b0_iowb1[2], b0_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 2");
625 dma_store (b0_iowb1_pa+16,{b0_iowb1[4], b0_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 3");
626 dma_store (b0_iowb1_pa+24,{b0_iowb1[6], b0_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 4");
627 dma_store (b0_iowb1_pa+32,{b0_iowb1[8], b0_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B0 WRI 5");
628 dma_store (b0_iowb1_pa+40,{b0_iowb1[10],b0_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B0 WRI 6");
629 dma_store (b0_iowb1_pa+48,{b0_iowb1[12],b0_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B0 WRI 7");
630 dma_store (b0_iowb1_pa+56,{b0_iowb1[14],b0_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B0 WRI 8");
631 end
632 2'h2:
633 begin
634 if (!b0_iowb2_valid) begin
635 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb2 Underflow.");
636 end
637 else begin
638 b0_iowb2_valid <= 1'b0;
639 end
640
641 `PR_INFO("ldst_dma",`INFO,"Pop from B0 IOWB. index=%d pa=%h D0=%h",
642 index,b0_iowb2_pa,b0_iowb2[0]);
643
644 // Call task to send NAS message
645 // Send 8 Bytes at a time
646 dma_store (b0_iowb2_pa, {b0_iowb2[0], b0_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 1");
647 dma_store (b0_iowb2_pa+8, {b0_iowb2[2], b0_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 2");
648 dma_store (b0_iowb2_pa+16,{b0_iowb2[4], b0_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 3");
649 dma_store (b0_iowb2_pa+24,{b0_iowb2[6], b0_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 4");
650 dma_store (b0_iowb2_pa+32,{b0_iowb2[8], b0_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B0 WRI 5");
651 dma_store (b0_iowb2_pa+40,{b0_iowb2[10],b0_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B0 WRI 6");
652 dma_store (b0_iowb2_pa+48,{b0_iowb2[12],b0_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B0 WRI 7");
653 dma_store (b0_iowb2_pa+56,{b0_iowb2[14],b0_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B0 WRI 8");
654 end
655 2'h3:
656 begin
657 if (!b0_iowb3_valid) begin
658 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b0_iowb3 Underflow.");
659 end
660 else begin
661 b0_iowb3_valid <= 1'b0;
662 end
663
664 `PR_INFO("ldst_dma",`INFO,"Pop from B0 IOWB. index=%d pa=%h D0=%h",
665 index,b0_iowb3_pa,b0_iowb3[0]);
666
667 // Call task to send NAS message
668 // Send 8 Bytes at a time
669 dma_store (b0_iowb3_pa, {b0_iowb3[0], b0_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 1");
670 dma_store (b0_iowb3_pa+8, {b0_iowb3[2], b0_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B0 WRI 2");
671 dma_store (b0_iowb3_pa+16,{b0_iowb3[4], b0_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 3");
672 dma_store (b0_iowb3_pa+24,{b0_iowb3[6], b0_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B0 WRI 4");
673 dma_store (b0_iowb3_pa+32,{b0_iowb3[8], b0_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B0 WRI 5");
674 dma_store (b0_iowb3_pa+40,{b0_iowb3[10],b0_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B0 WRI 6");
675 dma_store (b0_iowb3_pa+48,{b0_iowb3[12],b0_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B0 WRI 7");
676 dma_store (b0_iowb3_pa+56,{b0_iowb3[14],b0_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B0 WRI 8");
677 end
678 default:
679 begin
680 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
681 end
682 endcase
683
684 end
685endtask
686
687//----------------------------------------------------------
688// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
689task b0_chk_valid_entry;
690
691input [1:0] index;
692
693 begin
694 case (index)
695 2'h0:
696 begin
697 if (b0_iowb0_valid != 1'b1) begin
698 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b0_iowb0_valid!=1'b1)");
699 end
700 end
701 2'h1:
702 begin
703 if (b0_iowb1_valid != 1'b1) begin
704 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b0_iowb1_valid!=1'b1)");
705 end
706 end
707 2'h2:
708 begin
709 if (b0_iowb2_valid != 1'b1) begin
710 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b0_iowb2_valid!=1'b1)");
711 end
712 end
713 2'h3:
714 begin
715 if (b0_iowb3_valid != 1'b1) begin
716 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b0_iowb3_valid!=1'b1)");
717 end
718 end
719 default:
720 begin
721 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
722 end
723 endcase
724 end
725endtask
726
727 `endif // `ifdef NOL2RTL
728`endif // `ifdef NO_L2_BNK0
729
730`ifdef NO_L2_BNK1
731`else
732 `ifdef NOL2RTL
733 `else
734
735//==========================================================
736//==========================================================
737// L2 RTL Probes
738
739 //----------------------------------------------------------
740 // Signals for L2 RTL Bank1
741
742 //---------------------
743 // SIU store
744
745 wire b1_cam_hit_c5;
746 reg b1_cam_hit_c52;
747 reg b1_cam_hit_c6;
748 reg b1_cam_hit_c7;
749 reg b1_cam_hit_c8;
750 wire b1_cam_hit;
751 wire b1_inst_valid_c2;
752 wire b1_wr8_inst_c2;
753 wire b1_wr64_inst_c2;
754
755 // If the cam hits, then there will be an eviction sent to the core(s)
756 assign b1_cam_hit_c5 = |`CPU.l2t1.dc_cam_hit;
757 assign b1_cam_hit = b1_cam_hit_c8;
758 assign b1_inst_valid_c2 = `CPU.l2t1.arb.arb_inst_vld_c2;
759 assign b1_wr8_inst_c2 = `CPU.l2t1.arb.arb_decdp_wr8_inst_c2;
760 assign b1_wr64_inst_c2 = `CPU.l2t1.arb.arb_decdp_wr64_inst_c2;
761
762 //---------------------
763 // WR8 signals
764 wire b1_first_pass_c2;
765 reg b1_first_pass_c3;
766 reg b1_first_pass_c4;
767 reg b1_first_pass_c5;
768 reg b1_first_pass_c52;
769 reg b1_first_pass_c6;
770 reg b1_first_pass_c7;
771 reg b1_first_pass_c8;
772 wire b1_first_pass;
773 wire b1_wr8_active_c2;
774 reg b1_wr8_active_c3;
775 reg b1_wr8_active_c4;
776 reg b1_wr8_active_c5;
777 reg b1_wr8_active_c52;
778 reg b1_wr8_active_c6;
779 reg b1_wr8_active_c7;
780 reg b1_wr8_active_c8;
781 wire b1_wr8_active;
782
783 wire [39:0] b1_siu_wr8_pa;
784 wire [63:0] b1_siu_wr8_data;
785 wire [7:0] b1_siu_wr8_size;
786
787 assign b1_wr8_active_c2 = `CPU.l2t1.arb_decdp_wr8_inst_c2;
788 assign b1_wr8_active = b1_wr8_active_c8;
789 assign b1_first_pass_c2 = `CPU.l2t1.arbdec.arbdp_inst_c2[39]==0;
790 assign b1_first_pass = b1_first_pass_c8;
791 assign b1_siu_wr8_pa = `CPU.l2t1.arbadr.arbdp_addr_c8;
792 assign b1_siu_wr8_data = `CPU.l2t1.arbdat.arbdp_inst_data_c8;
793 assign b1_siu_wr8_size = `CPU.l2t1.arbdec.arbdec_arbdp_inst_size_c8;
794
795 //---------------------
796 // WRI signals
797 reg [1:0] b1_pop_index; // Index pointing to next entry to be read from IOWB
798 reg [1:0] b1_push_index; // Index pointing to next entry to be written from IOWB
799
800 wire b1_wr64_active_c2;
801 reg b1_wr64_active_c3;
802 reg b1_wr64_active_c4;
803 reg b1_wr64_active_c5;
804 reg b1_wr64_active_c52;
805 reg b1_wr64_active_c6;
806 reg b1_wr64_active_c7;
807 reg b1_wr64_active_c8;
808 wire b1_wr64_active;
809
810 wire b1_sii_l2t_req_vld;
811 wire [31:0] b1_sii_l2t_req_data;
812 wire b1_rdma_wren;
813 //wire [1:0] b1_rdma_index;
814 //wire [3:0] b1_rdma_valid;
815
816 reg [4:0] b1_state_capture;
817 reg [39:0] b1_siu_pa;
818 reg [31:0] b1_siu_d0;
819 reg [31:0] b1_siu_d1;
820 reg [31:0] b1_siu_d2;
821 reg [31:0] b1_siu_d3;
822 reg [31:0] b1_siu_d4;
823 reg [31:0] b1_siu_d5;
824 reg [31:0] b1_siu_d6;
825 reg [31:0] b1_siu_d7;
826 reg [31:0] b1_siu_d8;
827 reg [31:0] b1_siu_d9;
828 reg [31:0] b1_siu_d10;
829 reg [31:0] b1_siu_d11;
830 reg [31:0] b1_siu_d12;
831 reg [31:0] b1_siu_d13;
832 reg [31:0] b1_siu_d14;
833 reg [31:0] b1_siu_d15;
834
835 // IOWB has 4 entries
836 // Each entry has valid bit, pa, 64 Byte data
837 reg b1_iowb0_valid; // Indicates Bench has captured entire packet
838 reg b1_iowb1_valid;
839 reg b1_iowb2_valid;
840 reg b1_iowb3_valid;
841 reg [39:0] b1_iowb0_pa;
842 reg [39:0] b1_iowb1_pa;
843 reg [39:0] b1_iowb2_pa;
844 reg [39:0] b1_iowb3_pa;
845 reg [31:0] b1_iowb0 [0:15];
846 reg [31:0] b1_iowb1 [0:15];
847 reg [31:0] b1_iowb2 [0:15];
848 reg [31:0] b1_iowb3 [0:15];
849
850 assign b1_sii_l2t_req_vld = `CPU.l2t1.sii_l2t_req_vld;
851 assign b1_sii_l2t_req_data = `CPU.l2t1.sii_l2t_req[31:0];
852
853 assign b1_wr64_active_c2 = b1_inst_valid_c2 & b1_wr64_inst_c2;
854 assign b1_wr64_active = b1_wr64_active_c8;
855
856 // Indicates when rdma_index is valid
857 assign b1_rdma_wren = `CPU.l2b1.evict_l2t_l2b_rdma_wren_s3_v1 |
858 `CPU.l2b1.evict_l2t_l2b_rdma_wren_s3_v2 |
859 `CPU.l2b1.evict_l2t_l2b_rdma_wren_s3_v3 |
860 `CPU.l2b1.evict_l2t_l2b_rdma_wren_s3_v4;
861
862
863 // IOWB entry index = 0,1,2,3
864 //assign b1_rdma_index = `CPU.l2b1.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
865 // Indicates that any future transactions will see this entry's store data.
866 // The bit that is asserted corresponds to the index in the IOWB.
867 //assign b1_rdma_valid = `CPU.l2t1.rdmat.rdma_valid[3:0];
868
869//---------------------
870initial
871 begin
872 b1_pop_index = 2'b0;
873 b1_push_index = 2'b0;
874 b1_state_capture = STATE_C0; // Idle state
875 b1_iowb0_valid = 1'h0;
876 b1_iowb1_valid = 1'h0;
877 b1_iowb2_valid = 1'h0;
878 b1_iowb3_valid = 1'h0;
879 b1_iowb0_pa = 40'h0;
880 b1_iowb1_pa = 40'h0;
881 b1_iowb2_pa = 40'h0;
882 b1_iowb3_pa = 40'h0;
883 b1_siu_pa = 40'h0;
884 b1_siu_d0 = 32'b0;
885 b1_siu_d1 = 32'b0;
886 b1_siu_d2 = 32'b0;
887 b1_siu_d3 = 32'b0;
888 b1_siu_d4 = 32'b0;
889 b1_siu_d5 = 32'b0;
890 b1_siu_d6 = 32'b0;
891 b1_siu_d7 = 32'b0;
892 b1_siu_d8 = 32'b0;
893 b1_siu_d9 = 32'b0;
894 b1_siu_d10 = 32'b0;
895 b1_siu_d11 = 32'b0;
896 b1_siu_d12 = 32'b0;
897 b1_siu_d13 = 32'b0;
898 b1_siu_d14 = 32'b0;
899 b1_siu_d15 = 32'b0;
900 end
901
902//==========================================================
903//==========================================================
904
905always @ (posedge `BENCH_L2T1_GCLK) begin // {
906
907 //------------------------------
908 // Pipeline signals
909
910 //------------------------------
911 // L2 RTL Bank1 (not needed for L2 Stub)
912
913 b1_cam_hit_c52 <= b1_cam_hit_c5;
914 b1_cam_hit_c6 <= b1_cam_hit_c52;
915 b1_cam_hit_c7 <= b1_cam_hit_c6;
916 b1_cam_hit_c8 <= b1_cam_hit_c7;
917
918 b1_first_pass_c3 <= b1_first_pass_c2;
919 b1_first_pass_c4 <= b1_first_pass_c3;
920 b1_first_pass_c5 <= b1_first_pass_c4;
921 b1_first_pass_c52 <= b1_first_pass_c5;
922 b1_first_pass_c6 <= b1_first_pass_c52;
923 b1_first_pass_c7 <= b1_first_pass_c6;
924 b1_first_pass_c8 <= b1_first_pass_c7;
925
926 b1_wr8_active_c3 <= b1_wr8_active_c2;
927 b1_wr8_active_c4 <= b1_wr8_active_c3;
928 b1_wr8_active_c5 <= b1_wr8_active_c4;
929 b1_wr8_active_c52 <= b1_wr8_active_c5;
930 b1_wr8_active_c6 <= b1_wr8_active_c52;
931 b1_wr8_active_c7 <= b1_wr8_active_c6;
932 b1_wr8_active_c8 <= b1_wr8_active_c7;
933
934 b1_wr64_active_c3 <= b1_wr64_active_c2;
935 b1_wr64_active_c4 <= b1_wr64_active_c3;
936 b1_wr64_active_c5 <= b1_wr64_active_c4;
937 b1_wr64_active_c52 <= b1_wr64_active_c5;
938 b1_wr64_active_c6 <= b1_wr64_active_c52;
939 b1_wr64_active_c7 <= b1_wr64_active_c6;
940 b1_wr64_active_c8 <= b1_wr64_active_c7;
941
942 //----------------------------------------------------------
943 //----------------------------------------------------------
944 // SIU Store - WR8
945
946
947 // only do this if the transfers don't match up in c8.
948
949 if (b1_wr8_active && b1_first_pass) begin // {
950 // Send msgs to Riesling
951 dma_store (b1_siu_wr8_pa,b1_siu_wr8_data,b1_siu_wr8_size,b1_cam_hit,8'd8,"B1 WR8");
952 end // }
953
954 //----------------------------------------------------------
955 //----------------------------------------------------------
956 // SIU Store - WRI
957
958 //------------------------------
959 // Send MemorySlam message after SIU transaction is complete
960 // Read IOWB data and Send msgs to Riesling
961
962 if (b1_wr64_active && b1_first_pass) begin // {
963
964 // Determine which of the 8 DMA_STOREs will be evicted.
965 // WRI is 64 Bytes.
966 // Eviction is 16 Bytes at a time.
967 // So, there can be 1-4 Evictions for a single WRI.
968 b1_ev_vect0 = b1_ev_invvect[31:0];
969 b1_ev_vect1 = b1_ev_invvect[55:32];
970 b1_ev_vect2 = b1_ev_invvect[87:56];
971 b1_ev_vect3 = b1_ev_invvect[111:88];
972
973 b1_inv_vect[0] = get_vect(b1_ev_vect0);
974 b1_inv_vect[1] = get_vect31(b1_ev_vect1); // different function for odd inval vector
975 b1_inv_vect[2] = get_vect(b1_ev_vect2);
976 b1_inv_vect[3] = get_vect31(b1_ev_vect3); // different function for odd inval vector
977
978 //Get entry from IOWB and send message
979 b1_chk_valid_entry(b1_pop_index);
980 b1_read_iowb(b1_pop_index,
981 {|b1_inv_vect[3],|b1_inv_vect[2],|b1_inv_vect[1],|b1_inv_vect[0]});
982 b1_pop_index = b1_pop_index + 1;
983 end // }
984
985 //------------------------------
986 // Capture state machine
987 // Capture pa and data (64 Bytes) off SIU to L2 interface.
988 // See SIU MAS (about page 49) for WRI packet format.
989 // Put packet in IOWB which had 4 entries.
990 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
991 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
992
993 case (b1_state_capture)
994
995 // Capture pa (part 1)
996 STATE_C0: begin // {
997 // WRI pkt if req_data[26:24]==3'b100
998 if ((b1_sii_l2t_req_vld)&&(b1_sii_l2t_req_data[26:24]==3'b100)) begin // {
999 b1_siu_pa[39:32] <= b1_sii_l2t_req_data[7:0];
1000 b1_state_capture <= STATE_C1;
1001 end // }
1002 end // }
1003
1004 // Capture pa (part 2)
1005 STATE_C1: begin // {
1006 b1_siu_pa[31:0] <= b1_sii_l2t_req_data[31:0];
1007 b1_state_capture <= STATE_C2;
1008 end // }
1009
1010 // Capture 4 data bytes
1011 STATE_C2: begin // {
1012 b1_siu_d0 <= b1_sii_l2t_req_data[31:0];
1013 b1_state_capture <= STATE_C3;
1014 end // }
1015
1016 // Capture 4 data bytes
1017 STATE_C3: begin // {
1018 b1_siu_d1 <= b1_sii_l2t_req_data[31:0];
1019 b1_state_capture <= STATE_C4;
1020 end // }
1021
1022 // Capture 4 data bytes
1023 STATE_C4: begin // {
1024 b1_siu_d2 <= b1_sii_l2t_req_data[31:0];
1025 b1_state_capture <= STATE_C5;
1026 end // }
1027
1028 // Capture 4 data bytes
1029 STATE_C5: begin // {
1030 b1_siu_d3 <= b1_sii_l2t_req_data[31:0];
1031 b1_state_capture <= STATE_C6;
1032 end // }
1033
1034 // Capture 4 data bytes
1035 STATE_C6: begin // {
1036 b1_siu_d4 <= b1_sii_l2t_req_data[31:0];
1037 b1_state_capture <= STATE_C7;
1038 end // }
1039
1040 // Capture 4 data bytes
1041 STATE_C7: begin // {
1042 b1_siu_d5 <= b1_sii_l2t_req_data[31:0];
1043 b1_state_capture <= STATE_C8;
1044 end // }
1045
1046 // Capture 4 data bytes
1047 STATE_C8: begin // {
1048 b1_siu_d6 <= b1_sii_l2t_req_data[31:0];
1049 b1_state_capture <= STATE_C9;
1050 end // }
1051
1052 // Capture 4 data bytes
1053 STATE_C9: begin // {
1054 b1_siu_d7 <= b1_sii_l2t_req_data[31:0];
1055 b1_state_capture <= STATE_C10;
1056 end // }
1057
1058 // Capture 4 data bytes
1059 STATE_C10: begin // {
1060 b1_siu_d8 <= b1_sii_l2t_req_data[31:0];
1061 b1_state_capture <= STATE_C11;
1062 end // }
1063
1064 // Capture 4 data bytes
1065 STATE_C11: begin // {
1066 b1_siu_d9 <= b1_sii_l2t_req_data[31:0];
1067 b1_state_capture <= STATE_C12;
1068 end // }
1069
1070 // Capture 4 data bytes
1071 STATE_C12: begin // {
1072 b1_siu_d10 <= b1_sii_l2t_req_data[31:0];
1073 b1_state_capture <= STATE_C13;
1074 end // }
1075
1076 // Capture 4 data bytes
1077 STATE_C13: begin // {
1078 b1_siu_d11 <= b1_sii_l2t_req_data[31:0];
1079 b1_state_capture <= STATE_C14;
1080 end // }
1081
1082 // Capture 4 data bytes
1083 STATE_C14: begin // {
1084 b1_siu_d12 <= b1_sii_l2t_req_data[31:0];
1085 b1_state_capture <= STATE_C15;
1086 end // }
1087
1088 // Capture 4 data bytes
1089 STATE_C15: begin // {
1090 b1_siu_d13 <= b1_sii_l2t_req_data[31:0];
1091 b1_state_capture <= STATE_C16;
1092 end // }
1093
1094 // Capture 4 data bytes
1095 STATE_C16: begin // {
1096 b1_siu_d14 <= b1_sii_l2t_req_data[31:0];
1097 b1_state_capture <= STATE_C17;
1098 end // }
1099
1100 // Capture 4 data bytes
1101 STATE_C17: begin // {
1102 b1_siu_d15 <= b1_sii_l2t_req_data[31:0];
1103 b1_state_capture <= STATE_C18;
1104 end // }
1105
1106 // Save WRI packet (pa and data)x to IOWB
1107 STATE_C18: begin // {
1108 // Extra check to make sure that RTL is writing to its IOWB, too.
1109 if (!b1_rdma_wren) begin // {
1110 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b1_rdma_wren is not asserted when it is expected to be asserted.");
1111 end // }
1112 else begin // {
1113 b1_write_iowb (b1_push_index);
1114 b1_push_index = b1_push_index + 1;
1115 end // }
1116 b1_state_capture <= STATE_C0;
1117 end // }
1118
1119 default: begin // {
1120 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 1 should not hit default state");
1121 end // }
1122
1123 endcase
1124
1125end // always}
1126
1127//----------------------------------------------------------
1128// Task to save data captured on SIU -> L2 interface into IOWB
1129task b1_write_iowb;
1130
1131input [1:0] index;
1132
1133 begin
1134 `PR_INFO("ldst_dma",`INFO,"Push to B1 IOWB. index=%d pa=%h D0=%h",
1135 index,b1_siu_pa,b1_siu_d0);
1136 case (index)
1137 2'h0: begin
1138 if (b1_iowb0_valid) begin
1139 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb0 Overflow.");
1140 end
1141 else begin
1142 b1_iowb0_valid <= 1'b1;
1143 end
1144
1145 b1_iowb0_pa <= b1_siu_pa;
1146 b1_iowb0[0] <= b1_siu_d0;
1147 b1_iowb0[1] <= b1_siu_d1;
1148 b1_iowb0[2] <= b1_siu_d2;
1149 b1_iowb0[3] <= b1_siu_d3;
1150 b1_iowb0[4] <= b1_siu_d4;
1151 b1_iowb0[5] <= b1_siu_d5;
1152 b1_iowb0[6] <= b1_siu_d6;
1153 b1_iowb0[7] <= b1_siu_d7;
1154 b1_iowb0[8] <= b1_siu_d8;
1155 b1_iowb0[9] <= b1_siu_d9;
1156 b1_iowb0[10] <= b1_siu_d10;
1157 b1_iowb0[11] <= b1_siu_d11;
1158 b1_iowb0[12] <= b1_siu_d12;
1159 b1_iowb0[13] <= b1_siu_d13;
1160 b1_iowb0[14] <= b1_siu_d14;
1161 b1_iowb0[15] <= b1_siu_d15;
1162 end
1163 2'h1: begin
1164 if (b1_iowb1_valid) begin
1165 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb1 Overflow.");
1166 end
1167 else begin
1168 b1_iowb1_valid <= 1'b1;
1169 end
1170
1171 b1_iowb1_pa <= b1_siu_pa;
1172 b1_iowb1[0] <= b1_siu_d0;
1173 b1_iowb1[1] <= b1_siu_d1;
1174 b1_iowb1[2] <= b1_siu_d2;
1175 b1_iowb1[3] <= b1_siu_d3;
1176 b1_iowb1[4] <= b1_siu_d4;
1177 b1_iowb1[5] <= b1_siu_d5;
1178 b1_iowb1[6] <= b1_siu_d6;
1179 b1_iowb1[7] <= b1_siu_d7;
1180 b1_iowb1[8] <= b1_siu_d8;
1181 b1_iowb1[9] <= b1_siu_d9;
1182 b1_iowb1[10] <= b1_siu_d10;
1183 b1_iowb1[11] <= b1_siu_d11;
1184 b1_iowb1[12] <= b1_siu_d12;
1185 b1_iowb1[13] <= b1_siu_d13;
1186 b1_iowb1[14] <= b1_siu_d14;
1187 b1_iowb1[15] <= b1_siu_d15;
1188 end
1189 2'h2: begin
1190 if (b1_iowb2_valid) begin
1191 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb2 Overflow.");
1192 end
1193 else begin
1194 b1_iowb2_valid <= 1'b1;
1195 end
1196
1197 b1_iowb2_pa <= b1_siu_pa;
1198 b1_iowb2[0] <= b1_siu_d0;
1199 b1_iowb2[1] <= b1_siu_d1;
1200 b1_iowb2[2] <= b1_siu_d2;
1201 b1_iowb2[3] <= b1_siu_d3;
1202 b1_iowb2[4] <= b1_siu_d4;
1203 b1_iowb2[5] <= b1_siu_d5;
1204 b1_iowb2[6] <= b1_siu_d6;
1205 b1_iowb2[7] <= b1_siu_d7;
1206 b1_iowb2[8] <= b1_siu_d8;
1207 b1_iowb2[9] <= b1_siu_d9;
1208 b1_iowb2[10] <= b1_siu_d10;
1209 b1_iowb2[11] <= b1_siu_d11;
1210 b1_iowb2[12] <= b1_siu_d12;
1211 b1_iowb2[13] <= b1_siu_d13;
1212 b1_iowb2[14] <= b1_siu_d14;
1213 b1_iowb2[15] <= b1_siu_d15;
1214 end
1215 2'h3: begin
1216 if (b1_iowb3_valid) begin
1217 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb3 Overflow.");
1218 end
1219 else begin
1220 b1_iowb3_valid <= 1'b1;
1221 end
1222
1223 b1_iowb3_pa <= b1_siu_pa;
1224 b1_iowb3[0] <= b1_siu_d0;
1225 b1_iowb3[1] <= b1_siu_d1;
1226 b1_iowb3[2] <= b1_siu_d2;
1227 b1_iowb3[3] <= b1_siu_d3;
1228 b1_iowb3[4] <= b1_siu_d4;
1229 b1_iowb3[5] <= b1_siu_d5;
1230 b1_iowb3[6] <= b1_siu_d6;
1231 b1_iowb3[7] <= b1_siu_d7;
1232 b1_iowb3[8] <= b1_siu_d8;
1233 b1_iowb3[9] <= b1_siu_d9;
1234 b1_iowb3[10] <= b1_siu_d10;
1235 b1_iowb3[11] <= b1_siu_d11;
1236 b1_iowb3[12] <= b1_siu_d12;
1237 b1_iowb3[13] <= b1_siu_d13;
1238 b1_iowb3[14] <= b1_siu_d14;
1239 b1_iowb3[15] <= b1_siu_d15;
1240 end
1241 default: begin
1242 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
1243 end
1244 endcase
1245
1246 end
1247endtask
1248
1249//----------------------------------------------------------
1250// Task to read data from IOWB and send to Riesling
1251task b1_read_iowb;
1252
1253input [1:0] index;
1254input [3:0] tmp_evict;
1255
1256 begin
1257 case (index)
1258 2'h0:
1259 begin
1260 if (!b1_iowb0_valid) begin
1261 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb0 Underflow.");
1262 end
1263 else begin
1264 b1_iowb0_valid <= 1'b0;
1265 end
1266
1267 `PR_INFO("ldst_dma",`INFO,"Pop from B1 IOWB. index=%d pa=%h D0=%h",
1268 index,b1_iowb0_pa,b1_iowb0[0]);
1269
1270 // Call task to send NAS message
1271 // Send 8 Bytes at a time
1272 dma_store (b1_iowb0_pa, {b1_iowb0[0], b1_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 1");
1273 dma_store (b1_iowb0_pa+8, {b1_iowb0[2], b1_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 2");
1274 dma_store (b1_iowb0_pa+16,{b1_iowb0[4], b1_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 3");
1275 dma_store (b1_iowb0_pa+24,{b1_iowb0[6], b1_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 4");
1276 dma_store (b1_iowb0_pa+32,{b1_iowb0[8], b1_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B1 WRI 5");
1277 dma_store (b1_iowb0_pa+40,{b1_iowb0[10],b1_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B1 WRI 6");
1278 dma_store (b1_iowb0_pa+48,{b1_iowb0[12],b1_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B1 WRI 7");
1279 dma_store (b1_iowb0_pa+56,{b1_iowb0[14],b1_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B1 WRI 8");
1280 end
1281 2'h1:
1282 begin
1283 if (!b1_iowb1_valid) begin
1284 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb1 Underflow.");
1285 end
1286 else begin
1287 b1_iowb1_valid <= 1'b0;
1288 end
1289
1290 `PR_INFO("ldst_dma",`INFO,"Pop from B1 IOWB. index=%d pa=%h D0=%h",
1291 index,b1_iowb1_pa,b1_iowb1[0]);
1292
1293 // Call task to send NAS message
1294 // Send 8 Bytes at a time
1295 dma_store (b1_iowb1_pa, {b1_iowb1[0], b1_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 1");
1296 dma_store (b1_iowb1_pa+8, {b1_iowb1[2], b1_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 2");
1297 dma_store (b1_iowb1_pa+16,{b1_iowb1[4], b1_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 3");
1298 dma_store (b1_iowb1_pa+24,{b1_iowb1[6], b1_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 4");
1299 dma_store (b1_iowb1_pa+32,{b1_iowb1[8], b1_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B1 WRI 5");
1300 dma_store (b1_iowb1_pa+40,{b1_iowb1[10],b1_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B1 WRI 6");
1301 dma_store (b1_iowb1_pa+48,{b1_iowb1[12],b1_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B1 WRI 7");
1302 dma_store (b1_iowb1_pa+56,{b1_iowb1[14],b1_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B1 WRI 8");
1303 end
1304 2'h2:
1305 begin
1306 if (!b1_iowb2_valid) begin
1307 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb2 Underflow.");
1308 end
1309 else begin
1310 b1_iowb2_valid <= 1'b0;
1311 end
1312
1313 `PR_INFO("ldst_dma",`INFO,"Pop from B1 IOWB. index=%d pa=%h D0=%h",
1314 index,b1_iowb2_pa,b1_iowb2[0]);
1315
1316 // Call task to send NAS message
1317 // Send 8 Bytes at a time
1318 dma_store (b1_iowb2_pa, {b1_iowb2[0], b1_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 1");
1319 dma_store (b1_iowb2_pa+8, {b1_iowb2[2], b1_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 2");
1320 dma_store (b1_iowb2_pa+16,{b1_iowb2[4], b1_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 3");
1321 dma_store (b1_iowb2_pa+24,{b1_iowb2[6], b1_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 4");
1322 dma_store (b1_iowb2_pa+32,{b1_iowb2[8], b1_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B1 WRI 5");
1323 dma_store (b1_iowb2_pa+40,{b1_iowb2[10],b1_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B1 WRI 6");
1324 dma_store (b1_iowb2_pa+48,{b1_iowb2[12],b1_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B1 WRI 7");
1325 dma_store (b1_iowb2_pa+56,{b1_iowb2[14],b1_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B1 WRI 8");
1326 end
1327 2'h3:
1328 begin
1329 if (!b1_iowb3_valid) begin
1330 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b1_iowb3 Underflow.");
1331 end
1332 else begin
1333 b1_iowb3_valid <= 1'b0;
1334 end
1335
1336 `PR_INFO("ldst_dma",`INFO,"Pop from B1 IOWB. index=%d pa=%h D0=%h",
1337 index,b1_iowb3_pa,b1_iowb3[0]);
1338
1339 // Call task to send NAS message
1340 // Send 8 Bytes at a time
1341 dma_store (b1_iowb3_pa, {b1_iowb3[0], b1_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 1");
1342 dma_store (b1_iowb3_pa+8, {b1_iowb3[2], b1_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B1 WRI 2");
1343 dma_store (b1_iowb3_pa+16,{b1_iowb3[4], b1_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 3");
1344 dma_store (b1_iowb3_pa+24,{b1_iowb3[6], b1_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B1 WRI 4");
1345 dma_store (b1_iowb3_pa+32,{b1_iowb3[8], b1_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B1 WRI 5");
1346 dma_store (b1_iowb3_pa+40,{b1_iowb3[10],b1_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B1 WRI 6");
1347 dma_store (b1_iowb3_pa+48,{b1_iowb3[12],b1_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B1 WRI 7");
1348 dma_store (b1_iowb3_pa+56,{b1_iowb3[14],b1_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B1 WRI 8");
1349 end
1350 default:
1351 begin
1352 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
1353 end
1354 endcase
1355
1356 end
1357endtask
1358
1359//----------------------------------------------------------
1360// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
1361task b1_chk_valid_entry;
1362
1363input [1:0] index;
1364
1365 begin
1366 case (index)
1367 2'h0:
1368 begin
1369 if (b1_iowb0_valid != 1'b1) begin
1370 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b1_iowb0_valid!=1'b1)");
1371 end
1372 end
1373 2'h1:
1374 begin
1375 if (b1_iowb1_valid != 1'b1) begin
1376 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b1_iowb1_valid!=1'b1)");
1377 end
1378 end
1379 2'h2:
1380 begin
1381 if (b1_iowb2_valid != 1'b1) begin
1382 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b1_iowb2_valid!=1'b1)");
1383 end
1384 end
1385 2'h3:
1386 begin
1387 if (b1_iowb3_valid != 1'b1) begin
1388 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b1_iowb3_valid!=1'b1)");
1389 end
1390 end
1391 default:
1392 begin
1393 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
1394 end
1395 endcase
1396 end
1397endtask
1398
1399 `endif // `ifdef NOL2RTL
1400`endif // `ifdef NO_L2_BNK1
1401
1402`ifdef NO_L2_BNK2
1403`else
1404 `ifdef NOL2RTL
1405 `else
1406
1407//==========================================================
1408//==========================================================
1409// L2 RTL Probes
1410
1411 //----------------------------------------------------------
1412 // Signals for L2 RTL Bank2
1413
1414 //---------------------
1415 // SIU store
1416
1417 wire b2_cam_hit_c5;
1418 reg b2_cam_hit_c52;
1419 reg b2_cam_hit_c6;
1420 reg b2_cam_hit_c7;
1421 reg b2_cam_hit_c8;
1422 wire b2_cam_hit;
1423 wire b2_inst_valid_c2;
1424 wire b2_wr8_inst_c2;
1425 wire b2_wr64_inst_c2;
1426
1427 // If the cam hits, then there will be an eviction sent to the core(s)
1428 assign b2_cam_hit_c5 = |`CPU.l2t2.dc_cam_hit;
1429 assign b2_cam_hit = b2_cam_hit_c8;
1430 assign b2_inst_valid_c2 = `CPU.l2t2.arb.arb_inst_vld_c2;
1431 assign b2_wr8_inst_c2 = `CPU.l2t2.arb.arb_decdp_wr8_inst_c2;
1432 assign b2_wr64_inst_c2 = `CPU.l2t2.arb.arb_decdp_wr64_inst_c2;
1433
1434 //---------------------
1435 // WR8 signals
1436 wire b2_first_pass_c2;
1437 reg b2_first_pass_c3;
1438 reg b2_first_pass_c4;
1439 reg b2_first_pass_c5;
1440 reg b2_first_pass_c52;
1441 reg b2_first_pass_c6;
1442 reg b2_first_pass_c7;
1443 reg b2_first_pass_c8;
1444 wire b2_first_pass;
1445 wire b2_wr8_active_c2;
1446 reg b2_wr8_active_c3;
1447 reg b2_wr8_active_c4;
1448 reg b2_wr8_active_c5;
1449 reg b2_wr8_active_c52;
1450 reg b2_wr8_active_c6;
1451 reg b2_wr8_active_c7;
1452 reg b2_wr8_active_c8;
1453 wire b2_wr8_active;
1454
1455 wire [39:0] b2_siu_wr8_pa;
1456 wire [63:0] b2_siu_wr8_data;
1457 wire [7:0] b2_siu_wr8_size;
1458
1459 assign b2_wr8_active_c2 = `CPU.l2t2.arb_decdp_wr8_inst_c2;
1460 assign b2_wr8_active = b2_wr8_active_c8;
1461 assign b2_first_pass_c2 = `CPU.l2t2.arbdec.arbdp_inst_c2[39]==0;
1462 assign b2_first_pass = b2_first_pass_c8;
1463 assign b2_siu_wr8_pa = `CPU.l2t2.arbadr.arbdp_addr_c8;
1464 assign b2_siu_wr8_data = `CPU.l2t2.arbdat.arbdp_inst_data_c8;
1465 assign b2_siu_wr8_size = `CPU.l2t2.arbdec.arbdec_arbdp_inst_size_c8;
1466
1467 //---------------------
1468 // WRI signals
1469 reg [1:0] b2_pop_index; // Index pointing to next entry to be read from IOWB
1470 reg [1:0] b2_push_index; // Index pointing to next entry to be written from IOWB
1471
1472 wire b2_wr64_active_c2;
1473 reg b2_wr64_active_c3;
1474 reg b2_wr64_active_c4;
1475 reg b2_wr64_active_c5;
1476 reg b2_wr64_active_c52;
1477 reg b2_wr64_active_c6;
1478 reg b2_wr64_active_c7;
1479 reg b2_wr64_active_c8;
1480 wire b2_wr64_active;
1481
1482 wire b2_sii_l2t_req_vld;
1483 wire [31:0] b2_sii_l2t_req_data;
1484 wire b2_rdma_wren;
1485 //wire [1:0] b2_rdma_index;
1486 //wire [3:0] b2_rdma_valid;
1487
1488 reg [4:0] b2_state_capture;
1489 reg [39:0] b2_siu_pa;
1490 reg [31:0] b2_siu_d0;
1491 reg [31:0] b2_siu_d1;
1492 reg [31:0] b2_siu_d2;
1493 reg [31:0] b2_siu_d3;
1494 reg [31:0] b2_siu_d4;
1495 reg [31:0] b2_siu_d5;
1496 reg [31:0] b2_siu_d6;
1497 reg [31:0] b2_siu_d7;
1498 reg [31:0] b2_siu_d8;
1499 reg [31:0] b2_siu_d9;
1500 reg [31:0] b2_siu_d10;
1501 reg [31:0] b2_siu_d11;
1502 reg [31:0] b2_siu_d12;
1503 reg [31:0] b2_siu_d13;
1504 reg [31:0] b2_siu_d14;
1505 reg [31:0] b2_siu_d15;
1506
1507 // IOWB has 4 entries
1508 // Each entry has valid bit, pa, 64 Byte data
1509 reg b2_iowb0_valid; // Indicates Bench has captured entire packet
1510 reg b2_iowb1_valid;
1511 reg b2_iowb2_valid;
1512 reg b2_iowb3_valid;
1513 reg [39:0] b2_iowb0_pa;
1514 reg [39:0] b2_iowb1_pa;
1515 reg [39:0] b2_iowb2_pa;
1516 reg [39:0] b2_iowb3_pa;
1517 reg [31:0] b2_iowb0 [0:15];
1518 reg [31:0] b2_iowb1 [0:15];
1519 reg [31:0] b2_iowb2 [0:15];
1520 reg [31:0] b2_iowb3 [0:15];
1521
1522 assign b2_sii_l2t_req_vld = `CPU.l2t2.sii_l2t_req_vld;
1523 assign b2_sii_l2t_req_data = `CPU.l2t2.sii_l2t_req[31:0];
1524
1525 assign b2_wr64_active_c2 = b2_inst_valid_c2 & b2_wr64_inst_c2;
1526 assign b2_wr64_active = b2_wr64_active_c8;
1527
1528 // Indicates when rdma_index is valid
1529 assign b2_rdma_wren = `CPU.l2b2.evict_l2t_l2b_rdma_wren_s3_v1 |
1530 `CPU.l2b2.evict_l2t_l2b_rdma_wren_s3_v2 |
1531 `CPU.l2b2.evict_l2t_l2b_rdma_wren_s3_v3 |
1532 `CPU.l2b2.evict_l2t_l2b_rdma_wren_s3_v4;
1533
1534
1535 // IOWB entry index = 0,1,2,3
1536 //assign b2_rdma_index = `CPU.l2b2.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
1537 // Indicates that any future transactions will see this entry's store data.
1538 // The bit that is asserted corresponds to the index in the IOWB.
1539 //assign b2_rdma_valid = `CPU.l2t2.rdmat.rdma_valid[3:0];
1540
1541//---------------------
1542initial
1543 begin
1544 b2_pop_index = 2'b0;
1545 b2_push_index = 2'b0;
1546 b2_state_capture = STATE_C0; // Idle state
1547 b2_iowb0_valid = 1'h0;
1548 b2_iowb1_valid = 1'h0;
1549 b2_iowb2_valid = 1'h0;
1550 b2_iowb3_valid = 1'h0;
1551 b2_iowb0_pa = 40'h0;
1552 b2_iowb1_pa = 40'h0;
1553 b2_iowb2_pa = 40'h0;
1554 b2_iowb3_pa = 40'h0;
1555 b2_siu_pa = 40'h0;
1556 b2_siu_d0 = 32'b0;
1557 b2_siu_d1 = 32'b0;
1558 b2_siu_d2 = 32'b0;
1559 b2_siu_d3 = 32'b0;
1560 b2_siu_d4 = 32'b0;
1561 b2_siu_d5 = 32'b0;
1562 b2_siu_d6 = 32'b0;
1563 b2_siu_d7 = 32'b0;
1564 b2_siu_d8 = 32'b0;
1565 b2_siu_d9 = 32'b0;
1566 b2_siu_d10 = 32'b0;
1567 b2_siu_d11 = 32'b0;
1568 b2_siu_d12 = 32'b0;
1569 b2_siu_d13 = 32'b0;
1570 b2_siu_d14 = 32'b0;
1571 b2_siu_d15 = 32'b0;
1572 end
1573
1574//==========================================================
1575//==========================================================
1576
1577always @ (posedge `BENCH_L2T2_GCLK) begin // {
1578
1579 //------------------------------
1580 // Pipeline signals
1581
1582 //------------------------------
1583 // L2 RTL Bank2 (not needed for L2 Stub)
1584
1585 b2_cam_hit_c52 <= b2_cam_hit_c5;
1586 b2_cam_hit_c6 <= b2_cam_hit_c52;
1587 b2_cam_hit_c7 <= b2_cam_hit_c6;
1588 b2_cam_hit_c8 <= b2_cam_hit_c7;
1589
1590 b2_first_pass_c3 <= b2_first_pass_c2;
1591 b2_first_pass_c4 <= b2_first_pass_c3;
1592 b2_first_pass_c5 <= b2_first_pass_c4;
1593 b2_first_pass_c52 <= b2_first_pass_c5;
1594 b2_first_pass_c6 <= b2_first_pass_c52;
1595 b2_first_pass_c7 <= b2_first_pass_c6;
1596 b2_first_pass_c8 <= b2_first_pass_c7;
1597
1598 b2_wr8_active_c3 <= b2_wr8_active_c2;
1599 b2_wr8_active_c4 <= b2_wr8_active_c3;
1600 b2_wr8_active_c5 <= b2_wr8_active_c4;
1601 b2_wr8_active_c52 <= b2_wr8_active_c5;
1602 b2_wr8_active_c6 <= b2_wr8_active_c52;
1603 b2_wr8_active_c7 <= b2_wr8_active_c6;
1604 b2_wr8_active_c8 <= b2_wr8_active_c7;
1605
1606 b2_wr64_active_c3 <= b2_wr64_active_c2;
1607 b2_wr64_active_c4 <= b2_wr64_active_c3;
1608 b2_wr64_active_c5 <= b2_wr64_active_c4;
1609 b2_wr64_active_c52 <= b2_wr64_active_c5;
1610 b2_wr64_active_c6 <= b2_wr64_active_c52;
1611 b2_wr64_active_c7 <= b2_wr64_active_c6;
1612 b2_wr64_active_c8 <= b2_wr64_active_c7;
1613
1614 //----------------------------------------------------------
1615 //----------------------------------------------------------
1616 // SIU Store - WR8
1617
1618
1619 // only do this if the transfers don't match up in c8.
1620
1621 if (b2_wr8_active && b2_first_pass) begin // {
1622 // Send msgs to Riesling
1623 dma_store (b2_siu_wr8_pa,b2_siu_wr8_data,b2_siu_wr8_size,b2_cam_hit,8'd8,"B2 WR8");
1624 end // }
1625
1626 //----------------------------------------------------------
1627 //----------------------------------------------------------
1628 // SIU Store - WRI
1629
1630 //------------------------------
1631 // Send MemorySlam message after SIU transaction is complete
1632 // Read IOWB data and Send msgs to Riesling
1633
1634 if (b2_wr64_active && b2_first_pass) begin // {
1635
1636 // Determine which of the 8 DMA_STOREs will be evicted.
1637 // WRI is 64 Bytes.
1638 // Eviction is 16 Bytes at a time.
1639 // So, there can be 1-4 Evictions for a single WRI.
1640 b2_ev_vect0 = b2_ev_invvect[31:0];
1641 b2_ev_vect1 = b2_ev_invvect[55:32];
1642 b2_ev_vect2 = b2_ev_invvect[87:56];
1643 b2_ev_vect3 = b2_ev_invvect[111:88];
1644
1645 b2_inv_vect[0] = get_vect(b2_ev_vect0);
1646 b2_inv_vect[1] = get_vect31(b2_ev_vect1); // different function for odd inval vector
1647 b2_inv_vect[2] = get_vect(b2_ev_vect2);
1648 b2_inv_vect[3] = get_vect31(b2_ev_vect3); // different function for odd inval vector
1649
1650 //Get entry from IOWB and send message
1651 b2_chk_valid_entry(b2_pop_index);
1652 b2_read_iowb(b2_pop_index,
1653 {|b2_inv_vect[3],|b2_inv_vect[2],|b2_inv_vect[1],|b2_inv_vect[0]});
1654 b2_pop_index = b2_pop_index + 1;
1655 end // }
1656
1657 //------------------------------
1658 // Capture state machine
1659 // Capture pa and data (64 Bytes) off SIU to L2 interface.
1660 // See SIU MAS (about page 49) for WRI packet format.
1661 // Put packet in IOWB which had 4 entries.
1662 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
1663 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
1664
1665 case (b2_state_capture)
1666
1667 // Capture pa (part 1)
1668 STATE_C0: begin // {
1669 // WRI pkt if req_data[26:24]==3'b100
1670 if ((b2_sii_l2t_req_vld)&&(b2_sii_l2t_req_data[26:24]==3'b100)) begin // {
1671 b2_siu_pa[39:32] <= b2_sii_l2t_req_data[7:0];
1672 b2_state_capture <= STATE_C1;
1673 end // }
1674 end // }
1675
1676 // Capture pa (part 2)
1677 STATE_C1: begin // {
1678 b2_siu_pa[31:0] <= b2_sii_l2t_req_data[31:0];
1679 b2_state_capture <= STATE_C2;
1680 end // }
1681
1682 // Capture 4 data bytes
1683 STATE_C2: begin // {
1684 b2_siu_d0 <= b2_sii_l2t_req_data[31:0];
1685 b2_state_capture <= STATE_C3;
1686 end // }
1687
1688 // Capture 4 data bytes
1689 STATE_C3: begin // {
1690 b2_siu_d1 <= b2_sii_l2t_req_data[31:0];
1691 b2_state_capture <= STATE_C4;
1692 end // }
1693
1694 // Capture 4 data bytes
1695 STATE_C4: begin // {
1696 b2_siu_d2 <= b2_sii_l2t_req_data[31:0];
1697 b2_state_capture <= STATE_C5;
1698 end // }
1699
1700 // Capture 4 data bytes
1701 STATE_C5: begin // {
1702 b2_siu_d3 <= b2_sii_l2t_req_data[31:0];
1703 b2_state_capture <= STATE_C6;
1704 end // }
1705
1706 // Capture 4 data bytes
1707 STATE_C6: begin // {
1708 b2_siu_d4 <= b2_sii_l2t_req_data[31:0];
1709 b2_state_capture <= STATE_C7;
1710 end // }
1711
1712 // Capture 4 data bytes
1713 STATE_C7: begin // {
1714 b2_siu_d5 <= b2_sii_l2t_req_data[31:0];
1715 b2_state_capture <= STATE_C8;
1716 end // }
1717
1718 // Capture 4 data bytes
1719 STATE_C8: begin // {
1720 b2_siu_d6 <= b2_sii_l2t_req_data[31:0];
1721 b2_state_capture <= STATE_C9;
1722 end // }
1723
1724 // Capture 4 data bytes
1725 STATE_C9: begin // {
1726 b2_siu_d7 <= b2_sii_l2t_req_data[31:0];
1727 b2_state_capture <= STATE_C10;
1728 end // }
1729
1730 // Capture 4 data bytes
1731 STATE_C10: begin // {
1732 b2_siu_d8 <= b2_sii_l2t_req_data[31:0];
1733 b2_state_capture <= STATE_C11;
1734 end // }
1735
1736 // Capture 4 data bytes
1737 STATE_C11: begin // {
1738 b2_siu_d9 <= b2_sii_l2t_req_data[31:0];
1739 b2_state_capture <= STATE_C12;
1740 end // }
1741
1742 // Capture 4 data bytes
1743 STATE_C12: begin // {
1744 b2_siu_d10 <= b2_sii_l2t_req_data[31:0];
1745 b2_state_capture <= STATE_C13;
1746 end // }
1747
1748 // Capture 4 data bytes
1749 STATE_C13: begin // {
1750 b2_siu_d11 <= b2_sii_l2t_req_data[31:0];
1751 b2_state_capture <= STATE_C14;
1752 end // }
1753
1754 // Capture 4 data bytes
1755 STATE_C14: begin // {
1756 b2_siu_d12 <= b2_sii_l2t_req_data[31:0];
1757 b2_state_capture <= STATE_C15;
1758 end // }
1759
1760 // Capture 4 data bytes
1761 STATE_C15: begin // {
1762 b2_siu_d13 <= b2_sii_l2t_req_data[31:0];
1763 b2_state_capture <= STATE_C16;
1764 end // }
1765
1766 // Capture 4 data bytes
1767 STATE_C16: begin // {
1768 b2_siu_d14 <= b2_sii_l2t_req_data[31:0];
1769 b2_state_capture <= STATE_C17;
1770 end // }
1771
1772 // Capture 4 data bytes
1773 STATE_C17: begin // {
1774 b2_siu_d15 <= b2_sii_l2t_req_data[31:0];
1775 b2_state_capture <= STATE_C18;
1776 end // }
1777
1778 // Save WRI packet (pa and data)x to IOWB
1779 STATE_C18: begin // {
1780 // Extra check to make sure that RTL is writing to its IOWB, too.
1781 if (!b2_rdma_wren) begin // {
1782 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b2_rdma_wren is not asserted when it is expected to be asserted.");
1783 end // }
1784 else begin // {
1785 b2_write_iowb (b2_push_index);
1786 b2_push_index = b2_push_index + 1;
1787 end // }
1788 b2_state_capture <= STATE_C0;
1789 end // }
1790
1791 default: begin // {
1792 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 2 should not hit default state");
1793 end // }
1794
1795 endcase
1796
1797end // always}
1798
1799//----------------------------------------------------------
1800// Task to save data captured on SIU -> L2 interface into IOWB
1801task b2_write_iowb;
1802
1803input [1:0] index;
1804
1805 begin
1806 `PR_INFO("ldst_dma",`INFO,"Push to B2 IOWB. index=%d pa=%h D0=%h",
1807 index,b2_siu_pa,b2_siu_d0);
1808 case (index)
1809 2'h0: begin
1810 if (b2_iowb0_valid) begin
1811 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb0 Overflow.");
1812 end
1813 else begin
1814 b2_iowb0_valid <= 1'b1;
1815 end
1816
1817 b2_iowb0_pa <= b2_siu_pa;
1818 b2_iowb0[0] <= b2_siu_d0;
1819 b2_iowb0[1] <= b2_siu_d1;
1820 b2_iowb0[2] <= b2_siu_d2;
1821 b2_iowb0[3] <= b2_siu_d3;
1822 b2_iowb0[4] <= b2_siu_d4;
1823 b2_iowb0[5] <= b2_siu_d5;
1824 b2_iowb0[6] <= b2_siu_d6;
1825 b2_iowb0[7] <= b2_siu_d7;
1826 b2_iowb0[8] <= b2_siu_d8;
1827 b2_iowb0[9] <= b2_siu_d9;
1828 b2_iowb0[10] <= b2_siu_d10;
1829 b2_iowb0[11] <= b2_siu_d11;
1830 b2_iowb0[12] <= b2_siu_d12;
1831 b2_iowb0[13] <= b2_siu_d13;
1832 b2_iowb0[14] <= b2_siu_d14;
1833 b2_iowb0[15] <= b2_siu_d15;
1834 end
1835 2'h1: begin
1836 if (b2_iowb1_valid) begin
1837 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb1 Overflow.");
1838 end
1839 else begin
1840 b2_iowb1_valid <= 1'b1;
1841 end
1842
1843 b2_iowb1_pa <= b2_siu_pa;
1844 b2_iowb1[0] <= b2_siu_d0;
1845 b2_iowb1[1] <= b2_siu_d1;
1846 b2_iowb1[2] <= b2_siu_d2;
1847 b2_iowb1[3] <= b2_siu_d3;
1848 b2_iowb1[4] <= b2_siu_d4;
1849 b2_iowb1[5] <= b2_siu_d5;
1850 b2_iowb1[6] <= b2_siu_d6;
1851 b2_iowb1[7] <= b2_siu_d7;
1852 b2_iowb1[8] <= b2_siu_d8;
1853 b2_iowb1[9] <= b2_siu_d9;
1854 b2_iowb1[10] <= b2_siu_d10;
1855 b2_iowb1[11] <= b2_siu_d11;
1856 b2_iowb1[12] <= b2_siu_d12;
1857 b2_iowb1[13] <= b2_siu_d13;
1858 b2_iowb1[14] <= b2_siu_d14;
1859 b2_iowb1[15] <= b2_siu_d15;
1860 end
1861 2'h2: begin
1862 if (b2_iowb2_valid) begin
1863 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb2 Overflow.");
1864 end
1865 else begin
1866 b2_iowb2_valid <= 1'b1;
1867 end
1868
1869 b2_iowb2_pa <= b2_siu_pa;
1870 b2_iowb2[0] <= b2_siu_d0;
1871 b2_iowb2[1] <= b2_siu_d1;
1872 b2_iowb2[2] <= b2_siu_d2;
1873 b2_iowb2[3] <= b2_siu_d3;
1874 b2_iowb2[4] <= b2_siu_d4;
1875 b2_iowb2[5] <= b2_siu_d5;
1876 b2_iowb2[6] <= b2_siu_d6;
1877 b2_iowb2[7] <= b2_siu_d7;
1878 b2_iowb2[8] <= b2_siu_d8;
1879 b2_iowb2[9] <= b2_siu_d9;
1880 b2_iowb2[10] <= b2_siu_d10;
1881 b2_iowb2[11] <= b2_siu_d11;
1882 b2_iowb2[12] <= b2_siu_d12;
1883 b2_iowb2[13] <= b2_siu_d13;
1884 b2_iowb2[14] <= b2_siu_d14;
1885 b2_iowb2[15] <= b2_siu_d15;
1886 end
1887 2'h3: begin
1888 if (b2_iowb3_valid) begin
1889 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb3 Overflow.");
1890 end
1891 else begin
1892 b2_iowb3_valid <= 1'b1;
1893 end
1894
1895 b2_iowb3_pa <= b2_siu_pa;
1896 b2_iowb3[0] <= b2_siu_d0;
1897 b2_iowb3[1] <= b2_siu_d1;
1898 b2_iowb3[2] <= b2_siu_d2;
1899 b2_iowb3[3] <= b2_siu_d3;
1900 b2_iowb3[4] <= b2_siu_d4;
1901 b2_iowb3[5] <= b2_siu_d5;
1902 b2_iowb3[6] <= b2_siu_d6;
1903 b2_iowb3[7] <= b2_siu_d7;
1904 b2_iowb3[8] <= b2_siu_d8;
1905 b2_iowb3[9] <= b2_siu_d9;
1906 b2_iowb3[10] <= b2_siu_d10;
1907 b2_iowb3[11] <= b2_siu_d11;
1908 b2_iowb3[12] <= b2_siu_d12;
1909 b2_iowb3[13] <= b2_siu_d13;
1910 b2_iowb3[14] <= b2_siu_d14;
1911 b2_iowb3[15] <= b2_siu_d15;
1912 end
1913 default: begin
1914 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
1915 end
1916 endcase
1917
1918 end
1919endtask
1920
1921//----------------------------------------------------------
1922// Task to read data from IOWB and send to Riesling
1923task b2_read_iowb;
1924
1925input [1:0] index;
1926input [3:0] tmp_evict;
1927
1928 begin
1929 case (index)
1930 2'h0:
1931 begin
1932 if (!b2_iowb0_valid) begin
1933 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb0 Underflow.");
1934 end
1935 else begin
1936 b2_iowb0_valid <= 1'b0;
1937 end
1938
1939 `PR_INFO("ldst_dma",`INFO,"Pop from B2 IOWB. index=%d pa=%h D0=%h",
1940 index,b2_iowb0_pa,b2_iowb0[0]);
1941
1942 // Call task to send NAS message
1943 // Send 8 Bytes at a time
1944 dma_store (b2_iowb0_pa, {b2_iowb0[0], b2_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 1");
1945 dma_store (b2_iowb0_pa+8, {b2_iowb0[2], b2_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 2");
1946 dma_store (b2_iowb0_pa+16,{b2_iowb0[4], b2_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 3");
1947 dma_store (b2_iowb0_pa+24,{b2_iowb0[6], b2_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 4");
1948 dma_store (b2_iowb0_pa+32,{b2_iowb0[8], b2_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B2 WRI 5");
1949 dma_store (b2_iowb0_pa+40,{b2_iowb0[10],b2_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B2 WRI 6");
1950 dma_store (b2_iowb0_pa+48,{b2_iowb0[12],b2_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B2 WRI 7");
1951 dma_store (b2_iowb0_pa+56,{b2_iowb0[14],b2_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B2 WRI 8");
1952 end
1953 2'h1:
1954 begin
1955 if (!b2_iowb1_valid) begin
1956 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb1 Underflow.");
1957 end
1958 else begin
1959 b2_iowb1_valid <= 1'b0;
1960 end
1961
1962 `PR_INFO("ldst_dma",`INFO,"Pop from B2 IOWB. index=%d pa=%h D0=%h",
1963 index,b2_iowb1_pa,b2_iowb1[0]);
1964
1965 // Call task to send NAS message
1966 // Send 8 Bytes at a time
1967 dma_store (b2_iowb1_pa, {b2_iowb1[0], b2_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 1");
1968 dma_store (b2_iowb1_pa+8, {b2_iowb1[2], b2_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 2");
1969 dma_store (b2_iowb1_pa+16,{b2_iowb1[4], b2_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 3");
1970 dma_store (b2_iowb1_pa+24,{b2_iowb1[6], b2_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 4");
1971 dma_store (b2_iowb1_pa+32,{b2_iowb1[8], b2_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B2 WRI 5");
1972 dma_store (b2_iowb1_pa+40,{b2_iowb1[10],b2_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B2 WRI 6");
1973 dma_store (b2_iowb1_pa+48,{b2_iowb1[12],b2_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B2 WRI 7");
1974 dma_store (b2_iowb1_pa+56,{b2_iowb1[14],b2_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B2 WRI 8");
1975 end
1976 2'h2:
1977 begin
1978 if (!b2_iowb2_valid) begin
1979 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb2 Underflow.");
1980 end
1981 else begin
1982 b2_iowb2_valid <= 1'b0;
1983 end
1984
1985 `PR_INFO("ldst_dma",`INFO,"Pop from B2 IOWB. index=%d pa=%h D0=%h",
1986 index,b2_iowb2_pa,b2_iowb2[0]);
1987
1988 // Call task to send NAS message
1989 // Send 8 Bytes at a time
1990 dma_store (b2_iowb2_pa, {b2_iowb2[0], b2_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 1");
1991 dma_store (b2_iowb2_pa+8, {b2_iowb2[2], b2_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 2");
1992 dma_store (b2_iowb2_pa+16,{b2_iowb2[4], b2_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 3");
1993 dma_store (b2_iowb2_pa+24,{b2_iowb2[6], b2_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 4");
1994 dma_store (b2_iowb2_pa+32,{b2_iowb2[8], b2_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B2 WRI 5");
1995 dma_store (b2_iowb2_pa+40,{b2_iowb2[10],b2_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B2 WRI 6");
1996 dma_store (b2_iowb2_pa+48,{b2_iowb2[12],b2_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B2 WRI 7");
1997 dma_store (b2_iowb2_pa+56,{b2_iowb2[14],b2_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B2 WRI 8");
1998 end
1999 2'h3:
2000 begin
2001 if (!b2_iowb3_valid) begin
2002 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b2_iowb3 Underflow.");
2003 end
2004 else begin
2005 b2_iowb3_valid <= 1'b0;
2006 end
2007
2008 `PR_INFO("ldst_dma",`INFO,"Pop from B2 IOWB. index=%d pa=%h D0=%h",
2009 index,b2_iowb3_pa,b2_iowb3[0]);
2010
2011 // Call task to send NAS message
2012 // Send 8 Bytes at a time
2013 dma_store (b2_iowb3_pa, {b2_iowb3[0], b2_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 1");
2014 dma_store (b2_iowb3_pa+8, {b2_iowb3[2], b2_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B2 WRI 2");
2015 dma_store (b2_iowb3_pa+16,{b2_iowb3[4], b2_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 3");
2016 dma_store (b2_iowb3_pa+24,{b2_iowb3[6], b2_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B2 WRI 4");
2017 dma_store (b2_iowb3_pa+32,{b2_iowb3[8], b2_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B2 WRI 5");
2018 dma_store (b2_iowb3_pa+40,{b2_iowb3[10],b2_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B2 WRI 6");
2019 dma_store (b2_iowb3_pa+48,{b2_iowb3[12],b2_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B2 WRI 7");
2020 dma_store (b2_iowb3_pa+56,{b2_iowb3[14],b2_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B2 WRI 8");
2021 end
2022 default:
2023 begin
2024 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
2025 end
2026 endcase
2027
2028 end
2029endtask
2030
2031//----------------------------------------------------------
2032// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
2033task b2_chk_valid_entry;
2034
2035input [1:0] index;
2036
2037 begin
2038 case (index)
2039 2'h0:
2040 begin
2041 if (b2_iowb0_valid != 1'b1) begin
2042 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b2_iowb0_valid!=1'b1)");
2043 end
2044 end
2045 2'h1:
2046 begin
2047 if (b2_iowb1_valid != 1'b1) begin
2048 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b2_iowb1_valid!=1'b1)");
2049 end
2050 end
2051 2'h2:
2052 begin
2053 if (b2_iowb2_valid != 1'b1) begin
2054 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b2_iowb2_valid!=1'b1)");
2055 end
2056 end
2057 2'h3:
2058 begin
2059 if (b2_iowb3_valid != 1'b1) begin
2060 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b2_iowb3_valid!=1'b1)");
2061 end
2062 end
2063 default:
2064 begin
2065 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
2066 end
2067 endcase
2068 end
2069endtask
2070
2071 `endif // `ifdef NOL2RTL
2072`endif // `ifdef NO_L2_BNK2
2073
2074`ifdef NO_L2_BNK3
2075`else
2076 `ifdef NOL2RTL
2077 `else
2078
2079//==========================================================
2080//==========================================================
2081// L2 RTL Probes
2082
2083 //----------------------------------------------------------
2084 // Signals for L2 RTL Bank3
2085
2086 //---------------------
2087 // SIU store
2088
2089 wire b3_cam_hit_c5;
2090 reg b3_cam_hit_c52;
2091 reg b3_cam_hit_c6;
2092 reg b3_cam_hit_c7;
2093 reg b3_cam_hit_c8;
2094 wire b3_cam_hit;
2095 wire b3_inst_valid_c2;
2096 wire b3_wr8_inst_c2;
2097 wire b3_wr64_inst_c2;
2098
2099 // If the cam hits, then there will be an eviction sent to the core(s)
2100 assign b3_cam_hit_c5 = |`CPU.l2t3.dc_cam_hit;
2101 assign b3_cam_hit = b3_cam_hit_c8;
2102 assign b3_inst_valid_c2 = `CPU.l2t3.arb.arb_inst_vld_c2;
2103 assign b3_wr8_inst_c2 = `CPU.l2t3.arb.arb_decdp_wr8_inst_c2;
2104 assign b3_wr64_inst_c2 = `CPU.l2t3.arb.arb_decdp_wr64_inst_c2;
2105
2106 //---------------------
2107 // WR8 signals
2108 wire b3_first_pass_c2;
2109 reg b3_first_pass_c3;
2110 reg b3_first_pass_c4;
2111 reg b3_first_pass_c5;
2112 reg b3_first_pass_c52;
2113 reg b3_first_pass_c6;
2114 reg b3_first_pass_c7;
2115 reg b3_first_pass_c8;
2116 wire b3_first_pass;
2117 wire b3_wr8_active_c2;
2118 reg b3_wr8_active_c3;
2119 reg b3_wr8_active_c4;
2120 reg b3_wr8_active_c5;
2121 reg b3_wr8_active_c52;
2122 reg b3_wr8_active_c6;
2123 reg b3_wr8_active_c7;
2124 reg b3_wr8_active_c8;
2125 wire b3_wr8_active;
2126
2127 wire [39:0] b3_siu_wr8_pa;
2128 wire [63:0] b3_siu_wr8_data;
2129 wire [7:0] b3_siu_wr8_size;
2130
2131 assign b3_wr8_active_c2 = `CPU.l2t3.arb_decdp_wr8_inst_c2;
2132 assign b3_wr8_active = b3_wr8_active_c8;
2133 assign b3_first_pass_c2 = `CPU.l2t3.arbdec.arbdp_inst_c2[39]==0;
2134 assign b3_first_pass = b3_first_pass_c8;
2135 assign b3_siu_wr8_pa = `CPU.l2t3.arbadr.arbdp_addr_c8;
2136 assign b3_siu_wr8_data = `CPU.l2t3.arbdat.arbdp_inst_data_c8;
2137 assign b3_siu_wr8_size = `CPU.l2t3.arbdec.arbdec_arbdp_inst_size_c8;
2138
2139 //---------------------
2140 // WRI signals
2141 reg [1:0] b3_pop_index; // Index pointing to next entry to be read from IOWB
2142 reg [1:0] b3_push_index; // Index pointing to next entry to be written from IOWB
2143
2144 wire b3_wr64_active_c2;
2145 reg b3_wr64_active_c3;
2146 reg b3_wr64_active_c4;
2147 reg b3_wr64_active_c5;
2148 reg b3_wr64_active_c52;
2149 reg b3_wr64_active_c6;
2150 reg b3_wr64_active_c7;
2151 reg b3_wr64_active_c8;
2152 wire b3_wr64_active;
2153
2154 wire b3_sii_l2t_req_vld;
2155 wire [31:0] b3_sii_l2t_req_data;
2156 wire b3_rdma_wren;
2157 //wire [1:0] b3_rdma_index;
2158 //wire [3:0] b3_rdma_valid;
2159
2160 reg [4:0] b3_state_capture;
2161 reg [39:0] b3_siu_pa;
2162 reg [31:0] b3_siu_d0;
2163 reg [31:0] b3_siu_d1;
2164 reg [31:0] b3_siu_d2;
2165 reg [31:0] b3_siu_d3;
2166 reg [31:0] b3_siu_d4;
2167 reg [31:0] b3_siu_d5;
2168 reg [31:0] b3_siu_d6;
2169 reg [31:0] b3_siu_d7;
2170 reg [31:0] b3_siu_d8;
2171 reg [31:0] b3_siu_d9;
2172 reg [31:0] b3_siu_d10;
2173 reg [31:0] b3_siu_d11;
2174 reg [31:0] b3_siu_d12;
2175 reg [31:0] b3_siu_d13;
2176 reg [31:0] b3_siu_d14;
2177 reg [31:0] b3_siu_d15;
2178
2179 // IOWB has 4 entries
2180 // Each entry has valid bit, pa, 64 Byte data
2181 reg b3_iowb0_valid; // Indicates Bench has captured entire packet
2182 reg b3_iowb1_valid;
2183 reg b3_iowb2_valid;
2184 reg b3_iowb3_valid;
2185 reg [39:0] b3_iowb0_pa;
2186 reg [39:0] b3_iowb1_pa;
2187 reg [39:0] b3_iowb2_pa;
2188 reg [39:0] b3_iowb3_pa;
2189 reg [31:0] b3_iowb0 [0:15];
2190 reg [31:0] b3_iowb1 [0:15];
2191 reg [31:0] b3_iowb2 [0:15];
2192 reg [31:0] b3_iowb3 [0:15];
2193
2194 assign b3_sii_l2t_req_vld = `CPU.l2t3.sii_l2t_req_vld;
2195 assign b3_sii_l2t_req_data = `CPU.l2t3.sii_l2t_req[31:0];
2196
2197 assign b3_wr64_active_c2 = b3_inst_valid_c2 & b3_wr64_inst_c2;
2198 assign b3_wr64_active = b3_wr64_active_c8;
2199
2200 // Indicates when rdma_index is valid
2201 assign b3_rdma_wren = `CPU.l2b3.evict_l2t_l2b_rdma_wren_s3_v1 |
2202 `CPU.l2b3.evict_l2t_l2b_rdma_wren_s3_v2 |
2203 `CPU.l2b3.evict_l2t_l2b_rdma_wren_s3_v3 |
2204 `CPU.l2b3.evict_l2t_l2b_rdma_wren_s3_v4;
2205
2206
2207 // IOWB entry index = 0,1,2,3
2208 //assign b3_rdma_index = `CPU.l2b3.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
2209 // Indicates that any future transactions will see this entry's store data.
2210 // The bit that is asserted corresponds to the index in the IOWB.
2211 //assign b3_rdma_valid = `CPU.l2t3.rdmat.rdma_valid[3:0];
2212
2213//---------------------
2214initial
2215 begin
2216 b3_pop_index = 2'b0;
2217 b3_push_index = 2'b0;
2218 b3_state_capture = STATE_C0; // Idle state
2219 b3_iowb0_valid = 1'h0;
2220 b3_iowb1_valid = 1'h0;
2221 b3_iowb2_valid = 1'h0;
2222 b3_iowb3_valid = 1'h0;
2223 b3_iowb0_pa = 40'h0;
2224 b3_iowb1_pa = 40'h0;
2225 b3_iowb2_pa = 40'h0;
2226 b3_iowb3_pa = 40'h0;
2227 b3_siu_pa = 40'h0;
2228 b3_siu_d0 = 32'b0;
2229 b3_siu_d1 = 32'b0;
2230 b3_siu_d2 = 32'b0;
2231 b3_siu_d3 = 32'b0;
2232 b3_siu_d4 = 32'b0;
2233 b3_siu_d5 = 32'b0;
2234 b3_siu_d6 = 32'b0;
2235 b3_siu_d7 = 32'b0;
2236 b3_siu_d8 = 32'b0;
2237 b3_siu_d9 = 32'b0;
2238 b3_siu_d10 = 32'b0;
2239 b3_siu_d11 = 32'b0;
2240 b3_siu_d12 = 32'b0;
2241 b3_siu_d13 = 32'b0;
2242 b3_siu_d14 = 32'b0;
2243 b3_siu_d15 = 32'b0;
2244 end
2245
2246//==========================================================
2247//==========================================================
2248
2249always @ (posedge `BENCH_L2T3_GCLK) begin // {
2250
2251 //------------------------------
2252 // Pipeline signals
2253
2254 //------------------------------
2255 // L2 RTL Bank3 (not needed for L2 Stub)
2256
2257 b3_cam_hit_c52 <= b3_cam_hit_c5;
2258 b3_cam_hit_c6 <= b3_cam_hit_c52;
2259 b3_cam_hit_c7 <= b3_cam_hit_c6;
2260 b3_cam_hit_c8 <= b3_cam_hit_c7;
2261
2262 b3_first_pass_c3 <= b3_first_pass_c2;
2263 b3_first_pass_c4 <= b3_first_pass_c3;
2264 b3_first_pass_c5 <= b3_first_pass_c4;
2265 b3_first_pass_c52 <= b3_first_pass_c5;
2266 b3_first_pass_c6 <= b3_first_pass_c52;
2267 b3_first_pass_c7 <= b3_first_pass_c6;
2268 b3_first_pass_c8 <= b3_first_pass_c7;
2269
2270 b3_wr8_active_c3 <= b3_wr8_active_c2;
2271 b3_wr8_active_c4 <= b3_wr8_active_c3;
2272 b3_wr8_active_c5 <= b3_wr8_active_c4;
2273 b3_wr8_active_c52 <= b3_wr8_active_c5;
2274 b3_wr8_active_c6 <= b3_wr8_active_c52;
2275 b3_wr8_active_c7 <= b3_wr8_active_c6;
2276 b3_wr8_active_c8 <= b3_wr8_active_c7;
2277
2278 b3_wr64_active_c3 <= b3_wr64_active_c2;
2279 b3_wr64_active_c4 <= b3_wr64_active_c3;
2280 b3_wr64_active_c5 <= b3_wr64_active_c4;
2281 b3_wr64_active_c52 <= b3_wr64_active_c5;
2282 b3_wr64_active_c6 <= b3_wr64_active_c52;
2283 b3_wr64_active_c7 <= b3_wr64_active_c6;
2284 b3_wr64_active_c8 <= b3_wr64_active_c7;
2285
2286 //----------------------------------------------------------
2287 //----------------------------------------------------------
2288 // SIU Store - WR8
2289
2290
2291 // only do this if the transfers don't match up in c8.
2292
2293 if (b3_wr8_active && b3_first_pass) begin // {
2294 // Send msgs to Riesling
2295 dma_store (b3_siu_wr8_pa,b3_siu_wr8_data,b3_siu_wr8_size,b3_cam_hit,8'd8,"B3 WR8");
2296 end // }
2297
2298 //----------------------------------------------------------
2299 //----------------------------------------------------------
2300 // SIU Store - WRI
2301
2302 //------------------------------
2303 // Send MemorySlam message after SIU transaction is complete
2304 // Read IOWB data and Send msgs to Riesling
2305
2306 if (b3_wr64_active && b3_first_pass) begin // {
2307
2308 // Determine which of the 8 DMA_STOREs will be evicted.
2309 // WRI is 64 Bytes.
2310 // Eviction is 16 Bytes at a time.
2311 // So, there can be 1-4 Evictions for a single WRI.
2312 b3_ev_vect0 = b3_ev_invvect[31:0];
2313 b3_ev_vect1 = b3_ev_invvect[55:32];
2314 b3_ev_vect2 = b3_ev_invvect[87:56];
2315 b3_ev_vect3 = b3_ev_invvect[111:88];
2316
2317 b3_inv_vect[0] = get_vect(b3_ev_vect0);
2318 b3_inv_vect[1] = get_vect31(b3_ev_vect1); // different function for odd inval vector
2319 b3_inv_vect[2] = get_vect(b3_ev_vect2);
2320 b3_inv_vect[3] = get_vect31(b3_ev_vect3); // different function for odd inval vector
2321
2322 //Get entry from IOWB and send message
2323 b3_chk_valid_entry(b3_pop_index);
2324 b3_read_iowb(b3_pop_index,
2325 {|b3_inv_vect[3],|b3_inv_vect[2],|b3_inv_vect[1],|b3_inv_vect[0]});
2326 b3_pop_index = b3_pop_index + 1;
2327 end // }
2328
2329 //------------------------------
2330 // Capture state machine
2331 // Capture pa and data (64 Bytes) off SIU to L2 interface.
2332 // See SIU MAS (about page 49) for WRI packet format.
2333 // Put packet in IOWB which had 4 entries.
2334 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
2335 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
2336
2337 case (b3_state_capture)
2338
2339 // Capture pa (part 1)
2340 STATE_C0: begin // {
2341 // WRI pkt if req_data[26:24]==3'b100
2342 if ((b3_sii_l2t_req_vld)&&(b3_sii_l2t_req_data[26:24]==3'b100)) begin // {
2343 b3_siu_pa[39:32] <= b3_sii_l2t_req_data[7:0];
2344 b3_state_capture <= STATE_C1;
2345 end // }
2346 end // }
2347
2348 // Capture pa (part 2)
2349 STATE_C1: begin // {
2350 b3_siu_pa[31:0] <= b3_sii_l2t_req_data[31:0];
2351 b3_state_capture <= STATE_C2;
2352 end // }
2353
2354 // Capture 4 data bytes
2355 STATE_C2: begin // {
2356 b3_siu_d0 <= b3_sii_l2t_req_data[31:0];
2357 b3_state_capture <= STATE_C3;
2358 end // }
2359
2360 // Capture 4 data bytes
2361 STATE_C3: begin // {
2362 b3_siu_d1 <= b3_sii_l2t_req_data[31:0];
2363 b3_state_capture <= STATE_C4;
2364 end // }
2365
2366 // Capture 4 data bytes
2367 STATE_C4: begin // {
2368 b3_siu_d2 <= b3_sii_l2t_req_data[31:0];
2369 b3_state_capture <= STATE_C5;
2370 end // }
2371
2372 // Capture 4 data bytes
2373 STATE_C5: begin // {
2374 b3_siu_d3 <= b3_sii_l2t_req_data[31:0];
2375 b3_state_capture <= STATE_C6;
2376 end // }
2377
2378 // Capture 4 data bytes
2379 STATE_C6: begin // {
2380 b3_siu_d4 <= b3_sii_l2t_req_data[31:0];
2381 b3_state_capture <= STATE_C7;
2382 end // }
2383
2384 // Capture 4 data bytes
2385 STATE_C7: begin // {
2386 b3_siu_d5 <= b3_sii_l2t_req_data[31:0];
2387 b3_state_capture <= STATE_C8;
2388 end // }
2389
2390 // Capture 4 data bytes
2391 STATE_C8: begin // {
2392 b3_siu_d6 <= b3_sii_l2t_req_data[31:0];
2393 b3_state_capture <= STATE_C9;
2394 end // }
2395
2396 // Capture 4 data bytes
2397 STATE_C9: begin // {
2398 b3_siu_d7 <= b3_sii_l2t_req_data[31:0];
2399 b3_state_capture <= STATE_C10;
2400 end // }
2401
2402 // Capture 4 data bytes
2403 STATE_C10: begin // {
2404 b3_siu_d8 <= b3_sii_l2t_req_data[31:0];
2405 b3_state_capture <= STATE_C11;
2406 end // }
2407
2408 // Capture 4 data bytes
2409 STATE_C11: begin // {
2410 b3_siu_d9 <= b3_sii_l2t_req_data[31:0];
2411 b3_state_capture <= STATE_C12;
2412 end // }
2413
2414 // Capture 4 data bytes
2415 STATE_C12: begin // {
2416 b3_siu_d10 <= b3_sii_l2t_req_data[31:0];
2417 b3_state_capture <= STATE_C13;
2418 end // }
2419
2420 // Capture 4 data bytes
2421 STATE_C13: begin // {
2422 b3_siu_d11 <= b3_sii_l2t_req_data[31:0];
2423 b3_state_capture <= STATE_C14;
2424 end // }
2425
2426 // Capture 4 data bytes
2427 STATE_C14: begin // {
2428 b3_siu_d12 <= b3_sii_l2t_req_data[31:0];
2429 b3_state_capture <= STATE_C15;
2430 end // }
2431
2432 // Capture 4 data bytes
2433 STATE_C15: begin // {
2434 b3_siu_d13 <= b3_sii_l2t_req_data[31:0];
2435 b3_state_capture <= STATE_C16;
2436 end // }
2437
2438 // Capture 4 data bytes
2439 STATE_C16: begin // {
2440 b3_siu_d14 <= b3_sii_l2t_req_data[31:0];
2441 b3_state_capture <= STATE_C17;
2442 end // }
2443
2444 // Capture 4 data bytes
2445 STATE_C17: begin // {
2446 b3_siu_d15 <= b3_sii_l2t_req_data[31:0];
2447 b3_state_capture <= STATE_C18;
2448 end // }
2449
2450 // Save WRI packet (pa and data)x to IOWB
2451 STATE_C18: begin // {
2452 // Extra check to make sure that RTL is writing to its IOWB, too.
2453 if (!b3_rdma_wren) begin // {
2454 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b3_rdma_wren is not asserted when it is expected to be asserted.");
2455 end // }
2456 else begin // {
2457 b3_write_iowb (b3_push_index);
2458 b3_push_index = b3_push_index + 1;
2459 end // }
2460 b3_state_capture <= STATE_C0;
2461 end // }
2462
2463 default: begin // {
2464 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 3 should not hit default state");
2465 end // }
2466
2467 endcase
2468
2469end // always}
2470
2471//----------------------------------------------------------
2472// Task to save data captured on SIU -> L2 interface into IOWB
2473task b3_write_iowb;
2474
2475input [1:0] index;
2476
2477 begin
2478 `PR_INFO("ldst_dma",`INFO,"Push to B3 IOWB. index=%d pa=%h D0=%h",
2479 index,b3_siu_pa,b3_siu_d0);
2480 case (index)
2481 2'h0: begin
2482 if (b3_iowb0_valid) begin
2483 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb0 Overflow.");
2484 end
2485 else begin
2486 b3_iowb0_valid <= 1'b1;
2487 end
2488
2489 b3_iowb0_pa <= b3_siu_pa;
2490 b3_iowb0[0] <= b3_siu_d0;
2491 b3_iowb0[1] <= b3_siu_d1;
2492 b3_iowb0[2] <= b3_siu_d2;
2493 b3_iowb0[3] <= b3_siu_d3;
2494 b3_iowb0[4] <= b3_siu_d4;
2495 b3_iowb0[5] <= b3_siu_d5;
2496 b3_iowb0[6] <= b3_siu_d6;
2497 b3_iowb0[7] <= b3_siu_d7;
2498 b3_iowb0[8] <= b3_siu_d8;
2499 b3_iowb0[9] <= b3_siu_d9;
2500 b3_iowb0[10] <= b3_siu_d10;
2501 b3_iowb0[11] <= b3_siu_d11;
2502 b3_iowb0[12] <= b3_siu_d12;
2503 b3_iowb0[13] <= b3_siu_d13;
2504 b3_iowb0[14] <= b3_siu_d14;
2505 b3_iowb0[15] <= b3_siu_d15;
2506 end
2507 2'h1: begin
2508 if (b3_iowb1_valid) begin
2509 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb1 Overflow.");
2510 end
2511 else begin
2512 b3_iowb1_valid <= 1'b1;
2513 end
2514
2515 b3_iowb1_pa <= b3_siu_pa;
2516 b3_iowb1[0] <= b3_siu_d0;
2517 b3_iowb1[1] <= b3_siu_d1;
2518 b3_iowb1[2] <= b3_siu_d2;
2519 b3_iowb1[3] <= b3_siu_d3;
2520 b3_iowb1[4] <= b3_siu_d4;
2521 b3_iowb1[5] <= b3_siu_d5;
2522 b3_iowb1[6] <= b3_siu_d6;
2523 b3_iowb1[7] <= b3_siu_d7;
2524 b3_iowb1[8] <= b3_siu_d8;
2525 b3_iowb1[9] <= b3_siu_d9;
2526 b3_iowb1[10] <= b3_siu_d10;
2527 b3_iowb1[11] <= b3_siu_d11;
2528 b3_iowb1[12] <= b3_siu_d12;
2529 b3_iowb1[13] <= b3_siu_d13;
2530 b3_iowb1[14] <= b3_siu_d14;
2531 b3_iowb1[15] <= b3_siu_d15;
2532 end
2533 2'h2: begin
2534 if (b3_iowb2_valid) begin
2535 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb2 Overflow.");
2536 end
2537 else begin
2538 b3_iowb2_valid <= 1'b1;
2539 end
2540
2541 b3_iowb2_pa <= b3_siu_pa;
2542 b3_iowb2[0] <= b3_siu_d0;
2543 b3_iowb2[1] <= b3_siu_d1;
2544 b3_iowb2[2] <= b3_siu_d2;
2545 b3_iowb2[3] <= b3_siu_d3;
2546 b3_iowb2[4] <= b3_siu_d4;
2547 b3_iowb2[5] <= b3_siu_d5;
2548 b3_iowb2[6] <= b3_siu_d6;
2549 b3_iowb2[7] <= b3_siu_d7;
2550 b3_iowb2[8] <= b3_siu_d8;
2551 b3_iowb2[9] <= b3_siu_d9;
2552 b3_iowb2[10] <= b3_siu_d10;
2553 b3_iowb2[11] <= b3_siu_d11;
2554 b3_iowb2[12] <= b3_siu_d12;
2555 b3_iowb2[13] <= b3_siu_d13;
2556 b3_iowb2[14] <= b3_siu_d14;
2557 b3_iowb2[15] <= b3_siu_d15;
2558 end
2559 2'h3: begin
2560 if (b3_iowb3_valid) begin
2561 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb3 Overflow.");
2562 end
2563 else begin
2564 b3_iowb3_valid <= 1'b1;
2565 end
2566
2567 b3_iowb3_pa <= b3_siu_pa;
2568 b3_iowb3[0] <= b3_siu_d0;
2569 b3_iowb3[1] <= b3_siu_d1;
2570 b3_iowb3[2] <= b3_siu_d2;
2571 b3_iowb3[3] <= b3_siu_d3;
2572 b3_iowb3[4] <= b3_siu_d4;
2573 b3_iowb3[5] <= b3_siu_d5;
2574 b3_iowb3[6] <= b3_siu_d6;
2575 b3_iowb3[7] <= b3_siu_d7;
2576 b3_iowb3[8] <= b3_siu_d8;
2577 b3_iowb3[9] <= b3_siu_d9;
2578 b3_iowb3[10] <= b3_siu_d10;
2579 b3_iowb3[11] <= b3_siu_d11;
2580 b3_iowb3[12] <= b3_siu_d12;
2581 b3_iowb3[13] <= b3_siu_d13;
2582 b3_iowb3[14] <= b3_siu_d14;
2583 b3_iowb3[15] <= b3_siu_d15;
2584 end
2585 default: begin
2586 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
2587 end
2588 endcase
2589
2590 end
2591endtask
2592
2593//----------------------------------------------------------
2594// Task to read data from IOWB and send to Riesling
2595task b3_read_iowb;
2596
2597input [1:0] index;
2598input [3:0] tmp_evict;
2599
2600 begin
2601 case (index)
2602 2'h0:
2603 begin
2604 if (!b3_iowb0_valid) begin
2605 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb0 Underflow.");
2606 end
2607 else begin
2608 b3_iowb0_valid <= 1'b0;
2609 end
2610
2611 `PR_INFO("ldst_dma",`INFO,"Pop from B3 IOWB. index=%d pa=%h D0=%h",
2612 index,b3_iowb0_pa,b3_iowb0[0]);
2613
2614 // Call task to send NAS message
2615 // Send 8 Bytes at a time
2616 dma_store (b3_iowb0_pa, {b3_iowb0[0], b3_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 1");
2617 dma_store (b3_iowb0_pa+8, {b3_iowb0[2], b3_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 2");
2618 dma_store (b3_iowb0_pa+16,{b3_iowb0[4], b3_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 3");
2619 dma_store (b3_iowb0_pa+24,{b3_iowb0[6], b3_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 4");
2620 dma_store (b3_iowb0_pa+32,{b3_iowb0[8], b3_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B3 WRI 5");
2621 dma_store (b3_iowb0_pa+40,{b3_iowb0[10],b3_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B3 WRI 6");
2622 dma_store (b3_iowb0_pa+48,{b3_iowb0[12],b3_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B3 WRI 7");
2623 dma_store (b3_iowb0_pa+56,{b3_iowb0[14],b3_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B3 WRI 8");
2624 end
2625 2'h1:
2626 begin
2627 if (!b3_iowb1_valid) begin
2628 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb1 Underflow.");
2629 end
2630 else begin
2631 b3_iowb1_valid <= 1'b0;
2632 end
2633
2634 `PR_INFO("ldst_dma",`INFO,"Pop from B3 IOWB. index=%d pa=%h D0=%h",
2635 index,b3_iowb1_pa,b3_iowb1[0]);
2636
2637 // Call task to send NAS message
2638 // Send 8 Bytes at a time
2639 dma_store (b3_iowb1_pa, {b3_iowb1[0], b3_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 1");
2640 dma_store (b3_iowb1_pa+8, {b3_iowb1[2], b3_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 2");
2641 dma_store (b3_iowb1_pa+16,{b3_iowb1[4], b3_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 3");
2642 dma_store (b3_iowb1_pa+24,{b3_iowb1[6], b3_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 4");
2643 dma_store (b3_iowb1_pa+32,{b3_iowb1[8], b3_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B3 WRI 5");
2644 dma_store (b3_iowb1_pa+40,{b3_iowb1[10],b3_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B3 WRI 6");
2645 dma_store (b3_iowb1_pa+48,{b3_iowb1[12],b3_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B3 WRI 7");
2646 dma_store (b3_iowb1_pa+56,{b3_iowb1[14],b3_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B3 WRI 8");
2647 end
2648 2'h2:
2649 begin
2650 if (!b3_iowb2_valid) begin
2651 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb2 Underflow.");
2652 end
2653 else begin
2654 b3_iowb2_valid <= 1'b0;
2655 end
2656
2657 `PR_INFO("ldst_dma",`INFO,"Pop from B3 IOWB. index=%d pa=%h D0=%h",
2658 index,b3_iowb2_pa,b3_iowb2[0]);
2659
2660 // Call task to send NAS message
2661 // Send 8 Bytes at a time
2662 dma_store (b3_iowb2_pa, {b3_iowb2[0], b3_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 1");
2663 dma_store (b3_iowb2_pa+8, {b3_iowb2[2], b3_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 2");
2664 dma_store (b3_iowb2_pa+16,{b3_iowb2[4], b3_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 3");
2665 dma_store (b3_iowb2_pa+24,{b3_iowb2[6], b3_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 4");
2666 dma_store (b3_iowb2_pa+32,{b3_iowb2[8], b3_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B3 WRI 5");
2667 dma_store (b3_iowb2_pa+40,{b3_iowb2[10],b3_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B3 WRI 6");
2668 dma_store (b3_iowb2_pa+48,{b3_iowb2[12],b3_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B3 WRI 7");
2669 dma_store (b3_iowb2_pa+56,{b3_iowb2[14],b3_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B3 WRI 8");
2670 end
2671 2'h3:
2672 begin
2673 if (!b3_iowb3_valid) begin
2674 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b3_iowb3 Underflow.");
2675 end
2676 else begin
2677 b3_iowb3_valid <= 1'b0;
2678 end
2679
2680 `PR_INFO("ldst_dma",`INFO,"Pop from B3 IOWB. index=%d pa=%h D0=%h",
2681 index,b3_iowb3_pa,b3_iowb3[0]);
2682
2683 // Call task to send NAS message
2684 // Send 8 Bytes at a time
2685 dma_store (b3_iowb3_pa, {b3_iowb3[0], b3_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 1");
2686 dma_store (b3_iowb3_pa+8, {b3_iowb3[2], b3_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B3 WRI 2");
2687 dma_store (b3_iowb3_pa+16,{b3_iowb3[4], b3_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 3");
2688 dma_store (b3_iowb3_pa+24,{b3_iowb3[6], b3_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B3 WRI 4");
2689 dma_store (b3_iowb3_pa+32,{b3_iowb3[8], b3_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B3 WRI 5");
2690 dma_store (b3_iowb3_pa+40,{b3_iowb3[10],b3_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B3 WRI 6");
2691 dma_store (b3_iowb3_pa+48,{b3_iowb3[12],b3_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B3 WRI 7");
2692 dma_store (b3_iowb3_pa+56,{b3_iowb3[14],b3_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B3 WRI 8");
2693 end
2694 default:
2695 begin
2696 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
2697 end
2698 endcase
2699
2700 end
2701endtask
2702
2703//----------------------------------------------------------
2704// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
2705task b3_chk_valid_entry;
2706
2707input [1:0] index;
2708
2709 begin
2710 case (index)
2711 2'h0:
2712 begin
2713 if (b3_iowb0_valid != 1'b1) begin
2714 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b3_iowb0_valid!=1'b1)");
2715 end
2716 end
2717 2'h1:
2718 begin
2719 if (b3_iowb1_valid != 1'b1) begin
2720 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b3_iowb1_valid!=1'b1)");
2721 end
2722 end
2723 2'h2:
2724 begin
2725 if (b3_iowb2_valid != 1'b1) begin
2726 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b3_iowb2_valid!=1'b1)");
2727 end
2728 end
2729 2'h3:
2730 begin
2731 if (b3_iowb3_valid != 1'b1) begin
2732 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b3_iowb3_valid!=1'b1)");
2733 end
2734 end
2735 default:
2736 begin
2737 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
2738 end
2739 endcase
2740 end
2741endtask
2742
2743 `endif // `ifdef NOL2RTL
2744`endif // `ifdef NO_L2_BNK3
2745
2746`ifdef NO_L2_BNK4
2747`else
2748 `ifdef NOL2RTL
2749 `else
2750
2751//==========================================================
2752//==========================================================
2753// L2 RTL Probes
2754
2755 //----------------------------------------------------------
2756 // Signals for L2 RTL Bank4
2757
2758 //---------------------
2759 // SIU store
2760
2761 wire b4_cam_hit_c5;
2762 reg b4_cam_hit_c52;
2763 reg b4_cam_hit_c6;
2764 reg b4_cam_hit_c7;
2765 reg b4_cam_hit_c8;
2766 wire b4_cam_hit;
2767 wire b4_inst_valid_c2;
2768 wire b4_wr8_inst_c2;
2769 wire b4_wr64_inst_c2;
2770
2771 // If the cam hits, then there will be an eviction sent to the core(s)
2772 assign b4_cam_hit_c5 = |`CPU.l2t4.dc_cam_hit;
2773 assign b4_cam_hit = b4_cam_hit_c8;
2774 assign b4_inst_valid_c2 = `CPU.l2t4.arb.arb_inst_vld_c2;
2775 assign b4_wr8_inst_c2 = `CPU.l2t4.arb.arb_decdp_wr8_inst_c2;
2776 assign b4_wr64_inst_c2 = `CPU.l2t4.arb.arb_decdp_wr64_inst_c2;
2777
2778 //---------------------
2779 // WR8 signals
2780 wire b4_first_pass_c2;
2781 reg b4_first_pass_c3;
2782 reg b4_first_pass_c4;
2783 reg b4_first_pass_c5;
2784 reg b4_first_pass_c52;
2785 reg b4_first_pass_c6;
2786 reg b4_first_pass_c7;
2787 reg b4_first_pass_c8;
2788 wire b4_first_pass;
2789 wire b4_wr8_active_c2;
2790 reg b4_wr8_active_c3;
2791 reg b4_wr8_active_c4;
2792 reg b4_wr8_active_c5;
2793 reg b4_wr8_active_c52;
2794 reg b4_wr8_active_c6;
2795 reg b4_wr8_active_c7;
2796 reg b4_wr8_active_c8;
2797 wire b4_wr8_active;
2798
2799 wire [39:0] b4_siu_wr8_pa;
2800 wire [63:0] b4_siu_wr8_data;
2801 wire [7:0] b4_siu_wr8_size;
2802
2803 assign b4_wr8_active_c2 = `CPU.l2t4.arb_decdp_wr8_inst_c2;
2804 assign b4_wr8_active = b4_wr8_active_c8;
2805 assign b4_first_pass_c2 = `CPU.l2t4.arbdec.arbdp_inst_c2[39]==0;
2806 assign b4_first_pass = b4_first_pass_c8;
2807 assign b4_siu_wr8_pa = `CPU.l2t4.arbadr.arbdp_addr_c8;
2808 assign b4_siu_wr8_data = `CPU.l2t4.arbdat.arbdp_inst_data_c8;
2809 assign b4_siu_wr8_size = `CPU.l2t4.arbdec.arbdec_arbdp_inst_size_c8;
2810
2811 //---------------------
2812 // WRI signals
2813 reg [1:0] b4_pop_index; // Index pointing to next entry to be read from IOWB
2814 reg [1:0] b4_push_index; // Index pointing to next entry to be written from IOWB
2815
2816 wire b4_wr64_active_c2;
2817 reg b4_wr64_active_c3;
2818 reg b4_wr64_active_c4;
2819 reg b4_wr64_active_c5;
2820 reg b4_wr64_active_c52;
2821 reg b4_wr64_active_c6;
2822 reg b4_wr64_active_c7;
2823 reg b4_wr64_active_c8;
2824 wire b4_wr64_active;
2825
2826 wire b4_sii_l2t_req_vld;
2827 wire [31:0] b4_sii_l2t_req_data;
2828 wire b4_rdma_wren;
2829 //wire [1:0] b4_rdma_index;
2830 //wire [3:0] b4_rdma_valid;
2831
2832 reg [4:0] b4_state_capture;
2833 reg [39:0] b4_siu_pa;
2834 reg [31:0] b4_siu_d0;
2835 reg [31:0] b4_siu_d1;
2836 reg [31:0] b4_siu_d2;
2837 reg [31:0] b4_siu_d3;
2838 reg [31:0] b4_siu_d4;
2839 reg [31:0] b4_siu_d5;
2840 reg [31:0] b4_siu_d6;
2841 reg [31:0] b4_siu_d7;
2842 reg [31:0] b4_siu_d8;
2843 reg [31:0] b4_siu_d9;
2844 reg [31:0] b4_siu_d10;
2845 reg [31:0] b4_siu_d11;
2846 reg [31:0] b4_siu_d12;
2847 reg [31:0] b4_siu_d13;
2848 reg [31:0] b4_siu_d14;
2849 reg [31:0] b4_siu_d15;
2850
2851 // IOWB has 4 entries
2852 // Each entry has valid bit, pa, 64 Byte data
2853 reg b4_iowb0_valid; // Indicates Bench has captured entire packet
2854 reg b4_iowb1_valid;
2855 reg b4_iowb2_valid;
2856 reg b4_iowb3_valid;
2857 reg [39:0] b4_iowb0_pa;
2858 reg [39:0] b4_iowb1_pa;
2859 reg [39:0] b4_iowb2_pa;
2860 reg [39:0] b4_iowb3_pa;
2861 reg [31:0] b4_iowb0 [0:15];
2862 reg [31:0] b4_iowb1 [0:15];
2863 reg [31:0] b4_iowb2 [0:15];
2864 reg [31:0] b4_iowb3 [0:15];
2865
2866 assign b4_sii_l2t_req_vld = `CPU.l2t4.sii_l2t_req_vld;
2867 assign b4_sii_l2t_req_data = `CPU.l2t4.sii_l2t_req[31:0];
2868
2869 assign b4_wr64_active_c2 = b4_inst_valid_c2 & b4_wr64_inst_c2;
2870 assign b4_wr64_active = b4_wr64_active_c8;
2871
2872 // Indicates when rdma_index is valid
2873 assign b4_rdma_wren = `CPU.l2b4.evict_l2t_l2b_rdma_wren_s3_v1 |
2874 `CPU.l2b4.evict_l2t_l2b_rdma_wren_s3_v2 |
2875 `CPU.l2b4.evict_l2t_l2b_rdma_wren_s3_v3 |
2876 `CPU.l2b4.evict_l2t_l2b_rdma_wren_s3_v4;
2877
2878
2879 // IOWB entry index = 0,1,2,3
2880 //assign b4_rdma_index = `CPU.l2b4.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
2881 // Indicates that any future transactions will see this entry's store data.
2882 // The bit that is asserted corresponds to the index in the IOWB.
2883 //assign b4_rdma_valid = `CPU.l2t4.rdmat.rdma_valid[3:0];
2884
2885//---------------------
2886initial
2887 begin
2888 b4_pop_index = 2'b0;
2889 b4_push_index = 2'b0;
2890 b4_state_capture = STATE_C0; // Idle state
2891 b4_iowb0_valid = 1'h0;
2892 b4_iowb1_valid = 1'h0;
2893 b4_iowb2_valid = 1'h0;
2894 b4_iowb3_valid = 1'h0;
2895 b4_iowb0_pa = 40'h0;
2896 b4_iowb1_pa = 40'h0;
2897 b4_iowb2_pa = 40'h0;
2898 b4_iowb3_pa = 40'h0;
2899 b4_siu_pa = 40'h0;
2900 b4_siu_d0 = 32'b0;
2901 b4_siu_d1 = 32'b0;
2902 b4_siu_d2 = 32'b0;
2903 b4_siu_d3 = 32'b0;
2904 b4_siu_d4 = 32'b0;
2905 b4_siu_d5 = 32'b0;
2906 b4_siu_d6 = 32'b0;
2907 b4_siu_d7 = 32'b0;
2908 b4_siu_d8 = 32'b0;
2909 b4_siu_d9 = 32'b0;
2910 b4_siu_d10 = 32'b0;
2911 b4_siu_d11 = 32'b0;
2912 b4_siu_d12 = 32'b0;
2913 b4_siu_d13 = 32'b0;
2914 b4_siu_d14 = 32'b0;
2915 b4_siu_d15 = 32'b0;
2916 end
2917
2918//==========================================================
2919//==========================================================
2920
2921always @ (posedge `BENCH_L2T4_GCLK) begin // {
2922
2923 //------------------------------
2924 // Pipeline signals
2925
2926 //------------------------------
2927 // L2 RTL Bank4 (not needed for L2 Stub)
2928
2929 b4_cam_hit_c52 <= b4_cam_hit_c5;
2930 b4_cam_hit_c6 <= b4_cam_hit_c52;
2931 b4_cam_hit_c7 <= b4_cam_hit_c6;
2932 b4_cam_hit_c8 <= b4_cam_hit_c7;
2933
2934 b4_first_pass_c3 <= b4_first_pass_c2;
2935 b4_first_pass_c4 <= b4_first_pass_c3;
2936 b4_first_pass_c5 <= b4_first_pass_c4;
2937 b4_first_pass_c52 <= b4_first_pass_c5;
2938 b4_first_pass_c6 <= b4_first_pass_c52;
2939 b4_first_pass_c7 <= b4_first_pass_c6;
2940 b4_first_pass_c8 <= b4_first_pass_c7;
2941
2942 b4_wr8_active_c3 <= b4_wr8_active_c2;
2943 b4_wr8_active_c4 <= b4_wr8_active_c3;
2944 b4_wr8_active_c5 <= b4_wr8_active_c4;
2945 b4_wr8_active_c52 <= b4_wr8_active_c5;
2946 b4_wr8_active_c6 <= b4_wr8_active_c52;
2947 b4_wr8_active_c7 <= b4_wr8_active_c6;
2948 b4_wr8_active_c8 <= b4_wr8_active_c7;
2949
2950 b4_wr64_active_c3 <= b4_wr64_active_c2;
2951 b4_wr64_active_c4 <= b4_wr64_active_c3;
2952 b4_wr64_active_c5 <= b4_wr64_active_c4;
2953 b4_wr64_active_c52 <= b4_wr64_active_c5;
2954 b4_wr64_active_c6 <= b4_wr64_active_c52;
2955 b4_wr64_active_c7 <= b4_wr64_active_c6;
2956 b4_wr64_active_c8 <= b4_wr64_active_c7;
2957
2958 //----------------------------------------------------------
2959 //----------------------------------------------------------
2960 // SIU Store - WR8
2961
2962
2963 // only do this if the transfers don't match up in c8.
2964
2965 if (b4_wr8_active && b4_first_pass) begin // {
2966 // Send msgs to Riesling
2967 dma_store (b4_siu_wr8_pa,b4_siu_wr8_data,b4_siu_wr8_size,b4_cam_hit,8'd8,"B4 WR8");
2968 end // }
2969
2970 //----------------------------------------------------------
2971 //----------------------------------------------------------
2972 // SIU Store - WRI
2973
2974 //------------------------------
2975 // Send MemorySlam message after SIU transaction is complete
2976 // Read IOWB data and Send msgs to Riesling
2977
2978 if (b4_wr64_active && b4_first_pass) begin // {
2979
2980 // Determine which of the 8 DMA_STOREs will be evicted.
2981 // WRI is 64 Bytes.
2982 // Eviction is 16 Bytes at a time.
2983 // So, there can be 1-4 Evictions for a single WRI.
2984 b4_ev_vect0 = b4_ev_invvect[31:0];
2985 b4_ev_vect1 = b4_ev_invvect[55:32];
2986 b4_ev_vect2 = b4_ev_invvect[87:56];
2987 b4_ev_vect3 = b4_ev_invvect[111:88];
2988
2989 b4_inv_vect[0] = get_vect(b4_ev_vect0);
2990 b4_inv_vect[1] = get_vect31(b4_ev_vect1); // different function for odd inval vector
2991 b4_inv_vect[2] = get_vect(b4_ev_vect2);
2992 b4_inv_vect[3] = get_vect31(b4_ev_vect3); // different function for odd inval vector
2993
2994 //Get entry from IOWB and send message
2995 b4_chk_valid_entry(b4_pop_index);
2996 b4_read_iowb(b4_pop_index,
2997 {|b4_inv_vect[3],|b4_inv_vect[2],|b4_inv_vect[1],|b4_inv_vect[0]});
2998 b4_pop_index = b4_pop_index + 1;
2999 end // }
3000
3001 //------------------------------
3002 // Capture state machine
3003 // Capture pa and data (64 Bytes) off SIU to L2 interface.
3004 // See SIU MAS (about page 49) for WRI packet format.
3005 // Put packet in IOWB which had 4 entries.
3006 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
3007 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
3008
3009 case (b4_state_capture)
3010
3011 // Capture pa (part 1)
3012 STATE_C0: begin // {
3013 // WRI pkt if req_data[26:24]==3'b100
3014 if ((b4_sii_l2t_req_vld)&&(b4_sii_l2t_req_data[26:24]==3'b100)) begin // {
3015 b4_siu_pa[39:32] <= b4_sii_l2t_req_data[7:0];
3016 b4_state_capture <= STATE_C1;
3017 end // }
3018 end // }
3019
3020 // Capture pa (part 2)
3021 STATE_C1: begin // {
3022 b4_siu_pa[31:0] <= b4_sii_l2t_req_data[31:0];
3023 b4_state_capture <= STATE_C2;
3024 end // }
3025
3026 // Capture 4 data bytes
3027 STATE_C2: begin // {
3028 b4_siu_d0 <= b4_sii_l2t_req_data[31:0];
3029 b4_state_capture <= STATE_C3;
3030 end // }
3031
3032 // Capture 4 data bytes
3033 STATE_C3: begin // {
3034 b4_siu_d1 <= b4_sii_l2t_req_data[31:0];
3035 b4_state_capture <= STATE_C4;
3036 end // }
3037
3038 // Capture 4 data bytes
3039 STATE_C4: begin // {
3040 b4_siu_d2 <= b4_sii_l2t_req_data[31:0];
3041 b4_state_capture <= STATE_C5;
3042 end // }
3043
3044 // Capture 4 data bytes
3045 STATE_C5: begin // {
3046 b4_siu_d3 <= b4_sii_l2t_req_data[31:0];
3047 b4_state_capture <= STATE_C6;
3048 end // }
3049
3050 // Capture 4 data bytes
3051 STATE_C6: begin // {
3052 b4_siu_d4 <= b4_sii_l2t_req_data[31:0];
3053 b4_state_capture <= STATE_C7;
3054 end // }
3055
3056 // Capture 4 data bytes
3057 STATE_C7: begin // {
3058 b4_siu_d5 <= b4_sii_l2t_req_data[31:0];
3059 b4_state_capture <= STATE_C8;
3060 end // }
3061
3062 // Capture 4 data bytes
3063 STATE_C8: begin // {
3064 b4_siu_d6 <= b4_sii_l2t_req_data[31:0];
3065 b4_state_capture <= STATE_C9;
3066 end // }
3067
3068 // Capture 4 data bytes
3069 STATE_C9: begin // {
3070 b4_siu_d7 <= b4_sii_l2t_req_data[31:0];
3071 b4_state_capture <= STATE_C10;
3072 end // }
3073
3074 // Capture 4 data bytes
3075 STATE_C10: begin // {
3076 b4_siu_d8 <= b4_sii_l2t_req_data[31:0];
3077 b4_state_capture <= STATE_C11;
3078 end // }
3079
3080 // Capture 4 data bytes
3081 STATE_C11: begin // {
3082 b4_siu_d9 <= b4_sii_l2t_req_data[31:0];
3083 b4_state_capture <= STATE_C12;
3084 end // }
3085
3086 // Capture 4 data bytes
3087 STATE_C12: begin // {
3088 b4_siu_d10 <= b4_sii_l2t_req_data[31:0];
3089 b4_state_capture <= STATE_C13;
3090 end // }
3091
3092 // Capture 4 data bytes
3093 STATE_C13: begin // {
3094 b4_siu_d11 <= b4_sii_l2t_req_data[31:0];
3095 b4_state_capture <= STATE_C14;
3096 end // }
3097
3098 // Capture 4 data bytes
3099 STATE_C14: begin // {
3100 b4_siu_d12 <= b4_sii_l2t_req_data[31:0];
3101 b4_state_capture <= STATE_C15;
3102 end // }
3103
3104 // Capture 4 data bytes
3105 STATE_C15: begin // {
3106 b4_siu_d13 <= b4_sii_l2t_req_data[31:0];
3107 b4_state_capture <= STATE_C16;
3108 end // }
3109
3110 // Capture 4 data bytes
3111 STATE_C16: begin // {
3112 b4_siu_d14 <= b4_sii_l2t_req_data[31:0];
3113 b4_state_capture <= STATE_C17;
3114 end // }
3115
3116 // Capture 4 data bytes
3117 STATE_C17: begin // {
3118 b4_siu_d15 <= b4_sii_l2t_req_data[31:0];
3119 b4_state_capture <= STATE_C18;
3120 end // }
3121
3122 // Save WRI packet (pa and data)x to IOWB
3123 STATE_C18: begin // {
3124 // Extra check to make sure that RTL is writing to its IOWB, too.
3125 if (!b4_rdma_wren) begin // {
3126 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b4_rdma_wren is not asserted when it is expected to be asserted.");
3127 end // }
3128 else begin // {
3129 b4_write_iowb (b4_push_index);
3130 b4_push_index = b4_push_index + 1;
3131 end // }
3132 b4_state_capture <= STATE_C0;
3133 end // }
3134
3135 default: begin // {
3136 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 4 should not hit default state");
3137 end // }
3138
3139 endcase
3140
3141end // always}
3142
3143//----------------------------------------------------------
3144// Task to save data captured on SIU -> L2 interface into IOWB
3145task b4_write_iowb;
3146
3147input [1:0] index;
3148
3149 begin
3150 `PR_INFO("ldst_dma",`INFO,"Push to B4 IOWB. index=%d pa=%h D0=%h",
3151 index,b4_siu_pa,b4_siu_d0);
3152 case (index)
3153 2'h0: begin
3154 if (b4_iowb0_valid) begin
3155 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb0 Overflow.");
3156 end
3157 else begin
3158 b4_iowb0_valid <= 1'b1;
3159 end
3160
3161 b4_iowb0_pa <= b4_siu_pa;
3162 b4_iowb0[0] <= b4_siu_d0;
3163 b4_iowb0[1] <= b4_siu_d1;
3164 b4_iowb0[2] <= b4_siu_d2;
3165 b4_iowb0[3] <= b4_siu_d3;
3166 b4_iowb0[4] <= b4_siu_d4;
3167 b4_iowb0[5] <= b4_siu_d5;
3168 b4_iowb0[6] <= b4_siu_d6;
3169 b4_iowb0[7] <= b4_siu_d7;
3170 b4_iowb0[8] <= b4_siu_d8;
3171 b4_iowb0[9] <= b4_siu_d9;
3172 b4_iowb0[10] <= b4_siu_d10;
3173 b4_iowb0[11] <= b4_siu_d11;
3174 b4_iowb0[12] <= b4_siu_d12;
3175 b4_iowb0[13] <= b4_siu_d13;
3176 b4_iowb0[14] <= b4_siu_d14;
3177 b4_iowb0[15] <= b4_siu_d15;
3178 end
3179 2'h1: begin
3180 if (b4_iowb1_valid) begin
3181 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb1 Overflow.");
3182 end
3183 else begin
3184 b4_iowb1_valid <= 1'b1;
3185 end
3186
3187 b4_iowb1_pa <= b4_siu_pa;
3188 b4_iowb1[0] <= b4_siu_d0;
3189 b4_iowb1[1] <= b4_siu_d1;
3190 b4_iowb1[2] <= b4_siu_d2;
3191 b4_iowb1[3] <= b4_siu_d3;
3192 b4_iowb1[4] <= b4_siu_d4;
3193 b4_iowb1[5] <= b4_siu_d5;
3194 b4_iowb1[6] <= b4_siu_d6;
3195 b4_iowb1[7] <= b4_siu_d7;
3196 b4_iowb1[8] <= b4_siu_d8;
3197 b4_iowb1[9] <= b4_siu_d9;
3198 b4_iowb1[10] <= b4_siu_d10;
3199 b4_iowb1[11] <= b4_siu_d11;
3200 b4_iowb1[12] <= b4_siu_d12;
3201 b4_iowb1[13] <= b4_siu_d13;
3202 b4_iowb1[14] <= b4_siu_d14;
3203 b4_iowb1[15] <= b4_siu_d15;
3204 end
3205 2'h2: begin
3206 if (b4_iowb2_valid) begin
3207 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb2 Overflow.");
3208 end
3209 else begin
3210 b4_iowb2_valid <= 1'b1;
3211 end
3212
3213 b4_iowb2_pa <= b4_siu_pa;
3214 b4_iowb2[0] <= b4_siu_d0;
3215 b4_iowb2[1] <= b4_siu_d1;
3216 b4_iowb2[2] <= b4_siu_d2;
3217 b4_iowb2[3] <= b4_siu_d3;
3218 b4_iowb2[4] <= b4_siu_d4;
3219 b4_iowb2[5] <= b4_siu_d5;
3220 b4_iowb2[6] <= b4_siu_d6;
3221 b4_iowb2[7] <= b4_siu_d7;
3222 b4_iowb2[8] <= b4_siu_d8;
3223 b4_iowb2[9] <= b4_siu_d9;
3224 b4_iowb2[10] <= b4_siu_d10;
3225 b4_iowb2[11] <= b4_siu_d11;
3226 b4_iowb2[12] <= b4_siu_d12;
3227 b4_iowb2[13] <= b4_siu_d13;
3228 b4_iowb2[14] <= b4_siu_d14;
3229 b4_iowb2[15] <= b4_siu_d15;
3230 end
3231 2'h3: begin
3232 if (b4_iowb3_valid) begin
3233 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb3 Overflow.");
3234 end
3235 else begin
3236 b4_iowb3_valid <= 1'b1;
3237 end
3238
3239 b4_iowb3_pa <= b4_siu_pa;
3240 b4_iowb3[0] <= b4_siu_d0;
3241 b4_iowb3[1] <= b4_siu_d1;
3242 b4_iowb3[2] <= b4_siu_d2;
3243 b4_iowb3[3] <= b4_siu_d3;
3244 b4_iowb3[4] <= b4_siu_d4;
3245 b4_iowb3[5] <= b4_siu_d5;
3246 b4_iowb3[6] <= b4_siu_d6;
3247 b4_iowb3[7] <= b4_siu_d7;
3248 b4_iowb3[8] <= b4_siu_d8;
3249 b4_iowb3[9] <= b4_siu_d9;
3250 b4_iowb3[10] <= b4_siu_d10;
3251 b4_iowb3[11] <= b4_siu_d11;
3252 b4_iowb3[12] <= b4_siu_d12;
3253 b4_iowb3[13] <= b4_siu_d13;
3254 b4_iowb3[14] <= b4_siu_d14;
3255 b4_iowb3[15] <= b4_siu_d15;
3256 end
3257 default: begin
3258 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
3259 end
3260 endcase
3261
3262 end
3263endtask
3264
3265//----------------------------------------------------------
3266// Task to read data from IOWB and send to Riesling
3267task b4_read_iowb;
3268
3269input [1:0] index;
3270input [3:0] tmp_evict;
3271
3272 begin
3273 case (index)
3274 2'h0:
3275 begin
3276 if (!b4_iowb0_valid) begin
3277 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb0 Underflow.");
3278 end
3279 else begin
3280 b4_iowb0_valid <= 1'b0;
3281 end
3282
3283 `PR_INFO("ldst_dma",`INFO,"Pop from B4 IOWB. index=%d pa=%h D0=%h",
3284 index,b4_iowb0_pa,b4_iowb0[0]);
3285
3286 // Call task to send NAS message
3287 // Send 8 Bytes at a time
3288 dma_store (b4_iowb0_pa, {b4_iowb0[0], b4_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 1");
3289 dma_store (b4_iowb0_pa+8, {b4_iowb0[2], b4_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 2");
3290 dma_store (b4_iowb0_pa+16,{b4_iowb0[4], b4_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 3");
3291 dma_store (b4_iowb0_pa+24,{b4_iowb0[6], b4_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 4");
3292 dma_store (b4_iowb0_pa+32,{b4_iowb0[8], b4_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B4 WRI 5");
3293 dma_store (b4_iowb0_pa+40,{b4_iowb0[10],b4_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B4 WRI 6");
3294 dma_store (b4_iowb0_pa+48,{b4_iowb0[12],b4_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B4 WRI 7");
3295 dma_store (b4_iowb0_pa+56,{b4_iowb0[14],b4_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B4 WRI 8");
3296 end
3297 2'h1:
3298 begin
3299 if (!b4_iowb1_valid) begin
3300 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb1 Underflow.");
3301 end
3302 else begin
3303 b4_iowb1_valid <= 1'b0;
3304 end
3305
3306 `PR_INFO("ldst_dma",`INFO,"Pop from B4 IOWB. index=%d pa=%h D0=%h",
3307 index,b4_iowb1_pa,b4_iowb1[0]);
3308
3309 // Call task to send NAS message
3310 // Send 8 Bytes at a time
3311 dma_store (b4_iowb1_pa, {b4_iowb1[0], b4_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 1");
3312 dma_store (b4_iowb1_pa+8, {b4_iowb1[2], b4_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 2");
3313 dma_store (b4_iowb1_pa+16,{b4_iowb1[4], b4_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 3");
3314 dma_store (b4_iowb1_pa+24,{b4_iowb1[6], b4_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 4");
3315 dma_store (b4_iowb1_pa+32,{b4_iowb1[8], b4_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B4 WRI 5");
3316 dma_store (b4_iowb1_pa+40,{b4_iowb1[10],b4_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B4 WRI 6");
3317 dma_store (b4_iowb1_pa+48,{b4_iowb1[12],b4_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B4 WRI 7");
3318 dma_store (b4_iowb1_pa+56,{b4_iowb1[14],b4_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B4 WRI 8");
3319 end
3320 2'h2:
3321 begin
3322 if (!b4_iowb2_valid) begin
3323 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb2 Underflow.");
3324 end
3325 else begin
3326 b4_iowb2_valid <= 1'b0;
3327 end
3328
3329 `PR_INFO("ldst_dma",`INFO,"Pop from B4 IOWB. index=%d pa=%h D0=%h",
3330 index,b4_iowb2_pa,b4_iowb2[0]);
3331
3332 // Call task to send NAS message
3333 // Send 8 Bytes at a time
3334 dma_store (b4_iowb2_pa, {b4_iowb2[0], b4_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 1");
3335 dma_store (b4_iowb2_pa+8, {b4_iowb2[2], b4_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 2");
3336 dma_store (b4_iowb2_pa+16,{b4_iowb2[4], b4_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 3");
3337 dma_store (b4_iowb2_pa+24,{b4_iowb2[6], b4_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 4");
3338 dma_store (b4_iowb2_pa+32,{b4_iowb2[8], b4_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B4 WRI 5");
3339 dma_store (b4_iowb2_pa+40,{b4_iowb2[10],b4_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B4 WRI 6");
3340 dma_store (b4_iowb2_pa+48,{b4_iowb2[12],b4_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B4 WRI 7");
3341 dma_store (b4_iowb2_pa+56,{b4_iowb2[14],b4_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B4 WRI 8");
3342 end
3343 2'h3:
3344 begin
3345 if (!b4_iowb3_valid) begin
3346 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b4_iowb3 Underflow.");
3347 end
3348 else begin
3349 b4_iowb3_valid <= 1'b0;
3350 end
3351
3352 `PR_INFO("ldst_dma",`INFO,"Pop from B4 IOWB. index=%d pa=%h D0=%h",
3353 index,b4_iowb3_pa,b4_iowb3[0]);
3354
3355 // Call task to send NAS message
3356 // Send 8 Bytes at a time
3357 dma_store (b4_iowb3_pa, {b4_iowb3[0], b4_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 1");
3358 dma_store (b4_iowb3_pa+8, {b4_iowb3[2], b4_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B4 WRI 2");
3359 dma_store (b4_iowb3_pa+16,{b4_iowb3[4], b4_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 3");
3360 dma_store (b4_iowb3_pa+24,{b4_iowb3[6], b4_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B4 WRI 4");
3361 dma_store (b4_iowb3_pa+32,{b4_iowb3[8], b4_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B4 WRI 5");
3362 dma_store (b4_iowb3_pa+40,{b4_iowb3[10],b4_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B4 WRI 6");
3363 dma_store (b4_iowb3_pa+48,{b4_iowb3[12],b4_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B4 WRI 7");
3364 dma_store (b4_iowb3_pa+56,{b4_iowb3[14],b4_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B4 WRI 8");
3365 end
3366 default:
3367 begin
3368 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
3369 end
3370 endcase
3371
3372 end
3373endtask
3374
3375//----------------------------------------------------------
3376// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
3377task b4_chk_valid_entry;
3378
3379input [1:0] index;
3380
3381 begin
3382 case (index)
3383 2'h0:
3384 begin
3385 if (b4_iowb0_valid != 1'b1) begin
3386 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b4_iowb0_valid!=1'b1)");
3387 end
3388 end
3389 2'h1:
3390 begin
3391 if (b4_iowb1_valid != 1'b1) begin
3392 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b4_iowb1_valid!=1'b1)");
3393 end
3394 end
3395 2'h2:
3396 begin
3397 if (b4_iowb2_valid != 1'b1) begin
3398 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b4_iowb2_valid!=1'b1)");
3399 end
3400 end
3401 2'h3:
3402 begin
3403 if (b4_iowb3_valid != 1'b1) begin
3404 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b4_iowb3_valid!=1'b1)");
3405 end
3406 end
3407 default:
3408 begin
3409 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
3410 end
3411 endcase
3412 end
3413endtask
3414
3415 `endif // `ifdef NOL2RTL
3416`endif // `ifdef NO_L2_BNK4
3417
3418`ifdef NO_L2_BNK5
3419`else
3420 `ifdef NOL2RTL
3421 `else
3422
3423//==========================================================
3424//==========================================================
3425// L2 RTL Probes
3426
3427 //----------------------------------------------------------
3428 // Signals for L2 RTL Bank5
3429
3430 //---------------------
3431 // SIU store
3432
3433 wire b5_cam_hit_c5;
3434 reg b5_cam_hit_c52;
3435 reg b5_cam_hit_c6;
3436 reg b5_cam_hit_c7;
3437 reg b5_cam_hit_c8;
3438 wire b5_cam_hit;
3439 wire b5_inst_valid_c2;
3440 wire b5_wr8_inst_c2;
3441 wire b5_wr64_inst_c2;
3442
3443 // If the cam hits, then there will be an eviction sent to the core(s)
3444 assign b5_cam_hit_c5 = |`CPU.l2t5.dc_cam_hit;
3445 assign b5_cam_hit = b5_cam_hit_c8;
3446 assign b5_inst_valid_c2 = `CPU.l2t5.arb.arb_inst_vld_c2;
3447 assign b5_wr8_inst_c2 = `CPU.l2t5.arb.arb_decdp_wr8_inst_c2;
3448 assign b5_wr64_inst_c2 = `CPU.l2t5.arb.arb_decdp_wr64_inst_c2;
3449
3450 //---------------------
3451 // WR8 signals
3452 wire b5_first_pass_c2;
3453 reg b5_first_pass_c3;
3454 reg b5_first_pass_c4;
3455 reg b5_first_pass_c5;
3456 reg b5_first_pass_c52;
3457 reg b5_first_pass_c6;
3458 reg b5_first_pass_c7;
3459 reg b5_first_pass_c8;
3460 wire b5_first_pass;
3461 wire b5_wr8_active_c2;
3462 reg b5_wr8_active_c3;
3463 reg b5_wr8_active_c4;
3464 reg b5_wr8_active_c5;
3465 reg b5_wr8_active_c52;
3466 reg b5_wr8_active_c6;
3467 reg b5_wr8_active_c7;
3468 reg b5_wr8_active_c8;
3469 wire b5_wr8_active;
3470
3471 wire [39:0] b5_siu_wr8_pa;
3472 wire [63:0] b5_siu_wr8_data;
3473 wire [7:0] b5_siu_wr8_size;
3474
3475 assign b5_wr8_active_c2 = `CPU.l2t5.arb_decdp_wr8_inst_c2;
3476 assign b5_wr8_active = b5_wr8_active_c8;
3477 assign b5_first_pass_c2 = `CPU.l2t5.arbdec.arbdp_inst_c2[39]==0;
3478 assign b5_first_pass = b5_first_pass_c8;
3479 assign b5_siu_wr8_pa = `CPU.l2t5.arbadr.arbdp_addr_c8;
3480 assign b5_siu_wr8_data = `CPU.l2t5.arbdat.arbdp_inst_data_c8;
3481 assign b5_siu_wr8_size = `CPU.l2t5.arbdec.arbdec_arbdp_inst_size_c8;
3482
3483 //---------------------
3484 // WRI signals
3485 reg [1:0] b5_pop_index; // Index pointing to next entry to be read from IOWB
3486 reg [1:0] b5_push_index; // Index pointing to next entry to be written from IOWB
3487
3488 wire b5_wr64_active_c2;
3489 reg b5_wr64_active_c3;
3490 reg b5_wr64_active_c4;
3491 reg b5_wr64_active_c5;
3492 reg b5_wr64_active_c52;
3493 reg b5_wr64_active_c6;
3494 reg b5_wr64_active_c7;
3495 reg b5_wr64_active_c8;
3496 wire b5_wr64_active;
3497
3498 wire b5_sii_l2t_req_vld;
3499 wire [31:0] b5_sii_l2t_req_data;
3500 wire b5_rdma_wren;
3501 //wire [1:0] b5_rdma_index;
3502 //wire [3:0] b5_rdma_valid;
3503
3504 reg [4:0] b5_state_capture;
3505 reg [39:0] b5_siu_pa;
3506 reg [31:0] b5_siu_d0;
3507 reg [31:0] b5_siu_d1;
3508 reg [31:0] b5_siu_d2;
3509 reg [31:0] b5_siu_d3;
3510 reg [31:0] b5_siu_d4;
3511 reg [31:0] b5_siu_d5;
3512 reg [31:0] b5_siu_d6;
3513 reg [31:0] b5_siu_d7;
3514 reg [31:0] b5_siu_d8;
3515 reg [31:0] b5_siu_d9;
3516 reg [31:0] b5_siu_d10;
3517 reg [31:0] b5_siu_d11;
3518 reg [31:0] b5_siu_d12;
3519 reg [31:0] b5_siu_d13;
3520 reg [31:0] b5_siu_d14;
3521 reg [31:0] b5_siu_d15;
3522
3523 // IOWB has 4 entries
3524 // Each entry has valid bit, pa, 64 Byte data
3525 reg b5_iowb0_valid; // Indicates Bench has captured entire packet
3526 reg b5_iowb1_valid;
3527 reg b5_iowb2_valid;
3528 reg b5_iowb3_valid;
3529 reg [39:0] b5_iowb0_pa;
3530 reg [39:0] b5_iowb1_pa;
3531 reg [39:0] b5_iowb2_pa;
3532 reg [39:0] b5_iowb3_pa;
3533 reg [31:0] b5_iowb0 [0:15];
3534 reg [31:0] b5_iowb1 [0:15];
3535 reg [31:0] b5_iowb2 [0:15];
3536 reg [31:0] b5_iowb3 [0:15];
3537
3538 assign b5_sii_l2t_req_vld = `CPU.l2t5.sii_l2t_req_vld;
3539 assign b5_sii_l2t_req_data = `CPU.l2t5.sii_l2t_req[31:0];
3540
3541 assign b5_wr64_active_c2 = b5_inst_valid_c2 & b5_wr64_inst_c2;
3542 assign b5_wr64_active = b5_wr64_active_c8;
3543
3544 // Indicates when rdma_index is valid
3545 assign b5_rdma_wren = `CPU.l2b5.evict_l2t_l2b_rdma_wren_s3_v1 |
3546 `CPU.l2b5.evict_l2t_l2b_rdma_wren_s3_v2 |
3547 `CPU.l2b5.evict_l2t_l2b_rdma_wren_s3_v3 |
3548 `CPU.l2b5.evict_l2t_l2b_rdma_wren_s3_v4;
3549
3550
3551 // IOWB entry index = 0,1,2,3
3552 //assign b5_rdma_index = `CPU.l2b5.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
3553 // Indicates that any future transactions will see this entry's store data.
3554 // The bit that is asserted corresponds to the index in the IOWB.
3555 //assign b5_rdma_valid = `CPU.l2t5.rdmat.rdma_valid[3:0];
3556
3557//---------------------
3558initial
3559 begin
3560 b5_pop_index = 2'b0;
3561 b5_push_index = 2'b0;
3562 b5_state_capture = STATE_C0; // Idle state
3563 b5_iowb0_valid = 1'h0;
3564 b5_iowb1_valid = 1'h0;
3565 b5_iowb2_valid = 1'h0;
3566 b5_iowb3_valid = 1'h0;
3567 b5_iowb0_pa = 40'h0;
3568 b5_iowb1_pa = 40'h0;
3569 b5_iowb2_pa = 40'h0;
3570 b5_iowb3_pa = 40'h0;
3571 b5_siu_pa = 40'h0;
3572 b5_siu_d0 = 32'b0;
3573 b5_siu_d1 = 32'b0;
3574 b5_siu_d2 = 32'b0;
3575 b5_siu_d3 = 32'b0;
3576 b5_siu_d4 = 32'b0;
3577 b5_siu_d5 = 32'b0;
3578 b5_siu_d6 = 32'b0;
3579 b5_siu_d7 = 32'b0;
3580 b5_siu_d8 = 32'b0;
3581 b5_siu_d9 = 32'b0;
3582 b5_siu_d10 = 32'b0;
3583 b5_siu_d11 = 32'b0;
3584 b5_siu_d12 = 32'b0;
3585 b5_siu_d13 = 32'b0;
3586 b5_siu_d14 = 32'b0;
3587 b5_siu_d15 = 32'b0;
3588 end
3589
3590//==========================================================
3591//==========================================================
3592
3593always @ (posedge `BENCH_L2T5_GCLK) begin // {
3594
3595 //------------------------------
3596 // Pipeline signals
3597
3598 //------------------------------
3599 // L2 RTL Bank5 (not needed for L2 Stub)
3600
3601 b5_cam_hit_c52 <= b5_cam_hit_c5;
3602 b5_cam_hit_c6 <= b5_cam_hit_c52;
3603 b5_cam_hit_c7 <= b5_cam_hit_c6;
3604 b5_cam_hit_c8 <= b5_cam_hit_c7;
3605
3606 b5_first_pass_c3 <= b5_first_pass_c2;
3607 b5_first_pass_c4 <= b5_first_pass_c3;
3608 b5_first_pass_c5 <= b5_first_pass_c4;
3609 b5_first_pass_c52 <= b5_first_pass_c5;
3610 b5_first_pass_c6 <= b5_first_pass_c52;
3611 b5_first_pass_c7 <= b5_first_pass_c6;
3612 b5_first_pass_c8 <= b5_first_pass_c7;
3613
3614 b5_wr8_active_c3 <= b5_wr8_active_c2;
3615 b5_wr8_active_c4 <= b5_wr8_active_c3;
3616 b5_wr8_active_c5 <= b5_wr8_active_c4;
3617 b5_wr8_active_c52 <= b5_wr8_active_c5;
3618 b5_wr8_active_c6 <= b5_wr8_active_c52;
3619 b5_wr8_active_c7 <= b5_wr8_active_c6;
3620 b5_wr8_active_c8 <= b5_wr8_active_c7;
3621
3622 b5_wr64_active_c3 <= b5_wr64_active_c2;
3623 b5_wr64_active_c4 <= b5_wr64_active_c3;
3624 b5_wr64_active_c5 <= b5_wr64_active_c4;
3625 b5_wr64_active_c52 <= b5_wr64_active_c5;
3626 b5_wr64_active_c6 <= b5_wr64_active_c52;
3627 b5_wr64_active_c7 <= b5_wr64_active_c6;
3628 b5_wr64_active_c8 <= b5_wr64_active_c7;
3629
3630 //----------------------------------------------------------
3631 //----------------------------------------------------------
3632 // SIU Store - WR8
3633
3634
3635 // only do this if the transfers don't match up in c8.
3636
3637 if (b5_wr8_active && b5_first_pass) begin // {
3638 // Send msgs to Riesling
3639 dma_store (b5_siu_wr8_pa,b5_siu_wr8_data,b5_siu_wr8_size,b5_cam_hit,8'd8,"B5 WR8");
3640 end // }
3641
3642 //----------------------------------------------------------
3643 //----------------------------------------------------------
3644 // SIU Store - WRI
3645
3646 //------------------------------
3647 // Send MemorySlam message after SIU transaction is complete
3648 // Read IOWB data and Send msgs to Riesling
3649
3650 if (b5_wr64_active && b5_first_pass) begin // {
3651
3652 // Determine which of the 8 DMA_STOREs will be evicted.
3653 // WRI is 64 Bytes.
3654 // Eviction is 16 Bytes at a time.
3655 // So, there can be 1-4 Evictions for a single WRI.
3656 b5_ev_vect0 = b5_ev_invvect[31:0];
3657 b5_ev_vect1 = b5_ev_invvect[55:32];
3658 b5_ev_vect2 = b5_ev_invvect[87:56];
3659 b5_ev_vect3 = b5_ev_invvect[111:88];
3660
3661 b5_inv_vect[0] = get_vect(b5_ev_vect0);
3662 b5_inv_vect[1] = get_vect31(b5_ev_vect1); // different function for odd inval vector
3663 b5_inv_vect[2] = get_vect(b5_ev_vect2);
3664 b5_inv_vect[3] = get_vect31(b5_ev_vect3); // different function for odd inval vector
3665
3666 //Get entry from IOWB and send message
3667 b5_chk_valid_entry(b5_pop_index);
3668 b5_read_iowb(b5_pop_index,
3669 {|b5_inv_vect[3],|b5_inv_vect[2],|b5_inv_vect[1],|b5_inv_vect[0]});
3670 b5_pop_index = b5_pop_index + 1;
3671 end // }
3672
3673 //------------------------------
3674 // Capture state machine
3675 // Capture pa and data (64 Bytes) off SIU to L2 interface.
3676 // See SIU MAS (about page 49) for WRI packet format.
3677 // Put packet in IOWB which had 4 entries.
3678 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
3679 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
3680
3681 case (b5_state_capture)
3682
3683 // Capture pa (part 1)
3684 STATE_C0: begin // {
3685 // WRI pkt if req_data[26:24]==3'b100
3686 if ((b5_sii_l2t_req_vld)&&(b5_sii_l2t_req_data[26:24]==3'b100)) begin // {
3687 b5_siu_pa[39:32] <= b5_sii_l2t_req_data[7:0];
3688 b5_state_capture <= STATE_C1;
3689 end // }
3690 end // }
3691
3692 // Capture pa (part 2)
3693 STATE_C1: begin // {
3694 b5_siu_pa[31:0] <= b5_sii_l2t_req_data[31:0];
3695 b5_state_capture <= STATE_C2;
3696 end // }
3697
3698 // Capture 4 data bytes
3699 STATE_C2: begin // {
3700 b5_siu_d0 <= b5_sii_l2t_req_data[31:0];
3701 b5_state_capture <= STATE_C3;
3702 end // }
3703
3704 // Capture 4 data bytes
3705 STATE_C3: begin // {
3706 b5_siu_d1 <= b5_sii_l2t_req_data[31:0];
3707 b5_state_capture <= STATE_C4;
3708 end // }
3709
3710 // Capture 4 data bytes
3711 STATE_C4: begin // {
3712 b5_siu_d2 <= b5_sii_l2t_req_data[31:0];
3713 b5_state_capture <= STATE_C5;
3714 end // }
3715
3716 // Capture 4 data bytes
3717 STATE_C5: begin // {
3718 b5_siu_d3 <= b5_sii_l2t_req_data[31:0];
3719 b5_state_capture <= STATE_C6;
3720 end // }
3721
3722 // Capture 4 data bytes
3723 STATE_C6: begin // {
3724 b5_siu_d4 <= b5_sii_l2t_req_data[31:0];
3725 b5_state_capture <= STATE_C7;
3726 end // }
3727
3728 // Capture 4 data bytes
3729 STATE_C7: begin // {
3730 b5_siu_d5 <= b5_sii_l2t_req_data[31:0];
3731 b5_state_capture <= STATE_C8;
3732 end // }
3733
3734 // Capture 4 data bytes
3735 STATE_C8: begin // {
3736 b5_siu_d6 <= b5_sii_l2t_req_data[31:0];
3737 b5_state_capture <= STATE_C9;
3738 end // }
3739
3740 // Capture 4 data bytes
3741 STATE_C9: begin // {
3742 b5_siu_d7 <= b5_sii_l2t_req_data[31:0];
3743 b5_state_capture <= STATE_C10;
3744 end // }
3745
3746 // Capture 4 data bytes
3747 STATE_C10: begin // {
3748 b5_siu_d8 <= b5_sii_l2t_req_data[31:0];
3749 b5_state_capture <= STATE_C11;
3750 end // }
3751
3752 // Capture 4 data bytes
3753 STATE_C11: begin // {
3754 b5_siu_d9 <= b5_sii_l2t_req_data[31:0];
3755 b5_state_capture <= STATE_C12;
3756 end // }
3757
3758 // Capture 4 data bytes
3759 STATE_C12: begin // {
3760 b5_siu_d10 <= b5_sii_l2t_req_data[31:0];
3761 b5_state_capture <= STATE_C13;
3762 end // }
3763
3764 // Capture 4 data bytes
3765 STATE_C13: begin // {
3766 b5_siu_d11 <= b5_sii_l2t_req_data[31:0];
3767 b5_state_capture <= STATE_C14;
3768 end // }
3769
3770 // Capture 4 data bytes
3771 STATE_C14: begin // {
3772 b5_siu_d12 <= b5_sii_l2t_req_data[31:0];
3773 b5_state_capture <= STATE_C15;
3774 end // }
3775
3776 // Capture 4 data bytes
3777 STATE_C15: begin // {
3778 b5_siu_d13 <= b5_sii_l2t_req_data[31:0];
3779 b5_state_capture <= STATE_C16;
3780 end // }
3781
3782 // Capture 4 data bytes
3783 STATE_C16: begin // {
3784 b5_siu_d14 <= b5_sii_l2t_req_data[31:0];
3785 b5_state_capture <= STATE_C17;
3786 end // }
3787
3788 // Capture 4 data bytes
3789 STATE_C17: begin // {
3790 b5_siu_d15 <= b5_sii_l2t_req_data[31:0];
3791 b5_state_capture <= STATE_C18;
3792 end // }
3793
3794 // Save WRI packet (pa and data)x to IOWB
3795 STATE_C18: begin // {
3796 // Extra check to make sure that RTL is writing to its IOWB, too.
3797 if (!b5_rdma_wren) begin // {
3798 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b5_rdma_wren is not asserted when it is expected to be asserted.");
3799 end // }
3800 else begin // {
3801 b5_write_iowb (b5_push_index);
3802 b5_push_index = b5_push_index + 1;
3803 end // }
3804 b5_state_capture <= STATE_C0;
3805 end // }
3806
3807 default: begin // {
3808 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 5 should not hit default state");
3809 end // }
3810
3811 endcase
3812
3813end // always}
3814
3815//----------------------------------------------------------
3816// Task to save data captured on SIU -> L2 interface into IOWB
3817task b5_write_iowb;
3818
3819input [1:0] index;
3820
3821 begin
3822 `PR_INFO("ldst_dma",`INFO,"Push to B5 IOWB. index=%d pa=%h D0=%h",
3823 index,b5_siu_pa,b5_siu_d0);
3824 case (index)
3825 2'h0: begin
3826 if (b5_iowb0_valid) begin
3827 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb0 Overflow.");
3828 end
3829 else begin
3830 b5_iowb0_valid <= 1'b1;
3831 end
3832
3833 b5_iowb0_pa <= b5_siu_pa;
3834 b5_iowb0[0] <= b5_siu_d0;
3835 b5_iowb0[1] <= b5_siu_d1;
3836 b5_iowb0[2] <= b5_siu_d2;
3837 b5_iowb0[3] <= b5_siu_d3;
3838 b5_iowb0[4] <= b5_siu_d4;
3839 b5_iowb0[5] <= b5_siu_d5;
3840 b5_iowb0[6] <= b5_siu_d6;
3841 b5_iowb0[7] <= b5_siu_d7;
3842 b5_iowb0[8] <= b5_siu_d8;
3843 b5_iowb0[9] <= b5_siu_d9;
3844 b5_iowb0[10] <= b5_siu_d10;
3845 b5_iowb0[11] <= b5_siu_d11;
3846 b5_iowb0[12] <= b5_siu_d12;
3847 b5_iowb0[13] <= b5_siu_d13;
3848 b5_iowb0[14] <= b5_siu_d14;
3849 b5_iowb0[15] <= b5_siu_d15;
3850 end
3851 2'h1: begin
3852 if (b5_iowb1_valid) begin
3853 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb1 Overflow.");
3854 end
3855 else begin
3856 b5_iowb1_valid <= 1'b1;
3857 end
3858
3859 b5_iowb1_pa <= b5_siu_pa;
3860 b5_iowb1[0] <= b5_siu_d0;
3861 b5_iowb1[1] <= b5_siu_d1;
3862 b5_iowb1[2] <= b5_siu_d2;
3863 b5_iowb1[3] <= b5_siu_d3;
3864 b5_iowb1[4] <= b5_siu_d4;
3865 b5_iowb1[5] <= b5_siu_d5;
3866 b5_iowb1[6] <= b5_siu_d6;
3867 b5_iowb1[7] <= b5_siu_d7;
3868 b5_iowb1[8] <= b5_siu_d8;
3869 b5_iowb1[9] <= b5_siu_d9;
3870 b5_iowb1[10] <= b5_siu_d10;
3871 b5_iowb1[11] <= b5_siu_d11;
3872 b5_iowb1[12] <= b5_siu_d12;
3873 b5_iowb1[13] <= b5_siu_d13;
3874 b5_iowb1[14] <= b5_siu_d14;
3875 b5_iowb1[15] <= b5_siu_d15;
3876 end
3877 2'h2: begin
3878 if (b5_iowb2_valid) begin
3879 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb2 Overflow.");
3880 end
3881 else begin
3882 b5_iowb2_valid <= 1'b1;
3883 end
3884
3885 b5_iowb2_pa <= b5_siu_pa;
3886 b5_iowb2[0] <= b5_siu_d0;
3887 b5_iowb2[1] <= b5_siu_d1;
3888 b5_iowb2[2] <= b5_siu_d2;
3889 b5_iowb2[3] <= b5_siu_d3;
3890 b5_iowb2[4] <= b5_siu_d4;
3891 b5_iowb2[5] <= b5_siu_d5;
3892 b5_iowb2[6] <= b5_siu_d6;
3893 b5_iowb2[7] <= b5_siu_d7;
3894 b5_iowb2[8] <= b5_siu_d8;
3895 b5_iowb2[9] <= b5_siu_d9;
3896 b5_iowb2[10] <= b5_siu_d10;
3897 b5_iowb2[11] <= b5_siu_d11;
3898 b5_iowb2[12] <= b5_siu_d12;
3899 b5_iowb2[13] <= b5_siu_d13;
3900 b5_iowb2[14] <= b5_siu_d14;
3901 b5_iowb2[15] <= b5_siu_d15;
3902 end
3903 2'h3: begin
3904 if (b5_iowb3_valid) begin
3905 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb3 Overflow.");
3906 end
3907 else begin
3908 b5_iowb3_valid <= 1'b1;
3909 end
3910
3911 b5_iowb3_pa <= b5_siu_pa;
3912 b5_iowb3[0] <= b5_siu_d0;
3913 b5_iowb3[1] <= b5_siu_d1;
3914 b5_iowb3[2] <= b5_siu_d2;
3915 b5_iowb3[3] <= b5_siu_d3;
3916 b5_iowb3[4] <= b5_siu_d4;
3917 b5_iowb3[5] <= b5_siu_d5;
3918 b5_iowb3[6] <= b5_siu_d6;
3919 b5_iowb3[7] <= b5_siu_d7;
3920 b5_iowb3[8] <= b5_siu_d8;
3921 b5_iowb3[9] <= b5_siu_d9;
3922 b5_iowb3[10] <= b5_siu_d10;
3923 b5_iowb3[11] <= b5_siu_d11;
3924 b5_iowb3[12] <= b5_siu_d12;
3925 b5_iowb3[13] <= b5_siu_d13;
3926 b5_iowb3[14] <= b5_siu_d14;
3927 b5_iowb3[15] <= b5_siu_d15;
3928 end
3929 default: begin
3930 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
3931 end
3932 endcase
3933
3934 end
3935endtask
3936
3937//----------------------------------------------------------
3938// Task to read data from IOWB and send to Riesling
3939task b5_read_iowb;
3940
3941input [1:0] index;
3942input [3:0] tmp_evict;
3943
3944 begin
3945 case (index)
3946 2'h0:
3947 begin
3948 if (!b5_iowb0_valid) begin
3949 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb0 Underflow.");
3950 end
3951 else begin
3952 b5_iowb0_valid <= 1'b0;
3953 end
3954
3955 `PR_INFO("ldst_dma",`INFO,"Pop from B5 IOWB. index=%d pa=%h D0=%h",
3956 index,b5_iowb0_pa,b5_iowb0[0]);
3957
3958 // Call task to send NAS message
3959 // Send 8 Bytes at a time
3960 dma_store (b5_iowb0_pa, {b5_iowb0[0], b5_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 1");
3961 dma_store (b5_iowb0_pa+8, {b5_iowb0[2], b5_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 2");
3962 dma_store (b5_iowb0_pa+16,{b5_iowb0[4], b5_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 3");
3963 dma_store (b5_iowb0_pa+24,{b5_iowb0[6], b5_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 4");
3964 dma_store (b5_iowb0_pa+32,{b5_iowb0[8], b5_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B5 WRI 5");
3965 dma_store (b5_iowb0_pa+40,{b5_iowb0[10],b5_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B5 WRI 6");
3966 dma_store (b5_iowb0_pa+48,{b5_iowb0[12],b5_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B5 WRI 7");
3967 dma_store (b5_iowb0_pa+56,{b5_iowb0[14],b5_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B5 WRI 8");
3968 end
3969 2'h1:
3970 begin
3971 if (!b5_iowb1_valid) begin
3972 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb1 Underflow.");
3973 end
3974 else begin
3975 b5_iowb1_valid <= 1'b0;
3976 end
3977
3978 `PR_INFO("ldst_dma",`INFO,"Pop from B5 IOWB. index=%d pa=%h D0=%h",
3979 index,b5_iowb1_pa,b5_iowb1[0]);
3980
3981 // Call task to send NAS message
3982 // Send 8 Bytes at a time
3983 dma_store (b5_iowb1_pa, {b5_iowb1[0], b5_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 1");
3984 dma_store (b5_iowb1_pa+8, {b5_iowb1[2], b5_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 2");
3985 dma_store (b5_iowb1_pa+16,{b5_iowb1[4], b5_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 3");
3986 dma_store (b5_iowb1_pa+24,{b5_iowb1[6], b5_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 4");
3987 dma_store (b5_iowb1_pa+32,{b5_iowb1[8], b5_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B5 WRI 5");
3988 dma_store (b5_iowb1_pa+40,{b5_iowb1[10],b5_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B5 WRI 6");
3989 dma_store (b5_iowb1_pa+48,{b5_iowb1[12],b5_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B5 WRI 7");
3990 dma_store (b5_iowb1_pa+56,{b5_iowb1[14],b5_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B5 WRI 8");
3991 end
3992 2'h2:
3993 begin
3994 if (!b5_iowb2_valid) begin
3995 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb2 Underflow.");
3996 end
3997 else begin
3998 b5_iowb2_valid <= 1'b0;
3999 end
4000
4001 `PR_INFO("ldst_dma",`INFO,"Pop from B5 IOWB. index=%d pa=%h D0=%h",
4002 index,b5_iowb2_pa,b5_iowb2[0]);
4003
4004 // Call task to send NAS message
4005 // Send 8 Bytes at a time
4006 dma_store (b5_iowb2_pa, {b5_iowb2[0], b5_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 1");
4007 dma_store (b5_iowb2_pa+8, {b5_iowb2[2], b5_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 2");
4008 dma_store (b5_iowb2_pa+16,{b5_iowb2[4], b5_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 3");
4009 dma_store (b5_iowb2_pa+24,{b5_iowb2[6], b5_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 4");
4010 dma_store (b5_iowb2_pa+32,{b5_iowb2[8], b5_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B5 WRI 5");
4011 dma_store (b5_iowb2_pa+40,{b5_iowb2[10],b5_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B5 WRI 6");
4012 dma_store (b5_iowb2_pa+48,{b5_iowb2[12],b5_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B5 WRI 7");
4013 dma_store (b5_iowb2_pa+56,{b5_iowb2[14],b5_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B5 WRI 8");
4014 end
4015 2'h3:
4016 begin
4017 if (!b5_iowb3_valid) begin
4018 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b5_iowb3 Underflow.");
4019 end
4020 else begin
4021 b5_iowb3_valid <= 1'b0;
4022 end
4023
4024 `PR_INFO("ldst_dma",`INFO,"Pop from B5 IOWB. index=%d pa=%h D0=%h",
4025 index,b5_iowb3_pa,b5_iowb3[0]);
4026
4027 // Call task to send NAS message
4028 // Send 8 Bytes at a time
4029 dma_store (b5_iowb3_pa, {b5_iowb3[0], b5_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 1");
4030 dma_store (b5_iowb3_pa+8, {b5_iowb3[2], b5_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B5 WRI 2");
4031 dma_store (b5_iowb3_pa+16,{b5_iowb3[4], b5_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 3");
4032 dma_store (b5_iowb3_pa+24,{b5_iowb3[6], b5_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B5 WRI 4");
4033 dma_store (b5_iowb3_pa+32,{b5_iowb3[8], b5_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B5 WRI 5");
4034 dma_store (b5_iowb3_pa+40,{b5_iowb3[10],b5_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B5 WRI 6");
4035 dma_store (b5_iowb3_pa+48,{b5_iowb3[12],b5_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B5 WRI 7");
4036 dma_store (b5_iowb3_pa+56,{b5_iowb3[14],b5_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B5 WRI 8");
4037 end
4038 default:
4039 begin
4040 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
4041 end
4042 endcase
4043
4044 end
4045endtask
4046
4047//----------------------------------------------------------
4048// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
4049task b5_chk_valid_entry;
4050
4051input [1:0] index;
4052
4053 begin
4054 case (index)
4055 2'h0:
4056 begin
4057 if (b5_iowb0_valid != 1'b1) begin
4058 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b5_iowb0_valid!=1'b1)");
4059 end
4060 end
4061 2'h1:
4062 begin
4063 if (b5_iowb1_valid != 1'b1) begin
4064 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b5_iowb1_valid!=1'b1)");
4065 end
4066 end
4067 2'h2:
4068 begin
4069 if (b5_iowb2_valid != 1'b1) begin
4070 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b5_iowb2_valid!=1'b1)");
4071 end
4072 end
4073 2'h3:
4074 begin
4075 if (b5_iowb3_valid != 1'b1) begin
4076 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b5_iowb3_valid!=1'b1)");
4077 end
4078 end
4079 default:
4080 begin
4081 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
4082 end
4083 endcase
4084 end
4085endtask
4086
4087 `endif // `ifdef NOL2RTL
4088`endif // `ifdef NO_L2_BNK5
4089
4090`ifdef NO_L2_BNK6
4091`else
4092 `ifdef NOL2RTL
4093 `else
4094
4095//==========================================================
4096//==========================================================
4097// L2 RTL Probes
4098
4099 //----------------------------------------------------------
4100 // Signals for L2 RTL Bank6
4101
4102 //---------------------
4103 // SIU store
4104
4105 wire b6_cam_hit_c5;
4106 reg b6_cam_hit_c52;
4107 reg b6_cam_hit_c6;
4108 reg b6_cam_hit_c7;
4109 reg b6_cam_hit_c8;
4110 wire b6_cam_hit;
4111 wire b6_inst_valid_c2;
4112 wire b6_wr8_inst_c2;
4113 wire b6_wr64_inst_c2;
4114
4115 // If the cam hits, then there will be an eviction sent to the core(s)
4116 assign b6_cam_hit_c5 = |`CPU.l2t6.dc_cam_hit;
4117 assign b6_cam_hit = b6_cam_hit_c8;
4118 assign b6_inst_valid_c2 = `CPU.l2t6.arb.arb_inst_vld_c2;
4119 assign b6_wr8_inst_c2 = `CPU.l2t6.arb.arb_decdp_wr8_inst_c2;
4120 assign b6_wr64_inst_c2 = `CPU.l2t6.arb.arb_decdp_wr64_inst_c2;
4121
4122 //---------------------
4123 // WR8 signals
4124 wire b6_first_pass_c2;
4125 reg b6_first_pass_c3;
4126 reg b6_first_pass_c4;
4127 reg b6_first_pass_c5;
4128 reg b6_first_pass_c52;
4129 reg b6_first_pass_c6;
4130 reg b6_first_pass_c7;
4131 reg b6_first_pass_c8;
4132 wire b6_first_pass;
4133 wire b6_wr8_active_c2;
4134 reg b6_wr8_active_c3;
4135 reg b6_wr8_active_c4;
4136 reg b6_wr8_active_c5;
4137 reg b6_wr8_active_c52;
4138 reg b6_wr8_active_c6;
4139 reg b6_wr8_active_c7;
4140 reg b6_wr8_active_c8;
4141 wire b6_wr8_active;
4142
4143 wire [39:0] b6_siu_wr8_pa;
4144 wire [63:0] b6_siu_wr8_data;
4145 wire [7:0] b6_siu_wr8_size;
4146
4147 assign b6_wr8_active_c2 = `CPU.l2t6.arb_decdp_wr8_inst_c2;
4148 assign b6_wr8_active = b6_wr8_active_c8;
4149 assign b6_first_pass_c2 = `CPU.l2t6.arbdec.arbdp_inst_c2[39]==0;
4150 assign b6_first_pass = b6_first_pass_c8;
4151 assign b6_siu_wr8_pa = `CPU.l2t6.arbadr.arbdp_addr_c8;
4152 assign b6_siu_wr8_data = `CPU.l2t6.arbdat.arbdp_inst_data_c8;
4153 assign b6_siu_wr8_size = `CPU.l2t6.arbdec.arbdec_arbdp_inst_size_c8;
4154
4155 //---------------------
4156 // WRI signals
4157 reg [1:0] b6_pop_index; // Index pointing to next entry to be read from IOWB
4158 reg [1:0] b6_push_index; // Index pointing to next entry to be written from IOWB
4159
4160 wire b6_wr64_active_c2;
4161 reg b6_wr64_active_c3;
4162 reg b6_wr64_active_c4;
4163 reg b6_wr64_active_c5;
4164 reg b6_wr64_active_c52;
4165 reg b6_wr64_active_c6;
4166 reg b6_wr64_active_c7;
4167 reg b6_wr64_active_c8;
4168 wire b6_wr64_active;
4169
4170 wire b6_sii_l2t_req_vld;
4171 wire [31:0] b6_sii_l2t_req_data;
4172 wire b6_rdma_wren;
4173 //wire [1:0] b6_rdma_index;
4174 //wire [3:0] b6_rdma_valid;
4175
4176 reg [4:0] b6_state_capture;
4177 reg [39:0] b6_siu_pa;
4178 reg [31:0] b6_siu_d0;
4179 reg [31:0] b6_siu_d1;
4180 reg [31:0] b6_siu_d2;
4181 reg [31:0] b6_siu_d3;
4182 reg [31:0] b6_siu_d4;
4183 reg [31:0] b6_siu_d5;
4184 reg [31:0] b6_siu_d6;
4185 reg [31:0] b6_siu_d7;
4186 reg [31:0] b6_siu_d8;
4187 reg [31:0] b6_siu_d9;
4188 reg [31:0] b6_siu_d10;
4189 reg [31:0] b6_siu_d11;
4190 reg [31:0] b6_siu_d12;
4191 reg [31:0] b6_siu_d13;
4192 reg [31:0] b6_siu_d14;
4193 reg [31:0] b6_siu_d15;
4194
4195 // IOWB has 4 entries
4196 // Each entry has valid bit, pa, 64 Byte data
4197 reg b6_iowb0_valid; // Indicates Bench has captured entire packet
4198 reg b6_iowb1_valid;
4199 reg b6_iowb2_valid;
4200 reg b6_iowb3_valid;
4201 reg [39:0] b6_iowb0_pa;
4202 reg [39:0] b6_iowb1_pa;
4203 reg [39:0] b6_iowb2_pa;
4204 reg [39:0] b6_iowb3_pa;
4205 reg [31:0] b6_iowb0 [0:15];
4206 reg [31:0] b6_iowb1 [0:15];
4207 reg [31:0] b6_iowb2 [0:15];
4208 reg [31:0] b6_iowb3 [0:15];
4209
4210 assign b6_sii_l2t_req_vld = `CPU.l2t6.sii_l2t_req_vld;
4211 assign b6_sii_l2t_req_data = `CPU.l2t6.sii_l2t_req[31:0];
4212
4213 assign b6_wr64_active_c2 = b6_inst_valid_c2 & b6_wr64_inst_c2;
4214 assign b6_wr64_active = b6_wr64_active_c8;
4215
4216 // Indicates when rdma_index is valid
4217 assign b6_rdma_wren = `CPU.l2b6.evict_l2t_l2b_rdma_wren_s3_v1 |
4218 `CPU.l2b6.evict_l2t_l2b_rdma_wren_s3_v2 |
4219 `CPU.l2b6.evict_l2t_l2b_rdma_wren_s3_v3 |
4220 `CPU.l2b6.evict_l2t_l2b_rdma_wren_s3_v4;
4221
4222
4223 // IOWB entry index = 0,1,2,3
4224 //assign b6_rdma_index = `CPU.l2b6.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
4225 // Indicates that any future transactions will see this entry's store data.
4226 // The bit that is asserted corresponds to the index in the IOWB.
4227 //assign b6_rdma_valid = `CPU.l2t6.rdmat.rdma_valid[3:0];
4228
4229//---------------------
4230initial
4231 begin
4232 b6_pop_index = 2'b0;
4233 b6_push_index = 2'b0;
4234 b6_state_capture = STATE_C0; // Idle state
4235 b6_iowb0_valid = 1'h0;
4236 b6_iowb1_valid = 1'h0;
4237 b6_iowb2_valid = 1'h0;
4238 b6_iowb3_valid = 1'h0;
4239 b6_iowb0_pa = 40'h0;
4240 b6_iowb1_pa = 40'h0;
4241 b6_iowb2_pa = 40'h0;
4242 b6_iowb3_pa = 40'h0;
4243 b6_siu_pa = 40'h0;
4244 b6_siu_d0 = 32'b0;
4245 b6_siu_d1 = 32'b0;
4246 b6_siu_d2 = 32'b0;
4247 b6_siu_d3 = 32'b0;
4248 b6_siu_d4 = 32'b0;
4249 b6_siu_d5 = 32'b0;
4250 b6_siu_d6 = 32'b0;
4251 b6_siu_d7 = 32'b0;
4252 b6_siu_d8 = 32'b0;
4253 b6_siu_d9 = 32'b0;
4254 b6_siu_d10 = 32'b0;
4255 b6_siu_d11 = 32'b0;
4256 b6_siu_d12 = 32'b0;
4257 b6_siu_d13 = 32'b0;
4258 b6_siu_d14 = 32'b0;
4259 b6_siu_d15 = 32'b0;
4260 end
4261
4262//==========================================================
4263//==========================================================
4264
4265always @ (posedge `BENCH_L2T6_GCLK) begin // {
4266
4267 //------------------------------
4268 // Pipeline signals
4269
4270 //------------------------------
4271 // L2 RTL Bank6 (not needed for L2 Stub)
4272
4273 b6_cam_hit_c52 <= b6_cam_hit_c5;
4274 b6_cam_hit_c6 <= b6_cam_hit_c52;
4275 b6_cam_hit_c7 <= b6_cam_hit_c6;
4276 b6_cam_hit_c8 <= b6_cam_hit_c7;
4277
4278 b6_first_pass_c3 <= b6_first_pass_c2;
4279 b6_first_pass_c4 <= b6_first_pass_c3;
4280 b6_first_pass_c5 <= b6_first_pass_c4;
4281 b6_first_pass_c52 <= b6_first_pass_c5;
4282 b6_first_pass_c6 <= b6_first_pass_c52;
4283 b6_first_pass_c7 <= b6_first_pass_c6;
4284 b6_first_pass_c8 <= b6_first_pass_c7;
4285
4286 b6_wr8_active_c3 <= b6_wr8_active_c2;
4287 b6_wr8_active_c4 <= b6_wr8_active_c3;
4288 b6_wr8_active_c5 <= b6_wr8_active_c4;
4289 b6_wr8_active_c52 <= b6_wr8_active_c5;
4290 b6_wr8_active_c6 <= b6_wr8_active_c52;
4291 b6_wr8_active_c7 <= b6_wr8_active_c6;
4292 b6_wr8_active_c8 <= b6_wr8_active_c7;
4293
4294 b6_wr64_active_c3 <= b6_wr64_active_c2;
4295 b6_wr64_active_c4 <= b6_wr64_active_c3;
4296 b6_wr64_active_c5 <= b6_wr64_active_c4;
4297 b6_wr64_active_c52 <= b6_wr64_active_c5;
4298 b6_wr64_active_c6 <= b6_wr64_active_c52;
4299 b6_wr64_active_c7 <= b6_wr64_active_c6;
4300 b6_wr64_active_c8 <= b6_wr64_active_c7;
4301
4302 //----------------------------------------------------------
4303 //----------------------------------------------------------
4304 // SIU Store - WR8
4305
4306
4307 // only do this if the transfers don't match up in c8.
4308
4309 if (b6_wr8_active && b6_first_pass) begin // {
4310 // Send msgs to Riesling
4311 dma_store (b6_siu_wr8_pa,b6_siu_wr8_data,b6_siu_wr8_size,b6_cam_hit,8'd8,"B6 WR8");
4312 end // }
4313
4314 //----------------------------------------------------------
4315 //----------------------------------------------------------
4316 // SIU Store - WRI
4317
4318 //------------------------------
4319 // Send MemorySlam message after SIU transaction is complete
4320 // Read IOWB data and Send msgs to Riesling
4321
4322 if (b6_wr64_active && b6_first_pass) begin // {
4323
4324 // Determine which of the 8 DMA_STOREs will be evicted.
4325 // WRI is 64 Bytes.
4326 // Eviction is 16 Bytes at a time.
4327 // So, there can be 1-4 Evictions for a single WRI.
4328 b6_ev_vect0 = b6_ev_invvect[31:0];
4329 b6_ev_vect1 = b6_ev_invvect[55:32];
4330 b6_ev_vect2 = b6_ev_invvect[87:56];
4331 b6_ev_vect3 = b6_ev_invvect[111:88];
4332
4333 b6_inv_vect[0] = get_vect(b6_ev_vect0);
4334 b6_inv_vect[1] = get_vect31(b6_ev_vect1); // different function for odd inval vector
4335 b6_inv_vect[2] = get_vect(b6_ev_vect2);
4336 b6_inv_vect[3] = get_vect31(b6_ev_vect3); // different function for odd inval vector
4337
4338 //Get entry from IOWB and send message
4339 b6_chk_valid_entry(b6_pop_index);
4340 b6_read_iowb(b6_pop_index,
4341 {|b6_inv_vect[3],|b6_inv_vect[2],|b6_inv_vect[1],|b6_inv_vect[0]});
4342 b6_pop_index = b6_pop_index + 1;
4343 end // }
4344
4345 //------------------------------
4346 // Capture state machine
4347 // Capture pa and data (64 Bytes) off SIU to L2 interface.
4348 // See SIU MAS (about page 49) for WRI packet format.
4349 // Put packet in IOWB which had 4 entries.
4350 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
4351 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
4352
4353 case (b6_state_capture)
4354
4355 // Capture pa (part 1)
4356 STATE_C0: begin // {
4357 // WRI pkt if req_data[26:24]==3'b100
4358 if ((b6_sii_l2t_req_vld)&&(b6_sii_l2t_req_data[26:24]==3'b100)) begin // {
4359 b6_siu_pa[39:32] <= b6_sii_l2t_req_data[7:0];
4360 b6_state_capture <= STATE_C1;
4361 end // }
4362 end // }
4363
4364 // Capture pa (part 2)
4365 STATE_C1: begin // {
4366 b6_siu_pa[31:0] <= b6_sii_l2t_req_data[31:0];
4367 b6_state_capture <= STATE_C2;
4368 end // }
4369
4370 // Capture 4 data bytes
4371 STATE_C2: begin // {
4372 b6_siu_d0 <= b6_sii_l2t_req_data[31:0];
4373 b6_state_capture <= STATE_C3;
4374 end // }
4375
4376 // Capture 4 data bytes
4377 STATE_C3: begin // {
4378 b6_siu_d1 <= b6_sii_l2t_req_data[31:0];
4379 b6_state_capture <= STATE_C4;
4380 end // }
4381
4382 // Capture 4 data bytes
4383 STATE_C4: begin // {
4384 b6_siu_d2 <= b6_sii_l2t_req_data[31:0];
4385 b6_state_capture <= STATE_C5;
4386 end // }
4387
4388 // Capture 4 data bytes
4389 STATE_C5: begin // {
4390 b6_siu_d3 <= b6_sii_l2t_req_data[31:0];
4391 b6_state_capture <= STATE_C6;
4392 end // }
4393
4394 // Capture 4 data bytes
4395 STATE_C6: begin // {
4396 b6_siu_d4 <= b6_sii_l2t_req_data[31:0];
4397 b6_state_capture <= STATE_C7;
4398 end // }
4399
4400 // Capture 4 data bytes
4401 STATE_C7: begin // {
4402 b6_siu_d5 <= b6_sii_l2t_req_data[31:0];
4403 b6_state_capture <= STATE_C8;
4404 end // }
4405
4406 // Capture 4 data bytes
4407 STATE_C8: begin // {
4408 b6_siu_d6 <= b6_sii_l2t_req_data[31:0];
4409 b6_state_capture <= STATE_C9;
4410 end // }
4411
4412 // Capture 4 data bytes
4413 STATE_C9: begin // {
4414 b6_siu_d7 <= b6_sii_l2t_req_data[31:0];
4415 b6_state_capture <= STATE_C10;
4416 end // }
4417
4418 // Capture 4 data bytes
4419 STATE_C10: begin // {
4420 b6_siu_d8 <= b6_sii_l2t_req_data[31:0];
4421 b6_state_capture <= STATE_C11;
4422 end // }
4423
4424 // Capture 4 data bytes
4425 STATE_C11: begin // {
4426 b6_siu_d9 <= b6_sii_l2t_req_data[31:0];
4427 b6_state_capture <= STATE_C12;
4428 end // }
4429
4430 // Capture 4 data bytes
4431 STATE_C12: begin // {
4432 b6_siu_d10 <= b6_sii_l2t_req_data[31:0];
4433 b6_state_capture <= STATE_C13;
4434 end // }
4435
4436 // Capture 4 data bytes
4437 STATE_C13: begin // {
4438 b6_siu_d11 <= b6_sii_l2t_req_data[31:0];
4439 b6_state_capture <= STATE_C14;
4440 end // }
4441
4442 // Capture 4 data bytes
4443 STATE_C14: begin // {
4444 b6_siu_d12 <= b6_sii_l2t_req_data[31:0];
4445 b6_state_capture <= STATE_C15;
4446 end // }
4447
4448 // Capture 4 data bytes
4449 STATE_C15: begin // {
4450 b6_siu_d13 <= b6_sii_l2t_req_data[31:0];
4451 b6_state_capture <= STATE_C16;
4452 end // }
4453
4454 // Capture 4 data bytes
4455 STATE_C16: begin // {
4456 b6_siu_d14 <= b6_sii_l2t_req_data[31:0];
4457 b6_state_capture <= STATE_C17;
4458 end // }
4459
4460 // Capture 4 data bytes
4461 STATE_C17: begin // {
4462 b6_siu_d15 <= b6_sii_l2t_req_data[31:0];
4463 b6_state_capture <= STATE_C18;
4464 end // }
4465
4466 // Save WRI packet (pa and data)x to IOWB
4467 STATE_C18: begin // {
4468 // Extra check to make sure that RTL is writing to its IOWB, too.
4469 if (!b6_rdma_wren) begin // {
4470 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b6_rdma_wren is not asserted when it is expected to be asserted.");
4471 end // }
4472 else begin // {
4473 b6_write_iowb (b6_push_index);
4474 b6_push_index = b6_push_index + 1;
4475 end // }
4476 b6_state_capture <= STATE_C0;
4477 end // }
4478
4479 default: begin // {
4480 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 6 should not hit default state");
4481 end // }
4482
4483 endcase
4484
4485end // always}
4486
4487//----------------------------------------------------------
4488// Task to save data captured on SIU -> L2 interface into IOWB
4489task b6_write_iowb;
4490
4491input [1:0] index;
4492
4493 begin
4494 `PR_INFO("ldst_dma",`INFO,"Push to B6 IOWB. index=%d pa=%h D0=%h",
4495 index,b6_siu_pa,b6_siu_d0);
4496 case (index)
4497 2'h0: begin
4498 if (b6_iowb0_valid) begin
4499 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb0 Overflow.");
4500 end
4501 else begin
4502 b6_iowb0_valid <= 1'b1;
4503 end
4504
4505 b6_iowb0_pa <= b6_siu_pa;
4506 b6_iowb0[0] <= b6_siu_d0;
4507 b6_iowb0[1] <= b6_siu_d1;
4508 b6_iowb0[2] <= b6_siu_d2;
4509 b6_iowb0[3] <= b6_siu_d3;
4510 b6_iowb0[4] <= b6_siu_d4;
4511 b6_iowb0[5] <= b6_siu_d5;
4512 b6_iowb0[6] <= b6_siu_d6;
4513 b6_iowb0[7] <= b6_siu_d7;
4514 b6_iowb0[8] <= b6_siu_d8;
4515 b6_iowb0[9] <= b6_siu_d9;
4516 b6_iowb0[10] <= b6_siu_d10;
4517 b6_iowb0[11] <= b6_siu_d11;
4518 b6_iowb0[12] <= b6_siu_d12;
4519 b6_iowb0[13] <= b6_siu_d13;
4520 b6_iowb0[14] <= b6_siu_d14;
4521 b6_iowb0[15] <= b6_siu_d15;
4522 end
4523 2'h1: begin
4524 if (b6_iowb1_valid) begin
4525 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb1 Overflow.");
4526 end
4527 else begin
4528 b6_iowb1_valid <= 1'b1;
4529 end
4530
4531 b6_iowb1_pa <= b6_siu_pa;
4532 b6_iowb1[0] <= b6_siu_d0;
4533 b6_iowb1[1] <= b6_siu_d1;
4534 b6_iowb1[2] <= b6_siu_d2;
4535 b6_iowb1[3] <= b6_siu_d3;
4536 b6_iowb1[4] <= b6_siu_d4;
4537 b6_iowb1[5] <= b6_siu_d5;
4538 b6_iowb1[6] <= b6_siu_d6;
4539 b6_iowb1[7] <= b6_siu_d7;
4540 b6_iowb1[8] <= b6_siu_d8;
4541 b6_iowb1[9] <= b6_siu_d9;
4542 b6_iowb1[10] <= b6_siu_d10;
4543 b6_iowb1[11] <= b6_siu_d11;
4544 b6_iowb1[12] <= b6_siu_d12;
4545 b6_iowb1[13] <= b6_siu_d13;
4546 b6_iowb1[14] <= b6_siu_d14;
4547 b6_iowb1[15] <= b6_siu_d15;
4548 end
4549 2'h2: begin
4550 if (b6_iowb2_valid) begin
4551 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb2 Overflow.");
4552 end
4553 else begin
4554 b6_iowb2_valid <= 1'b1;
4555 end
4556
4557 b6_iowb2_pa <= b6_siu_pa;
4558 b6_iowb2[0] <= b6_siu_d0;
4559 b6_iowb2[1] <= b6_siu_d1;
4560 b6_iowb2[2] <= b6_siu_d2;
4561 b6_iowb2[3] <= b6_siu_d3;
4562 b6_iowb2[4] <= b6_siu_d4;
4563 b6_iowb2[5] <= b6_siu_d5;
4564 b6_iowb2[6] <= b6_siu_d6;
4565 b6_iowb2[7] <= b6_siu_d7;
4566 b6_iowb2[8] <= b6_siu_d8;
4567 b6_iowb2[9] <= b6_siu_d9;
4568 b6_iowb2[10] <= b6_siu_d10;
4569 b6_iowb2[11] <= b6_siu_d11;
4570 b6_iowb2[12] <= b6_siu_d12;
4571 b6_iowb2[13] <= b6_siu_d13;
4572 b6_iowb2[14] <= b6_siu_d14;
4573 b6_iowb2[15] <= b6_siu_d15;
4574 end
4575 2'h3: begin
4576 if (b6_iowb3_valid) begin
4577 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb3 Overflow.");
4578 end
4579 else begin
4580 b6_iowb3_valid <= 1'b1;
4581 end
4582
4583 b6_iowb3_pa <= b6_siu_pa;
4584 b6_iowb3[0] <= b6_siu_d0;
4585 b6_iowb3[1] <= b6_siu_d1;
4586 b6_iowb3[2] <= b6_siu_d2;
4587 b6_iowb3[3] <= b6_siu_d3;
4588 b6_iowb3[4] <= b6_siu_d4;
4589 b6_iowb3[5] <= b6_siu_d5;
4590 b6_iowb3[6] <= b6_siu_d6;
4591 b6_iowb3[7] <= b6_siu_d7;
4592 b6_iowb3[8] <= b6_siu_d8;
4593 b6_iowb3[9] <= b6_siu_d9;
4594 b6_iowb3[10] <= b6_siu_d10;
4595 b6_iowb3[11] <= b6_siu_d11;
4596 b6_iowb3[12] <= b6_siu_d12;
4597 b6_iowb3[13] <= b6_siu_d13;
4598 b6_iowb3[14] <= b6_siu_d14;
4599 b6_iowb3[15] <= b6_siu_d15;
4600 end
4601 default: begin
4602 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
4603 end
4604 endcase
4605
4606 end
4607endtask
4608
4609//----------------------------------------------------------
4610// Task to read data from IOWB and send to Riesling
4611task b6_read_iowb;
4612
4613input [1:0] index;
4614input [3:0] tmp_evict;
4615
4616 begin
4617 case (index)
4618 2'h0:
4619 begin
4620 if (!b6_iowb0_valid) begin
4621 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb0 Underflow.");
4622 end
4623 else begin
4624 b6_iowb0_valid <= 1'b0;
4625 end
4626
4627 `PR_INFO("ldst_dma",`INFO,"Pop from B6 IOWB. index=%d pa=%h D0=%h",
4628 index,b6_iowb0_pa,b6_iowb0[0]);
4629
4630 // Call task to send NAS message
4631 // Send 8 Bytes at a time
4632 dma_store (b6_iowb0_pa, {b6_iowb0[0], b6_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 1");
4633 dma_store (b6_iowb0_pa+8, {b6_iowb0[2], b6_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 2");
4634 dma_store (b6_iowb0_pa+16,{b6_iowb0[4], b6_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 3");
4635 dma_store (b6_iowb0_pa+24,{b6_iowb0[6], b6_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 4");
4636 dma_store (b6_iowb0_pa+32,{b6_iowb0[8], b6_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B6 WRI 5");
4637 dma_store (b6_iowb0_pa+40,{b6_iowb0[10],b6_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B6 WRI 6");
4638 dma_store (b6_iowb0_pa+48,{b6_iowb0[12],b6_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B6 WRI 7");
4639 dma_store (b6_iowb0_pa+56,{b6_iowb0[14],b6_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B6 WRI 8");
4640 end
4641 2'h1:
4642 begin
4643 if (!b6_iowb1_valid) begin
4644 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb1 Underflow.");
4645 end
4646 else begin
4647 b6_iowb1_valid <= 1'b0;
4648 end
4649
4650 `PR_INFO("ldst_dma",`INFO,"Pop from B6 IOWB. index=%d pa=%h D0=%h",
4651 index,b6_iowb1_pa,b6_iowb1[0]);
4652
4653 // Call task to send NAS message
4654 // Send 8 Bytes at a time
4655 dma_store (b6_iowb1_pa, {b6_iowb1[0], b6_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 1");
4656 dma_store (b6_iowb1_pa+8, {b6_iowb1[2], b6_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 2");
4657 dma_store (b6_iowb1_pa+16,{b6_iowb1[4], b6_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 3");
4658 dma_store (b6_iowb1_pa+24,{b6_iowb1[6], b6_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 4");
4659 dma_store (b6_iowb1_pa+32,{b6_iowb1[8], b6_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B6 WRI 5");
4660 dma_store (b6_iowb1_pa+40,{b6_iowb1[10],b6_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B6 WRI 6");
4661 dma_store (b6_iowb1_pa+48,{b6_iowb1[12],b6_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B6 WRI 7");
4662 dma_store (b6_iowb1_pa+56,{b6_iowb1[14],b6_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B6 WRI 8");
4663 end
4664 2'h2:
4665 begin
4666 if (!b6_iowb2_valid) begin
4667 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb2 Underflow.");
4668 end
4669 else begin
4670 b6_iowb2_valid <= 1'b0;
4671 end
4672
4673 `PR_INFO("ldst_dma",`INFO,"Pop from B6 IOWB. index=%d pa=%h D0=%h",
4674 index,b6_iowb2_pa,b6_iowb2[0]);
4675
4676 // Call task to send NAS message
4677 // Send 8 Bytes at a time
4678 dma_store (b6_iowb2_pa, {b6_iowb2[0], b6_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 1");
4679 dma_store (b6_iowb2_pa+8, {b6_iowb2[2], b6_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 2");
4680 dma_store (b6_iowb2_pa+16,{b6_iowb2[4], b6_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 3");
4681 dma_store (b6_iowb2_pa+24,{b6_iowb2[6], b6_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 4");
4682 dma_store (b6_iowb2_pa+32,{b6_iowb2[8], b6_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B6 WRI 5");
4683 dma_store (b6_iowb2_pa+40,{b6_iowb2[10],b6_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B6 WRI 6");
4684 dma_store (b6_iowb2_pa+48,{b6_iowb2[12],b6_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B6 WRI 7");
4685 dma_store (b6_iowb2_pa+56,{b6_iowb2[14],b6_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B6 WRI 8");
4686 end
4687 2'h3:
4688 begin
4689 if (!b6_iowb3_valid) begin
4690 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b6_iowb3 Underflow.");
4691 end
4692 else begin
4693 b6_iowb3_valid <= 1'b0;
4694 end
4695
4696 `PR_INFO("ldst_dma",`INFO,"Pop from B6 IOWB. index=%d pa=%h D0=%h",
4697 index,b6_iowb3_pa,b6_iowb3[0]);
4698
4699 // Call task to send NAS message
4700 // Send 8 Bytes at a time
4701 dma_store (b6_iowb3_pa, {b6_iowb3[0], b6_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 1");
4702 dma_store (b6_iowb3_pa+8, {b6_iowb3[2], b6_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B6 WRI 2");
4703 dma_store (b6_iowb3_pa+16,{b6_iowb3[4], b6_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 3");
4704 dma_store (b6_iowb3_pa+24,{b6_iowb3[6], b6_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B6 WRI 4");
4705 dma_store (b6_iowb3_pa+32,{b6_iowb3[8], b6_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B6 WRI 5");
4706 dma_store (b6_iowb3_pa+40,{b6_iowb3[10],b6_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B6 WRI 6");
4707 dma_store (b6_iowb3_pa+48,{b6_iowb3[12],b6_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B6 WRI 7");
4708 dma_store (b6_iowb3_pa+56,{b6_iowb3[14],b6_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B6 WRI 8");
4709 end
4710 default:
4711 begin
4712 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
4713 end
4714 endcase
4715
4716 end
4717endtask
4718
4719//----------------------------------------------------------
4720// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
4721task b6_chk_valid_entry;
4722
4723input [1:0] index;
4724
4725 begin
4726 case (index)
4727 2'h0:
4728 begin
4729 if (b6_iowb0_valid != 1'b1) begin
4730 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b6_iowb0_valid!=1'b1)");
4731 end
4732 end
4733 2'h1:
4734 begin
4735 if (b6_iowb1_valid != 1'b1) begin
4736 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b6_iowb1_valid!=1'b1)");
4737 end
4738 end
4739 2'h2:
4740 begin
4741 if (b6_iowb2_valid != 1'b1) begin
4742 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b6_iowb2_valid!=1'b1)");
4743 end
4744 end
4745 2'h3:
4746 begin
4747 if (b6_iowb3_valid != 1'b1) begin
4748 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b6_iowb3_valid!=1'b1)");
4749 end
4750 end
4751 default:
4752 begin
4753 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
4754 end
4755 endcase
4756 end
4757endtask
4758
4759 `endif // `ifdef NOL2RTL
4760`endif // `ifdef NO_L2_BNK6
4761
4762`ifdef NO_L2_BNK7
4763`else
4764 `ifdef NOL2RTL
4765 `else
4766
4767//==========================================================
4768//==========================================================
4769// L2 RTL Probes
4770
4771 //----------------------------------------------------------
4772 // Signals for L2 RTL Bank7
4773
4774 //---------------------
4775 // SIU store
4776
4777 wire b7_cam_hit_c5;
4778 reg b7_cam_hit_c52;
4779 reg b7_cam_hit_c6;
4780 reg b7_cam_hit_c7;
4781 reg b7_cam_hit_c8;
4782 wire b7_cam_hit;
4783 wire b7_inst_valid_c2;
4784 wire b7_wr8_inst_c2;
4785 wire b7_wr64_inst_c2;
4786
4787 // If the cam hits, then there will be an eviction sent to the core(s)
4788 assign b7_cam_hit_c5 = |`CPU.l2t7.dc_cam_hit;
4789 assign b7_cam_hit = b7_cam_hit_c8;
4790 assign b7_inst_valid_c2 = `CPU.l2t7.arb.arb_inst_vld_c2;
4791 assign b7_wr8_inst_c2 = `CPU.l2t7.arb.arb_decdp_wr8_inst_c2;
4792 assign b7_wr64_inst_c2 = `CPU.l2t7.arb.arb_decdp_wr64_inst_c2;
4793
4794 //---------------------
4795 // WR8 signals
4796 wire b7_first_pass_c2;
4797 reg b7_first_pass_c3;
4798 reg b7_first_pass_c4;
4799 reg b7_first_pass_c5;
4800 reg b7_first_pass_c52;
4801 reg b7_first_pass_c6;
4802 reg b7_first_pass_c7;
4803 reg b7_first_pass_c8;
4804 wire b7_first_pass;
4805 wire b7_wr8_active_c2;
4806 reg b7_wr8_active_c3;
4807 reg b7_wr8_active_c4;
4808 reg b7_wr8_active_c5;
4809 reg b7_wr8_active_c52;
4810 reg b7_wr8_active_c6;
4811 reg b7_wr8_active_c7;
4812 reg b7_wr8_active_c8;
4813 wire b7_wr8_active;
4814
4815 wire [39:0] b7_siu_wr8_pa;
4816 wire [63:0] b7_siu_wr8_data;
4817 wire [7:0] b7_siu_wr8_size;
4818
4819 assign b7_wr8_active_c2 = `CPU.l2t7.arb_decdp_wr8_inst_c2;
4820 assign b7_wr8_active = b7_wr8_active_c8;
4821 assign b7_first_pass_c2 = `CPU.l2t7.arbdec.arbdp_inst_c2[39]==0;
4822 assign b7_first_pass = b7_first_pass_c8;
4823 assign b7_siu_wr8_pa = `CPU.l2t7.arbadr.arbdp_addr_c8;
4824 assign b7_siu_wr8_data = `CPU.l2t7.arbdat.arbdp_inst_data_c8;
4825 assign b7_siu_wr8_size = `CPU.l2t7.arbdec.arbdec_arbdp_inst_size_c8;
4826
4827 //---------------------
4828 // WRI signals
4829 reg [1:0] b7_pop_index; // Index pointing to next entry to be read from IOWB
4830 reg [1:0] b7_push_index; // Index pointing to next entry to be written from IOWB
4831
4832 wire b7_wr64_active_c2;
4833 reg b7_wr64_active_c3;
4834 reg b7_wr64_active_c4;
4835 reg b7_wr64_active_c5;
4836 reg b7_wr64_active_c52;
4837 reg b7_wr64_active_c6;
4838 reg b7_wr64_active_c7;
4839 reg b7_wr64_active_c8;
4840 wire b7_wr64_active;
4841
4842 wire b7_sii_l2t_req_vld;
4843 wire [31:0] b7_sii_l2t_req_data;
4844 wire b7_rdma_wren;
4845 //wire [1:0] b7_rdma_index;
4846 //wire [3:0] b7_rdma_valid;
4847
4848 reg [4:0] b7_state_capture;
4849 reg [39:0] b7_siu_pa;
4850 reg [31:0] b7_siu_d0;
4851 reg [31:0] b7_siu_d1;
4852 reg [31:0] b7_siu_d2;
4853 reg [31:0] b7_siu_d3;
4854 reg [31:0] b7_siu_d4;
4855 reg [31:0] b7_siu_d5;
4856 reg [31:0] b7_siu_d6;
4857 reg [31:0] b7_siu_d7;
4858 reg [31:0] b7_siu_d8;
4859 reg [31:0] b7_siu_d9;
4860 reg [31:0] b7_siu_d10;
4861 reg [31:0] b7_siu_d11;
4862 reg [31:0] b7_siu_d12;
4863 reg [31:0] b7_siu_d13;
4864 reg [31:0] b7_siu_d14;
4865 reg [31:0] b7_siu_d15;
4866
4867 // IOWB has 4 entries
4868 // Each entry has valid bit, pa, 64 Byte data
4869 reg b7_iowb0_valid; // Indicates Bench has captured entire packet
4870 reg b7_iowb1_valid;
4871 reg b7_iowb2_valid;
4872 reg b7_iowb3_valid;
4873 reg [39:0] b7_iowb0_pa;
4874 reg [39:0] b7_iowb1_pa;
4875 reg [39:0] b7_iowb2_pa;
4876 reg [39:0] b7_iowb3_pa;
4877 reg [31:0] b7_iowb0 [0:15];
4878 reg [31:0] b7_iowb1 [0:15];
4879 reg [31:0] b7_iowb2 [0:15];
4880 reg [31:0] b7_iowb3 [0:15];
4881
4882 assign b7_sii_l2t_req_vld = `CPU.l2t7.sii_l2t_req_vld;
4883 assign b7_sii_l2t_req_data = `CPU.l2t7.sii_l2t_req[31:0];
4884
4885 assign b7_wr64_active_c2 = b7_inst_valid_c2 & b7_wr64_inst_c2;
4886 assign b7_wr64_active = b7_wr64_active_c8;
4887
4888 // Indicates when rdma_index is valid
4889 assign b7_rdma_wren = `CPU.l2b7.evict_l2t_l2b_rdma_wren_s3_v1 |
4890 `CPU.l2b7.evict_l2t_l2b_rdma_wren_s3_v2 |
4891 `CPU.l2b7.evict_l2t_l2b_rdma_wren_s3_v3 |
4892 `CPU.l2b7.evict_l2t_l2b_rdma_wren_s3_v4;
4893
4894
4895 // IOWB entry index = 0,1,2,3
4896 //assign b7_rdma_index = `CPU.l2b7.evict_l2t_l2b_rdma_wrwl_s3_v1[1:0];
4897 // Indicates that any future transactions will see this entry's store data.
4898 // The bit that is asserted corresponds to the index in the IOWB.
4899 //assign b7_rdma_valid = `CPU.l2t7.rdmat.rdma_valid[3:0];
4900
4901//---------------------
4902initial
4903 begin
4904 b7_pop_index = 2'b0;
4905 b7_push_index = 2'b0;
4906 b7_state_capture = STATE_C0; // Idle state
4907 b7_iowb0_valid = 1'h0;
4908 b7_iowb1_valid = 1'h0;
4909 b7_iowb2_valid = 1'h0;
4910 b7_iowb3_valid = 1'h0;
4911 b7_iowb0_pa = 40'h0;
4912 b7_iowb1_pa = 40'h0;
4913 b7_iowb2_pa = 40'h0;
4914 b7_iowb3_pa = 40'h0;
4915 b7_siu_pa = 40'h0;
4916 b7_siu_d0 = 32'b0;
4917 b7_siu_d1 = 32'b0;
4918 b7_siu_d2 = 32'b0;
4919 b7_siu_d3 = 32'b0;
4920 b7_siu_d4 = 32'b0;
4921 b7_siu_d5 = 32'b0;
4922 b7_siu_d6 = 32'b0;
4923 b7_siu_d7 = 32'b0;
4924 b7_siu_d8 = 32'b0;
4925 b7_siu_d9 = 32'b0;
4926 b7_siu_d10 = 32'b0;
4927 b7_siu_d11 = 32'b0;
4928 b7_siu_d12 = 32'b0;
4929 b7_siu_d13 = 32'b0;
4930 b7_siu_d14 = 32'b0;
4931 b7_siu_d15 = 32'b0;
4932 end
4933
4934//==========================================================
4935//==========================================================
4936
4937always @ (posedge `BENCH_L2T7_GCLK) begin // {
4938
4939 //------------------------------
4940 // Pipeline signals
4941
4942 //------------------------------
4943 // L2 RTL Bank7 (not needed for L2 Stub)
4944
4945 b7_cam_hit_c52 <= b7_cam_hit_c5;
4946 b7_cam_hit_c6 <= b7_cam_hit_c52;
4947 b7_cam_hit_c7 <= b7_cam_hit_c6;
4948 b7_cam_hit_c8 <= b7_cam_hit_c7;
4949
4950 b7_first_pass_c3 <= b7_first_pass_c2;
4951 b7_first_pass_c4 <= b7_first_pass_c3;
4952 b7_first_pass_c5 <= b7_first_pass_c4;
4953 b7_first_pass_c52 <= b7_first_pass_c5;
4954 b7_first_pass_c6 <= b7_first_pass_c52;
4955 b7_first_pass_c7 <= b7_first_pass_c6;
4956 b7_first_pass_c8 <= b7_first_pass_c7;
4957
4958 b7_wr8_active_c3 <= b7_wr8_active_c2;
4959 b7_wr8_active_c4 <= b7_wr8_active_c3;
4960 b7_wr8_active_c5 <= b7_wr8_active_c4;
4961 b7_wr8_active_c52 <= b7_wr8_active_c5;
4962 b7_wr8_active_c6 <= b7_wr8_active_c52;
4963 b7_wr8_active_c7 <= b7_wr8_active_c6;
4964 b7_wr8_active_c8 <= b7_wr8_active_c7;
4965
4966 b7_wr64_active_c3 <= b7_wr64_active_c2;
4967 b7_wr64_active_c4 <= b7_wr64_active_c3;
4968 b7_wr64_active_c5 <= b7_wr64_active_c4;
4969 b7_wr64_active_c52 <= b7_wr64_active_c5;
4970 b7_wr64_active_c6 <= b7_wr64_active_c52;
4971 b7_wr64_active_c7 <= b7_wr64_active_c6;
4972 b7_wr64_active_c8 <= b7_wr64_active_c7;
4973
4974 //----------------------------------------------------------
4975 //----------------------------------------------------------
4976 // SIU Store - WR8
4977
4978
4979 // only do this if the transfers don't match up in c8.
4980
4981 if (b7_wr8_active && b7_first_pass) begin // {
4982 // Send msgs to Riesling
4983 dma_store (b7_siu_wr8_pa,b7_siu_wr8_data,b7_siu_wr8_size,b7_cam_hit,8'd8,"B7 WR8");
4984 end // }
4985
4986 //----------------------------------------------------------
4987 //----------------------------------------------------------
4988 // SIU Store - WRI
4989
4990 //------------------------------
4991 // Send MemorySlam message after SIU transaction is complete
4992 // Read IOWB data and Send msgs to Riesling
4993
4994 if (b7_wr64_active && b7_first_pass) begin // {
4995
4996 // Determine which of the 8 DMA_STOREs will be evicted.
4997 // WRI is 64 Bytes.
4998 // Eviction is 16 Bytes at a time.
4999 // So, there can be 1-4 Evictions for a single WRI.
5000 b7_ev_vect0 = b7_ev_invvect[31:0];
5001 b7_ev_vect1 = b7_ev_invvect[55:32];
5002 b7_ev_vect2 = b7_ev_invvect[87:56];
5003 b7_ev_vect3 = b7_ev_invvect[111:88];
5004
5005 b7_inv_vect[0] = get_vect(b7_ev_vect0);
5006 b7_inv_vect[1] = get_vect31(b7_ev_vect1); // different function for odd inval vector
5007 b7_inv_vect[2] = get_vect(b7_ev_vect2);
5008 b7_inv_vect[3] = get_vect31(b7_ev_vect3); // different function for odd inval vector
5009
5010 //Get entry from IOWB and send message
5011 b7_chk_valid_entry(b7_pop_index);
5012 b7_read_iowb(b7_pop_index,
5013 {|b7_inv_vect[3],|b7_inv_vect[2],|b7_inv_vect[1],|b7_inv_vect[0]});
5014 b7_pop_index = b7_pop_index + 1;
5015 end // }
5016
5017 //------------------------------
5018 // Capture state machine
5019 // Capture pa and data (64 Bytes) off SIU to L2 interface.
5020 // See SIU MAS (about page 49) for WRI packet format.
5021 // Put packet in IOWB which had 4 entries.
5022 // This IOWB in the Bench is not exactly the same as the IOWB in RTL.
5023 // Bench IOWB is a FIFO and RTL IOWB is not a FIFO.
5024
5025 case (b7_state_capture)
5026
5027 // Capture pa (part 1)
5028 STATE_C0: begin // {
5029 // WRI pkt if req_data[26:24]==3'b100
5030 if ((b7_sii_l2t_req_vld)&&(b7_sii_l2t_req_data[26:24]==3'b100)) begin // {
5031 b7_siu_pa[39:32] <= b7_sii_l2t_req_data[7:0];
5032 b7_state_capture <= STATE_C1;
5033 end // }
5034 end // }
5035
5036 // Capture pa (part 2)
5037 STATE_C1: begin // {
5038 b7_siu_pa[31:0] <= b7_sii_l2t_req_data[31:0];
5039 b7_state_capture <= STATE_C2;
5040 end // }
5041
5042 // Capture 4 data bytes
5043 STATE_C2: begin // {
5044 b7_siu_d0 <= b7_sii_l2t_req_data[31:0];
5045 b7_state_capture <= STATE_C3;
5046 end // }
5047
5048 // Capture 4 data bytes
5049 STATE_C3: begin // {
5050 b7_siu_d1 <= b7_sii_l2t_req_data[31:0];
5051 b7_state_capture <= STATE_C4;
5052 end // }
5053
5054 // Capture 4 data bytes
5055 STATE_C4: begin // {
5056 b7_siu_d2 <= b7_sii_l2t_req_data[31:0];
5057 b7_state_capture <= STATE_C5;
5058 end // }
5059
5060 // Capture 4 data bytes
5061 STATE_C5: begin // {
5062 b7_siu_d3 <= b7_sii_l2t_req_data[31:0];
5063 b7_state_capture <= STATE_C6;
5064 end // }
5065
5066 // Capture 4 data bytes
5067 STATE_C6: begin // {
5068 b7_siu_d4 <= b7_sii_l2t_req_data[31:0];
5069 b7_state_capture <= STATE_C7;
5070 end // }
5071
5072 // Capture 4 data bytes
5073 STATE_C7: begin // {
5074 b7_siu_d5 <= b7_sii_l2t_req_data[31:0];
5075 b7_state_capture <= STATE_C8;
5076 end // }
5077
5078 // Capture 4 data bytes
5079 STATE_C8: begin // {
5080 b7_siu_d6 <= b7_sii_l2t_req_data[31:0];
5081 b7_state_capture <= STATE_C9;
5082 end // }
5083
5084 // Capture 4 data bytes
5085 STATE_C9: begin // {
5086 b7_siu_d7 <= b7_sii_l2t_req_data[31:0];
5087 b7_state_capture <= STATE_C10;
5088 end // }
5089
5090 // Capture 4 data bytes
5091 STATE_C10: begin // {
5092 b7_siu_d8 <= b7_sii_l2t_req_data[31:0];
5093 b7_state_capture <= STATE_C11;
5094 end // }
5095
5096 // Capture 4 data bytes
5097 STATE_C11: begin // {
5098 b7_siu_d9 <= b7_sii_l2t_req_data[31:0];
5099 b7_state_capture <= STATE_C12;
5100 end // }
5101
5102 // Capture 4 data bytes
5103 STATE_C12: begin // {
5104 b7_siu_d10 <= b7_sii_l2t_req_data[31:0];
5105 b7_state_capture <= STATE_C13;
5106 end // }
5107
5108 // Capture 4 data bytes
5109 STATE_C13: begin // {
5110 b7_siu_d11 <= b7_sii_l2t_req_data[31:0];
5111 b7_state_capture <= STATE_C14;
5112 end // }
5113
5114 // Capture 4 data bytes
5115 STATE_C14: begin // {
5116 b7_siu_d12 <= b7_sii_l2t_req_data[31:0];
5117 b7_state_capture <= STATE_C15;
5118 end // }
5119
5120 // Capture 4 data bytes
5121 STATE_C15: begin // {
5122 b7_siu_d13 <= b7_sii_l2t_req_data[31:0];
5123 b7_state_capture <= STATE_C16;
5124 end // }
5125
5126 // Capture 4 data bytes
5127 STATE_C16: begin // {
5128 b7_siu_d14 <= b7_sii_l2t_req_data[31:0];
5129 b7_state_capture <= STATE_C17;
5130 end // }
5131
5132 // Capture 4 data bytes
5133 STATE_C17: begin // {
5134 b7_siu_d15 <= b7_sii_l2t_req_data[31:0];
5135 b7_state_capture <= STATE_C18;
5136 end // }
5137
5138 // Save WRI packet (pa and data)x to IOWB
5139 STATE_C18: begin // {
5140 // Extra check to make sure that RTL is writing to its IOWB, too.
5141 if (!b7_rdma_wren) begin // {
5142 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - Capture State Machine - b7_rdma_wren is not asserted when it is expected to be asserted.");
5143 end // }
5144 else begin // {
5145 b7_write_iowb (b7_push_index);
5146 b7_push_index = b7_push_index + 1;
5147 end // }
5148 b7_state_capture <= STATE_C0;
5149 end // }
5150
5151 default: begin // {
5152 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - ldst_dma Capture State Machine 7 should not hit default state");
5153 end // }
5154
5155 endcase
5156
5157end // always}
5158
5159//----------------------------------------------------------
5160// Task to save data captured on SIU -> L2 interface into IOWB
5161task b7_write_iowb;
5162
5163input [1:0] index;
5164
5165 begin
5166 `PR_INFO("ldst_dma",`INFO,"Push to B7 IOWB. index=%d pa=%h D0=%h",
5167 index,b7_siu_pa,b7_siu_d0);
5168 case (index)
5169 2'h0: begin
5170 if (b7_iowb0_valid) begin
5171 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb0 Overflow.");
5172 end
5173 else begin
5174 b7_iowb0_valid <= 1'b1;
5175 end
5176
5177 b7_iowb0_pa <= b7_siu_pa;
5178 b7_iowb0[0] <= b7_siu_d0;
5179 b7_iowb0[1] <= b7_siu_d1;
5180 b7_iowb0[2] <= b7_siu_d2;
5181 b7_iowb0[3] <= b7_siu_d3;
5182 b7_iowb0[4] <= b7_siu_d4;
5183 b7_iowb0[5] <= b7_siu_d5;
5184 b7_iowb0[6] <= b7_siu_d6;
5185 b7_iowb0[7] <= b7_siu_d7;
5186 b7_iowb0[8] <= b7_siu_d8;
5187 b7_iowb0[9] <= b7_siu_d9;
5188 b7_iowb0[10] <= b7_siu_d10;
5189 b7_iowb0[11] <= b7_siu_d11;
5190 b7_iowb0[12] <= b7_siu_d12;
5191 b7_iowb0[13] <= b7_siu_d13;
5192 b7_iowb0[14] <= b7_siu_d14;
5193 b7_iowb0[15] <= b7_siu_d15;
5194 end
5195 2'h1: begin
5196 if (b7_iowb1_valid) begin
5197 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb1 Overflow.");
5198 end
5199 else begin
5200 b7_iowb1_valid <= 1'b1;
5201 end
5202
5203 b7_iowb1_pa <= b7_siu_pa;
5204 b7_iowb1[0] <= b7_siu_d0;
5205 b7_iowb1[1] <= b7_siu_d1;
5206 b7_iowb1[2] <= b7_siu_d2;
5207 b7_iowb1[3] <= b7_siu_d3;
5208 b7_iowb1[4] <= b7_siu_d4;
5209 b7_iowb1[5] <= b7_siu_d5;
5210 b7_iowb1[6] <= b7_siu_d6;
5211 b7_iowb1[7] <= b7_siu_d7;
5212 b7_iowb1[8] <= b7_siu_d8;
5213 b7_iowb1[9] <= b7_siu_d9;
5214 b7_iowb1[10] <= b7_siu_d10;
5215 b7_iowb1[11] <= b7_siu_d11;
5216 b7_iowb1[12] <= b7_siu_d12;
5217 b7_iowb1[13] <= b7_siu_d13;
5218 b7_iowb1[14] <= b7_siu_d14;
5219 b7_iowb1[15] <= b7_siu_d15;
5220 end
5221 2'h2: begin
5222 if (b7_iowb2_valid) begin
5223 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb2 Overflow.");
5224 end
5225 else begin
5226 b7_iowb2_valid <= 1'b1;
5227 end
5228
5229 b7_iowb2_pa <= b7_siu_pa;
5230 b7_iowb2[0] <= b7_siu_d0;
5231 b7_iowb2[1] <= b7_siu_d1;
5232 b7_iowb2[2] <= b7_siu_d2;
5233 b7_iowb2[3] <= b7_siu_d3;
5234 b7_iowb2[4] <= b7_siu_d4;
5235 b7_iowb2[5] <= b7_siu_d5;
5236 b7_iowb2[6] <= b7_siu_d6;
5237 b7_iowb2[7] <= b7_siu_d7;
5238 b7_iowb2[8] <= b7_siu_d8;
5239 b7_iowb2[9] <= b7_siu_d9;
5240 b7_iowb2[10] <= b7_siu_d10;
5241 b7_iowb2[11] <= b7_siu_d11;
5242 b7_iowb2[12] <= b7_siu_d12;
5243 b7_iowb2[13] <= b7_siu_d13;
5244 b7_iowb2[14] <= b7_siu_d14;
5245 b7_iowb2[15] <= b7_siu_d15;
5246 end
5247 2'h3: begin
5248 if (b7_iowb3_valid) begin
5249 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb3 Overflow.");
5250 end
5251 else begin
5252 b7_iowb3_valid <= 1'b1;
5253 end
5254
5255 b7_iowb3_pa <= b7_siu_pa;
5256 b7_iowb3[0] <= b7_siu_d0;
5257 b7_iowb3[1] <= b7_siu_d1;
5258 b7_iowb3[2] <= b7_siu_d2;
5259 b7_iowb3[3] <= b7_siu_d3;
5260 b7_iowb3[4] <= b7_siu_d4;
5261 b7_iowb3[5] <= b7_siu_d5;
5262 b7_iowb3[6] <= b7_siu_d6;
5263 b7_iowb3[7] <= b7_siu_d7;
5264 b7_iowb3[8] <= b7_siu_d8;
5265 b7_iowb3[9] <= b7_siu_d9;
5266 b7_iowb3[10] <= b7_siu_d10;
5267 b7_iowb3[11] <= b7_siu_d11;
5268 b7_iowb3[12] <= b7_siu_d12;
5269 b7_iowb3[13] <= b7_siu_d13;
5270 b7_iowb3[14] <= b7_siu_d14;
5271 b7_iowb3[15] <= b7_siu_d15;
5272 end
5273 default: begin
5274 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task write_iowb should not hit default state");
5275 end
5276 endcase
5277
5278 end
5279endtask
5280
5281//----------------------------------------------------------
5282// Task to read data from IOWB and send to Riesling
5283task b7_read_iowb;
5284
5285input [1:0] index;
5286input [3:0] tmp_evict;
5287
5288 begin
5289 case (index)
5290 2'h0:
5291 begin
5292 if (!b7_iowb0_valid) begin
5293 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb0 Underflow.");
5294 end
5295 else begin
5296 b7_iowb0_valid <= 1'b0;
5297 end
5298
5299 `PR_INFO("ldst_dma",`INFO,"Pop from B7 IOWB. index=%d pa=%h D0=%h",
5300 index,b7_iowb0_pa,b7_iowb0[0]);
5301
5302 // Call task to send NAS message
5303 // Send 8 Bytes at a time
5304 dma_store (b7_iowb0_pa, {b7_iowb0[0], b7_iowb0[1]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 1");
5305 dma_store (b7_iowb0_pa+8, {b7_iowb0[2], b7_iowb0[3]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 2");
5306 dma_store (b7_iowb0_pa+16,{b7_iowb0[4], b7_iowb0[5]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 3");
5307 dma_store (b7_iowb0_pa+24,{b7_iowb0[6], b7_iowb0[7]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 4");
5308 dma_store (b7_iowb0_pa+32,{b7_iowb0[8], b7_iowb0[9]}, 8'hff,tmp_evict[2],8'd64,"B7 WRI 5");
5309 dma_store (b7_iowb0_pa+40,{b7_iowb0[10],b7_iowb0[11]},8'hff,tmp_evict[2],8'd64,"B7 WRI 6");
5310 dma_store (b7_iowb0_pa+48,{b7_iowb0[12],b7_iowb0[13]},8'hff,tmp_evict[3],8'd64,"B7 WRI 7");
5311 dma_store (b7_iowb0_pa+56,{b7_iowb0[14],b7_iowb0[15]},8'hff,tmp_evict[3],8'd64,"B7 WRI 8");
5312 end
5313 2'h1:
5314 begin
5315 if (!b7_iowb1_valid) begin
5316 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb1 Underflow.");
5317 end
5318 else begin
5319 b7_iowb1_valid <= 1'b0;
5320 end
5321
5322 `PR_INFO("ldst_dma",`INFO,"Pop from B7 IOWB. index=%d pa=%h D0=%h",
5323 index,b7_iowb1_pa,b7_iowb1[0]);
5324
5325 // Call task to send NAS message
5326 // Send 8 Bytes at a time
5327 dma_store (b7_iowb1_pa, {b7_iowb1[0], b7_iowb1[1]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 1");
5328 dma_store (b7_iowb1_pa+8, {b7_iowb1[2], b7_iowb1[3]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 2");
5329 dma_store (b7_iowb1_pa+16,{b7_iowb1[4], b7_iowb1[5]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 3");
5330 dma_store (b7_iowb1_pa+24,{b7_iowb1[6], b7_iowb1[7]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 4");
5331 dma_store (b7_iowb1_pa+32,{b7_iowb1[8], b7_iowb1[9]}, 8'hff,tmp_evict[2],8'd64,"B7 WRI 5");
5332 dma_store (b7_iowb1_pa+40,{b7_iowb1[10],b7_iowb1[11]},8'hff,tmp_evict[2],8'd64,"B7 WRI 6");
5333 dma_store (b7_iowb1_pa+48,{b7_iowb1[12],b7_iowb1[13]},8'hff,tmp_evict[3],8'd64,"B7 WRI 7");
5334 dma_store (b7_iowb1_pa+56,{b7_iowb1[14],b7_iowb1[15]},8'hff,tmp_evict[3],8'd64,"B7 WRI 8");
5335 end
5336 2'h2:
5337 begin
5338 if (!b7_iowb2_valid) begin
5339 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb2 Underflow.");
5340 end
5341 else begin
5342 b7_iowb2_valid <= 1'b0;
5343 end
5344
5345 `PR_INFO("ldst_dma",`INFO,"Pop from B7 IOWB. index=%d pa=%h D0=%h",
5346 index,b7_iowb2_pa,b7_iowb2[0]);
5347
5348 // Call task to send NAS message
5349 // Send 8 Bytes at a time
5350 dma_store (b7_iowb2_pa, {b7_iowb2[0], b7_iowb2[1]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 1");
5351 dma_store (b7_iowb2_pa+8, {b7_iowb2[2], b7_iowb2[3]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 2");
5352 dma_store (b7_iowb2_pa+16,{b7_iowb2[4], b7_iowb2[5]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 3");
5353 dma_store (b7_iowb2_pa+24,{b7_iowb2[6], b7_iowb2[7]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 4");
5354 dma_store (b7_iowb2_pa+32,{b7_iowb2[8], b7_iowb2[9]}, 8'hff,tmp_evict[2],8'd64,"B7 WRI 5");
5355 dma_store (b7_iowb2_pa+40,{b7_iowb2[10],b7_iowb2[11]},8'hff,tmp_evict[2],8'd64,"B7 WRI 6");
5356 dma_store (b7_iowb2_pa+48,{b7_iowb2[12],b7_iowb2[13]},8'hff,tmp_evict[3],8'd64,"B7 WRI 7");
5357 dma_store (b7_iowb2_pa+56,{b7_iowb2[14],b7_iowb2[15]},8'hff,tmp_evict[3],8'd64,"B7 WRI 8");
5358 end
5359 2'h3:
5360 begin
5361 if (!b7_iowb3_valid) begin
5362 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - b7_iowb3 Underflow.");
5363 end
5364 else begin
5365 b7_iowb3_valid <= 1'b0;
5366 end
5367
5368 `PR_INFO("ldst_dma",`INFO,"Pop from B7 IOWB. index=%d pa=%h D0=%h",
5369 index,b7_iowb3_pa,b7_iowb3[0]);
5370
5371 // Call task to send NAS message
5372 // Send 8 Bytes at a time
5373 dma_store (b7_iowb3_pa, {b7_iowb3[0], b7_iowb3[1]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 1");
5374 dma_store (b7_iowb3_pa+8, {b7_iowb3[2], b7_iowb3[3]}, 8'hff,tmp_evict[0],8'd64,"B7 WRI 2");
5375 dma_store (b7_iowb3_pa+16,{b7_iowb3[4], b7_iowb3[5]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 3");
5376 dma_store (b7_iowb3_pa+24,{b7_iowb3[6], b7_iowb3[7]}, 8'hff,tmp_evict[1],8'd64,"B7 WRI 4");
5377 dma_store (b7_iowb3_pa+32,{b7_iowb3[8], b7_iowb3[9]}, 8'hff,tmp_evict[2],8'd64,"B7 WRI 5");
5378 dma_store (b7_iowb3_pa+40,{b7_iowb3[10],b7_iowb3[11]},8'hff,tmp_evict[2],8'd64,"B7 WRI 6");
5379 dma_store (b7_iowb3_pa+48,{b7_iowb3[12],b7_iowb3[13]},8'hff,tmp_evict[3],8'd64,"B7 WRI 7");
5380 dma_store (b7_iowb3_pa+56,{b7_iowb3[14],b7_iowb3[15]},8'hff,tmp_evict[3],8'd64,"B7 WRI 8");
5381 end
5382 default:
5383 begin
5384 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task read_iowb should not hit default state");
5385 end
5386 endcase
5387
5388 end
5389endtask
5390
5391//----------------------------------------------------------
5392// Task to make sure the entry at the location pointed to by index is valid before we try to pop it.
5393task b7_chk_valid_entry;
5394
5395input [1:0] index;
5396
5397 begin
5398 case (index)
5399 2'h0:
5400 begin
5401 if (b7_iowb0_valid != 1'b1) begin
5402 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=0 is not valid (b7_iowb0_valid!=1'b1)");
5403 end
5404 end
5405 2'h1:
5406 begin
5407 if (b7_iowb1_valid != 1'b1) begin
5408 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=1 is not valid (b7_iowb1_valid!=1'b1)");
5409 end
5410 end
5411 2'h2:
5412 begin
5413 if (b7_iowb2_valid != 1'b1) begin
5414 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=2 is not valid (b7_iowb2_valid!=1'b1)");
5415 end
5416 end
5417 2'h3:
5418 begin
5419 if (b7_iowb3_valid != 1'b1) begin
5420 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - the entry in IOWB at index=3 is not valid (b7_iowb3_valid!=1'b1)");
5421 end
5422 end
5423 default:
5424 begin
5425 `PR_ERROR("pli_ldst",`ERROR,"Bench ERROR - task chk_valid_entry should not hit default state");
5426 end
5427 endcase
5428 end
5429endtask
5430
5431 `endif // `ifdef NOL2RTL
5432`endif // `ifdef NO_L2_BNK7
5433
5434
5435`endif // `ifdef GATESI7M
5436
5437//----------------------------------------------------------
5438// Task to send message to NAS
5439// Can be called by this module or Vera code (ENET Tx backdoor memory access)
5440task mem_slam;
5441
5442input [39:0] tmp_pa;
5443input [63:0] tmp_data;
5444input [7:0] tmp_size;
5445input [(8*8)-1:0] tmp_str; // 8 character string - source of this mem_slam
5446
5447integer junk;
5448
5449 begin
5450 // Hash PA before sending to Riesling
5451 if (`PARGS.hash_on && (tmp_pa[39]==1'b0)) begin // {
5452 tmp_pa = `TOP.hashpa(tmp_pa);
5453 end // }
5454
5455 if (`PARGS.nas_check_on && `PARGS.ldst_sync_on) begin // {
5456 `PR_INFO ("pli_ldst", `INFO,
5457 " PLI_MEM_SLAM pa=%h data=%h sz=%h ts=%0d (MEM_SLAM from %s)",
5458 tmp_pa,tmp_data,tmp_size,`TOP.core_cycle_cnt-1,tmp_str);
5459 junk = $sim_send(`PLI_MEM_SLAM,tmp_pa,tmp_data,tmp_size,`TOP.core_cycle_cnt-1);
5460 end // }
5461
5462 if (`PARGS.show_memop_on) begin // {
5463 `PR_NORMAL ("pli_ldst", `NORMAL,
5464 " MEMOP_STORE pa=%h data=%h sz=%h ts=%0d (MEM_SLAM from %s)",
5465 tmp_pa,tmp_data,tmp_size,`TOP.core_cycle_cnt-1,tmp_str);
5466 end // }
5467 end
5468endtask
5469
5470//----------------------------------------------------------
5471// Task to send message to NAS
5472// Note: DMA_STORE must come before the associated EVICT.
5473// This is required for Riesling to associate the 2 msgs properly.
5474task dma_store;
5475
5476input [39:0] tmp_pa;
5477input [63:0] tmp_data;
5478input [7:0] tmp_size;
5479input tmp_evict;
5480input [7:0] tmp_total_size;
5481input [(8*8)-1:0] tmp_str; // 8 character string - source of this dma_store
5482
5483integer junk;
5484
5485 begin
5486 // Hash PA before sending to Riesling
5487 if (`PARGS.hash_on && (tmp_pa[39]==1'b0)) begin // {
5488 tmp_pa = `TOP.hashpa(tmp_pa);
5489 end // }
5490
5491 if (`PARGS.nas_check_on && `PARGS.ldst_sync_on) begin // {
5492 `PR_INFO ("pli_ldst", `INFO,
5493 " PLI_MEM_DMAST pa=%h data=%h sz=%h inv=%b ts=%0d (%s)",
5494 tmp_pa,tmp_data,tmp_size,tmp_evict,`TOP.core_cycle_cnt-1,tmp_str);
5495 junk = $sim_send(`PLI_MEM_DMA_ST,tmp_pa,tmp_data,tmp_size,tmp_evict,tmp_total_size,`TOP.core_cycle_cnt-1);
5496 end // }
5497
5498 if (`PARGS.show_memop_on) begin // {
5499 `PR_NORMAL ("pli_ldst", `NORMAL,
5500 " MEMOP_STORE pa=%h data=%h sz=%h ts=%0d (DMA %s)",
5501 tmp_pa,tmp_data,tmp_size,`TOP.core_cycle_cnt-1,tmp_str);
5502 end // }
5503 end
5504endtask
5505
5506//----------------------------------------------------------
5507// Task to send message to NAS
5508// Can be called by this module or Vera code (ENET Tx backdoor memory access)
5509task mem_check;
5510
5511input [39:0] tmp_pa;
5512input [((64*8)-1):0] tmp_data; // 64 bytes
5513
5514integer junk;
5515
5516 begin
5517 if (`PARGS.nas_check_on && !`PARGS.dma_memchk_off) begin // {
5518 `PR_INFO ("pli_ldst", `INFO,
5519 " PLI_MEM_CHECK pa=%h data=%0h ts=%0d",
5520 tmp_pa,tmp_data,`TOP.core_cycle_cnt-1);
5521 // note: socket.c can only handle 8 Bytes max in each sim_send argument.
5522 // So, send 8 Bytes at a time. Riesling still sees 64 Byte stream.
5523 junk = $sim_send(`PLI_MEM_CHECK,tmp_pa,
5524 tmp_data[511:448],tmp_data[447:384],
5525 tmp_data[383:320],tmp_data[319:256],
5526 tmp_data[255:192],tmp_data[191:128],
5527 tmp_data[127:64],tmp_data[63:0]);
5528 end // }
5529
5530 if (`PARGS.show_memop_on) begin // {
5531 `PR_NORMAL ("pli_ldst", `NORMAL,
5532 " MEMOP_MEM_CHECK pa=%h data=%h ts=%0d",
5533 tmp_pa,tmp_data,`TOP.core_cycle_cnt-1);
5534 end // }
5535 end
5536endtask
5537
5538//----------------------------------------------------------
5539//----------------------------------------------------------