Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: itlb_rd.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 | `ifdef CORE_0 | |
36 | ||
37 | module itlb_rd_c0 ( | |
38 | ||
39 | mytg, | |
40 | itlb_pipe_d0, | |
41 | itlb_pipe_d1, | |
42 | itlb_pipe_d2, | |
43 | itlb_pipe_d3 | |
44 | ); | |
45 | ||
46 | // common defines | |
47 | `include "tlb_sync.vh" | |
48 | ||
49 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
50 | ||
51 | input mytg; | |
52 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
53 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
54 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
55 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
56 | `ifndef GATESIM | |
57 | ||
58 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
59 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
60 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
61 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
62 | reg [1:0] tid_e; | |
63 | reg [1:0] tid_m; | |
64 | reg [1:0] tid_b; | |
65 | ||
66 | wire [1:0] tid_d; | |
67 | wire inst_d; | |
68 | wire inst_b; | |
69 | wire [47:0] pc_b; | |
70 | ||
71 | reg [2:0] mycid; | |
72 | reg [5:0] mytnum; | |
73 | wire [5:0] newtnum; | |
74 | wire [2:0] newtid; | |
75 | wire [(`TS_WIDTH-1):0] ts_b; | |
76 | reg [(`TS_WIDTH-1):0] tstamp; | |
77 | reg ready; | |
78 | integer junk; | |
79 | ||
80 | initial begin // { | |
81 | ready = 0; | |
82 | @(posedge `SPC0.l2clk) ; | |
83 | @(posedge `SPC0.l2clk) ; | |
84 | ready = `PARGS.tlb_sync_on; | |
85 | mycid = 0; | |
86 | end //} | |
87 | ||
88 | assign newtid = ((mytg*4) + tid_b); | |
89 | assign newtnum = (mycid * 8) + newtid; | |
90 | ||
91 | //---------------------------------------------------------- | |
92 | // DUT probes | |
93 | ||
94 | assign tid_d = mytg ? `SPC0.dec.dec_tid1_d : | |
95 | `SPC0.dec.dec_tid0_d; | |
96 | ||
97 | assign inst_d = mytg ? `SPC0.dec.dec_decode1_d : | |
98 | `SPC0.dec.dec_decode0_d; | |
99 | ||
100 | assign inst_b = mytg ? |(`PROBES0.select_pc_b[7:4]) : | |
101 | |(`PROBES0.select_pc_b[3:0]); | |
102 | ||
103 | assign pc_b = mytg ? `PROBES0.pc_1_b : | |
104 | `PROBES0.pc_0_b; | |
105 | ||
106 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
107 | ||
108 | `ifdef TLB_FIFO_WIDE | |
109 | wire [7:0] ifu_err_vect; | |
110 | wire ifu_err_vld; | |
111 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
112 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
113 | `endif | |
114 | ||
115 | //---------------------------------------------------------- | |
116 | // Initialize pipeline | |
117 | initial begin // { | |
118 | ||
119 | @ (posedge `SPC0.l2clk); | |
120 | // Initialize pipeline | |
121 | itlb_pipe_d = 0; | |
122 | itlb_pipe_e = 0; | |
123 | itlb_pipe_m = 0; | |
124 | itlb_pipe_b = 0; | |
125 | tid_e = 0; | |
126 | tid_m = 0; | |
127 | tid_b = 0; | |
128 | ||
129 | end // } | |
130 | ||
131 | //---------------------------------------------------------- | |
132 | // Combo logic | |
133 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
134 | case (tid_d) | |
135 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
136 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
137 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
138 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
139 | endcase | |
140 | end // } | |
141 | ||
142 | //---------------------------------------------------------- | |
143 | // Pipeline registers | |
144 | // Send Command to NAS | |
145 | ||
146 | always @ (posedge `SPC0.l2clk & ready) begin // { | |
147 | ||
148 | tstamp = `TOP.core_cycle_cnt - 1; | |
149 | ||
150 | // if POR|WMR, then no TLBread | |
151 | if (`TOP.in_reset_core) begin // { | |
152 | ||
153 | // flush pipeline during reset | |
154 | itlb_pipe_e <= 0; | |
155 | itlb_pipe_m <= 0; | |
156 | itlb_pipe_b <= 0; | |
157 | ||
158 | tid_e <= 0; | |
159 | tid_m <= 0; | |
160 | tid_b <= 0; | |
161 | ||
162 | end // } | |
163 | else begin // { | |
164 | ||
165 | //--------------------------------- | |
166 | // Pipeline signals | |
167 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
168 | itlb_pipe_m <= itlb_pipe_e; | |
169 | itlb_pipe_b <= itlb_pipe_m; | |
170 | ||
171 | tid_e <= inst_d ? tid_d : 0; | |
172 | tid_m <= tid_e; | |
173 | tid_b <= tid_m; | |
174 | ||
175 | //--------------------------------- | |
176 | // ITLBREAD | |
177 | ||
178 | if (inst_b) begin // { | |
179 | if (ts_b==0) begin // { | |
180 | `PR_ERROR ("tlb_sync", `ERROR, | |
181 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
182 | mycid,newtid); | |
183 | end // } | |
184 | else begin // { | |
185 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
186 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
187 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
188 | ||
189 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core0[newtid]) begin // { | |
190 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
191 | mycid,newtid,newtnum,ts_b,pc_b); | |
192 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
193 | ||
194 | //-------------------- | |
195 | if (`PARGS.show_tlb_on) begin // { | |
196 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
197 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
198 | end //} | |
199 | ||
200 | end //} | |
201 | ||
202 | end // } | |
203 | end // } | |
204 | end // in_reset} | |
205 | ||
206 | end // always} | |
207 | ||
208 | //---------------------------------------------------------- | |
209 | `endif | |
210 | endmodule | |
211 | ||
212 | `endif | |
213 | `ifdef CORE_1 | |
214 | ||
215 | module itlb_rd_c1 ( | |
216 | ||
217 | mytg, | |
218 | itlb_pipe_d0, | |
219 | itlb_pipe_d1, | |
220 | itlb_pipe_d2, | |
221 | itlb_pipe_d3 | |
222 | ); | |
223 | ||
224 | // common defines | |
225 | `include "tlb_sync.vh" | |
226 | ||
227 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
228 | ||
229 | input mytg; | |
230 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
231 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
232 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
233 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
234 | `ifndef GATESIM | |
235 | ||
236 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
237 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
238 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
239 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
240 | reg [1:0] tid_e; | |
241 | reg [1:0] tid_m; | |
242 | reg [1:0] tid_b; | |
243 | ||
244 | wire [1:0] tid_d; | |
245 | wire inst_d; | |
246 | wire inst_b; | |
247 | wire [47:0] pc_b; | |
248 | ||
249 | reg [2:0] mycid; | |
250 | reg [5:0] mytnum; | |
251 | wire [5:0] newtnum; | |
252 | wire [2:0] newtid; | |
253 | wire [(`TS_WIDTH-1):0] ts_b; | |
254 | reg [(`TS_WIDTH-1):0] tstamp; | |
255 | reg ready; | |
256 | integer junk; | |
257 | ||
258 | initial begin // { | |
259 | ready = 0; | |
260 | @(posedge `SPC1.l2clk) ; | |
261 | @(posedge `SPC1.l2clk) ; | |
262 | ready = `PARGS.tlb_sync_on; | |
263 | mycid = 1; | |
264 | end //} | |
265 | ||
266 | assign newtid = ((mytg*4) + tid_b); | |
267 | assign newtnum = (mycid * 8) + newtid; | |
268 | ||
269 | //---------------------------------------------------------- | |
270 | // DUT probes | |
271 | ||
272 | assign tid_d = mytg ? `SPC1.dec.dec_tid1_d : | |
273 | `SPC1.dec.dec_tid0_d; | |
274 | ||
275 | assign inst_d = mytg ? `SPC1.dec.dec_decode1_d : | |
276 | `SPC1.dec.dec_decode0_d; | |
277 | ||
278 | assign inst_b = mytg ? |(`PROBES1.select_pc_b[7:4]) : | |
279 | |(`PROBES1.select_pc_b[3:0]); | |
280 | ||
281 | assign pc_b = mytg ? `PROBES1.pc_1_b : | |
282 | `PROBES1.pc_0_b; | |
283 | ||
284 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
285 | ||
286 | `ifdef TLB_FIFO_WIDE | |
287 | wire [7:0] ifu_err_vect; | |
288 | wire ifu_err_vld; | |
289 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
290 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
291 | `endif | |
292 | ||
293 | //---------------------------------------------------------- | |
294 | // Initialize pipeline | |
295 | initial begin // { | |
296 | ||
297 | @ (posedge `SPC1.l2clk); | |
298 | // Initialize pipeline | |
299 | itlb_pipe_d = 0; | |
300 | itlb_pipe_e = 0; | |
301 | itlb_pipe_m = 0; | |
302 | itlb_pipe_b = 0; | |
303 | tid_e = 0; | |
304 | tid_m = 0; | |
305 | tid_b = 0; | |
306 | ||
307 | end // } | |
308 | ||
309 | //---------------------------------------------------------- | |
310 | // Combo logic | |
311 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
312 | case (tid_d) | |
313 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
314 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
315 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
316 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
317 | endcase | |
318 | end // } | |
319 | ||
320 | //---------------------------------------------------------- | |
321 | // Pipeline registers | |
322 | // Send Command to NAS | |
323 | ||
324 | always @ (posedge `SPC1.l2clk & ready) begin // { | |
325 | ||
326 | tstamp = `TOP.core_cycle_cnt - 1; | |
327 | ||
328 | // if POR|WMR, then no TLBread | |
329 | if (`TOP.in_reset_core) begin // { | |
330 | ||
331 | // flush pipeline during reset | |
332 | itlb_pipe_e <= 0; | |
333 | itlb_pipe_m <= 0; | |
334 | itlb_pipe_b <= 0; | |
335 | ||
336 | tid_e <= 0; | |
337 | tid_m <= 0; | |
338 | tid_b <= 0; | |
339 | ||
340 | end // } | |
341 | else begin // { | |
342 | ||
343 | //--------------------------------- | |
344 | // Pipeline signals | |
345 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
346 | itlb_pipe_m <= itlb_pipe_e; | |
347 | itlb_pipe_b <= itlb_pipe_m; | |
348 | ||
349 | tid_e <= inst_d ? tid_d : 0; | |
350 | tid_m <= tid_e; | |
351 | tid_b <= tid_m; | |
352 | ||
353 | //--------------------------------- | |
354 | // ITLBREAD | |
355 | ||
356 | if (inst_b) begin // { | |
357 | if (ts_b==0) begin // { | |
358 | `PR_ERROR ("tlb_sync", `ERROR, | |
359 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
360 | mycid,newtid); | |
361 | end // } | |
362 | else begin // { | |
363 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
364 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
365 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
366 | ||
367 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core1[newtid]) begin // { | |
368 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
369 | mycid,newtid,newtnum,ts_b,pc_b); | |
370 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
371 | ||
372 | //-------------------- | |
373 | if (`PARGS.show_tlb_on) begin // { | |
374 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
375 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
376 | end //} | |
377 | ||
378 | end //} | |
379 | ||
380 | end // } | |
381 | end // } | |
382 | end // in_reset} | |
383 | ||
384 | end // always} | |
385 | ||
386 | //---------------------------------------------------------- | |
387 | `endif | |
388 | endmodule | |
389 | ||
390 | `endif | |
391 | `ifdef CORE_2 | |
392 | ||
393 | module itlb_rd_c2 ( | |
394 | ||
395 | mytg, | |
396 | itlb_pipe_d0, | |
397 | itlb_pipe_d1, | |
398 | itlb_pipe_d2, | |
399 | itlb_pipe_d3 | |
400 | ); | |
401 | ||
402 | // common defines | |
403 | `include "tlb_sync.vh" | |
404 | ||
405 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
406 | ||
407 | input mytg; | |
408 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
409 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
410 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
411 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
412 | `ifndef GATESIM | |
413 | ||
414 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
415 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
416 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
417 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
418 | reg [1:0] tid_e; | |
419 | reg [1:0] tid_m; | |
420 | reg [1:0] tid_b; | |
421 | ||
422 | wire [1:0] tid_d; | |
423 | wire inst_d; | |
424 | wire inst_b; | |
425 | wire [47:0] pc_b; | |
426 | ||
427 | reg [2:0] mycid; | |
428 | reg [5:0] mytnum; | |
429 | wire [5:0] newtnum; | |
430 | wire [2:0] newtid; | |
431 | wire [(`TS_WIDTH-1):0] ts_b; | |
432 | reg [(`TS_WIDTH-1):0] tstamp; | |
433 | reg ready; | |
434 | integer junk; | |
435 | ||
436 | initial begin // { | |
437 | ready = 0; | |
438 | @(posedge `SPC2.l2clk) ; | |
439 | @(posedge `SPC2.l2clk) ; | |
440 | ready = `PARGS.tlb_sync_on; | |
441 | mycid = 2; | |
442 | end //} | |
443 | ||
444 | assign newtid = ((mytg*4) + tid_b); | |
445 | assign newtnum = (mycid * 8) + newtid; | |
446 | ||
447 | //---------------------------------------------------------- | |
448 | // DUT probes | |
449 | ||
450 | assign tid_d = mytg ? `SPC2.dec.dec_tid1_d : | |
451 | `SPC2.dec.dec_tid0_d; | |
452 | ||
453 | assign inst_d = mytg ? `SPC2.dec.dec_decode1_d : | |
454 | `SPC2.dec.dec_decode0_d; | |
455 | ||
456 | assign inst_b = mytg ? |(`PROBES2.select_pc_b[7:4]) : | |
457 | |(`PROBES2.select_pc_b[3:0]); | |
458 | ||
459 | assign pc_b = mytg ? `PROBES2.pc_1_b : | |
460 | `PROBES2.pc_0_b; | |
461 | ||
462 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
463 | ||
464 | `ifdef TLB_FIFO_WIDE | |
465 | wire [7:0] ifu_err_vect; | |
466 | wire ifu_err_vld; | |
467 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
468 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
469 | `endif | |
470 | ||
471 | //---------------------------------------------------------- | |
472 | // Initialize pipeline | |
473 | initial begin // { | |
474 | ||
475 | @ (posedge `SPC2.l2clk); | |
476 | // Initialize pipeline | |
477 | itlb_pipe_d = 0; | |
478 | itlb_pipe_e = 0; | |
479 | itlb_pipe_m = 0; | |
480 | itlb_pipe_b = 0; | |
481 | tid_e = 0; | |
482 | tid_m = 0; | |
483 | tid_b = 0; | |
484 | ||
485 | end // } | |
486 | ||
487 | //---------------------------------------------------------- | |
488 | // Combo logic | |
489 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
490 | case (tid_d) | |
491 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
492 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
493 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
494 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
495 | endcase | |
496 | end // } | |
497 | ||
498 | //---------------------------------------------------------- | |
499 | // Pipeline registers | |
500 | // Send Command to NAS | |
501 | ||
502 | always @ (posedge `SPC2.l2clk & ready) begin // { | |
503 | ||
504 | tstamp = `TOP.core_cycle_cnt - 1; | |
505 | ||
506 | // if POR|WMR, then no TLBread | |
507 | if (`TOP.in_reset_core) begin // { | |
508 | ||
509 | // flush pipeline during reset | |
510 | itlb_pipe_e <= 0; | |
511 | itlb_pipe_m <= 0; | |
512 | itlb_pipe_b <= 0; | |
513 | ||
514 | tid_e <= 0; | |
515 | tid_m <= 0; | |
516 | tid_b <= 0; | |
517 | ||
518 | end // } | |
519 | else begin // { | |
520 | ||
521 | //--------------------------------- | |
522 | // Pipeline signals | |
523 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
524 | itlb_pipe_m <= itlb_pipe_e; | |
525 | itlb_pipe_b <= itlb_pipe_m; | |
526 | ||
527 | tid_e <= inst_d ? tid_d : 0; | |
528 | tid_m <= tid_e; | |
529 | tid_b <= tid_m; | |
530 | ||
531 | //--------------------------------- | |
532 | // ITLBREAD | |
533 | ||
534 | if (inst_b) begin // { | |
535 | if (ts_b==0) begin // { | |
536 | `PR_ERROR ("tlb_sync", `ERROR, | |
537 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
538 | mycid,newtid); | |
539 | end // } | |
540 | else begin // { | |
541 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
542 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
543 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
544 | ||
545 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core2[newtid]) begin // { | |
546 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
547 | mycid,newtid,newtnum,ts_b,pc_b); | |
548 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
549 | ||
550 | //-------------------- | |
551 | if (`PARGS.show_tlb_on) begin // { | |
552 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
553 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
554 | end //} | |
555 | ||
556 | end //} | |
557 | ||
558 | end // } | |
559 | end // } | |
560 | end // in_reset} | |
561 | ||
562 | end // always} | |
563 | ||
564 | //---------------------------------------------------------- | |
565 | `endif | |
566 | endmodule | |
567 | ||
568 | `endif | |
569 | `ifdef CORE_3 | |
570 | ||
571 | module itlb_rd_c3 ( | |
572 | ||
573 | mytg, | |
574 | itlb_pipe_d0, | |
575 | itlb_pipe_d1, | |
576 | itlb_pipe_d2, | |
577 | itlb_pipe_d3 | |
578 | ); | |
579 | ||
580 | // common defines | |
581 | `include "tlb_sync.vh" | |
582 | ||
583 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
584 | ||
585 | input mytg; | |
586 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
587 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
588 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
589 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
590 | `ifndef GATESIM | |
591 | ||
592 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
593 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
594 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
595 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
596 | reg [1:0] tid_e; | |
597 | reg [1:0] tid_m; | |
598 | reg [1:0] tid_b; | |
599 | ||
600 | wire [1:0] tid_d; | |
601 | wire inst_d; | |
602 | wire inst_b; | |
603 | wire [47:0] pc_b; | |
604 | ||
605 | reg [2:0] mycid; | |
606 | reg [5:0] mytnum; | |
607 | wire [5:0] newtnum; | |
608 | wire [2:0] newtid; | |
609 | wire [(`TS_WIDTH-1):0] ts_b; | |
610 | reg [(`TS_WIDTH-1):0] tstamp; | |
611 | reg ready; | |
612 | integer junk; | |
613 | ||
614 | initial begin // { | |
615 | ready = 0; | |
616 | @(posedge `SPC3.l2clk) ; | |
617 | @(posedge `SPC3.l2clk) ; | |
618 | ready = `PARGS.tlb_sync_on; | |
619 | mycid = 3; | |
620 | end //} | |
621 | ||
622 | assign newtid = ((mytg*4) + tid_b); | |
623 | assign newtnum = (mycid * 8) + newtid; | |
624 | ||
625 | //---------------------------------------------------------- | |
626 | // DUT probes | |
627 | ||
628 | assign tid_d = mytg ? `SPC3.dec.dec_tid1_d : | |
629 | `SPC3.dec.dec_tid0_d; | |
630 | ||
631 | assign inst_d = mytg ? `SPC3.dec.dec_decode1_d : | |
632 | `SPC3.dec.dec_decode0_d; | |
633 | ||
634 | assign inst_b = mytg ? |(`PROBES3.select_pc_b[7:4]) : | |
635 | |(`PROBES3.select_pc_b[3:0]); | |
636 | ||
637 | assign pc_b = mytg ? `PROBES3.pc_1_b : | |
638 | `PROBES3.pc_0_b; | |
639 | ||
640 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
641 | ||
642 | `ifdef TLB_FIFO_WIDE | |
643 | wire [7:0] ifu_err_vect; | |
644 | wire ifu_err_vld; | |
645 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
646 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
647 | `endif | |
648 | ||
649 | //---------------------------------------------------------- | |
650 | // Initialize pipeline | |
651 | initial begin // { | |
652 | ||
653 | @ (posedge `SPC3.l2clk); | |
654 | // Initialize pipeline | |
655 | itlb_pipe_d = 0; | |
656 | itlb_pipe_e = 0; | |
657 | itlb_pipe_m = 0; | |
658 | itlb_pipe_b = 0; | |
659 | tid_e = 0; | |
660 | tid_m = 0; | |
661 | tid_b = 0; | |
662 | ||
663 | end // } | |
664 | ||
665 | //---------------------------------------------------------- | |
666 | // Combo logic | |
667 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
668 | case (tid_d) | |
669 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
670 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
671 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
672 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
673 | endcase | |
674 | end // } | |
675 | ||
676 | //---------------------------------------------------------- | |
677 | // Pipeline registers | |
678 | // Send Command to NAS | |
679 | ||
680 | always @ (posedge `SPC3.l2clk & ready) begin // { | |
681 | ||
682 | tstamp = `TOP.core_cycle_cnt - 1; | |
683 | ||
684 | // if POR|WMR, then no TLBread | |
685 | if (`TOP.in_reset_core) begin // { | |
686 | ||
687 | // flush pipeline during reset | |
688 | itlb_pipe_e <= 0; | |
689 | itlb_pipe_m <= 0; | |
690 | itlb_pipe_b <= 0; | |
691 | ||
692 | tid_e <= 0; | |
693 | tid_m <= 0; | |
694 | tid_b <= 0; | |
695 | ||
696 | end // } | |
697 | else begin // { | |
698 | ||
699 | //--------------------------------- | |
700 | // Pipeline signals | |
701 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
702 | itlb_pipe_m <= itlb_pipe_e; | |
703 | itlb_pipe_b <= itlb_pipe_m; | |
704 | ||
705 | tid_e <= inst_d ? tid_d : 0; | |
706 | tid_m <= tid_e; | |
707 | tid_b <= tid_m; | |
708 | ||
709 | //--------------------------------- | |
710 | // ITLBREAD | |
711 | ||
712 | if (inst_b) begin // { | |
713 | if (ts_b==0) begin // { | |
714 | `PR_ERROR ("tlb_sync", `ERROR, | |
715 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
716 | mycid,newtid); | |
717 | end // } | |
718 | else begin // { | |
719 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
720 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
721 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
722 | ||
723 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core3[newtid]) begin // { | |
724 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
725 | mycid,newtid,newtnum,ts_b,pc_b); | |
726 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
727 | ||
728 | //-------------------- | |
729 | if (`PARGS.show_tlb_on) begin // { | |
730 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
731 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
732 | end //} | |
733 | ||
734 | end //} | |
735 | ||
736 | end // } | |
737 | end // } | |
738 | end // in_reset} | |
739 | ||
740 | end // always} | |
741 | ||
742 | //---------------------------------------------------------- | |
743 | `endif | |
744 | endmodule | |
745 | ||
746 | `endif | |
747 | `ifdef CORE_4 | |
748 | ||
749 | module itlb_rd_c4 ( | |
750 | ||
751 | mytg, | |
752 | itlb_pipe_d0, | |
753 | itlb_pipe_d1, | |
754 | itlb_pipe_d2, | |
755 | itlb_pipe_d3 | |
756 | ); | |
757 | ||
758 | // common defines | |
759 | `include "tlb_sync.vh" | |
760 | ||
761 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
762 | ||
763 | input mytg; | |
764 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
765 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
766 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
767 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
768 | `ifndef GATESIM | |
769 | ||
770 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
771 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
772 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
773 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
774 | reg [1:0] tid_e; | |
775 | reg [1:0] tid_m; | |
776 | reg [1:0] tid_b; | |
777 | ||
778 | wire [1:0] tid_d; | |
779 | wire inst_d; | |
780 | wire inst_b; | |
781 | wire [47:0] pc_b; | |
782 | ||
783 | reg [2:0] mycid; | |
784 | reg [5:0] mytnum; | |
785 | wire [5:0] newtnum; | |
786 | wire [2:0] newtid; | |
787 | wire [(`TS_WIDTH-1):0] ts_b; | |
788 | reg [(`TS_WIDTH-1):0] tstamp; | |
789 | reg ready; | |
790 | integer junk; | |
791 | ||
792 | initial begin // { | |
793 | ready = 0; | |
794 | @(posedge `SPC4.l2clk) ; | |
795 | @(posedge `SPC4.l2clk) ; | |
796 | ready = `PARGS.tlb_sync_on; | |
797 | mycid = 4; | |
798 | end //} | |
799 | ||
800 | assign newtid = ((mytg*4) + tid_b); | |
801 | assign newtnum = (mycid * 8) + newtid; | |
802 | ||
803 | //---------------------------------------------------------- | |
804 | // DUT probes | |
805 | ||
806 | assign tid_d = mytg ? `SPC4.dec.dec_tid1_d : | |
807 | `SPC4.dec.dec_tid0_d; | |
808 | ||
809 | assign inst_d = mytg ? `SPC4.dec.dec_decode1_d : | |
810 | `SPC4.dec.dec_decode0_d; | |
811 | ||
812 | assign inst_b = mytg ? |(`PROBES4.select_pc_b[7:4]) : | |
813 | |(`PROBES4.select_pc_b[3:0]); | |
814 | ||
815 | assign pc_b = mytg ? `PROBES4.pc_1_b : | |
816 | `PROBES4.pc_0_b; | |
817 | ||
818 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
819 | ||
820 | `ifdef TLB_FIFO_WIDE | |
821 | wire [7:0] ifu_err_vect; | |
822 | wire ifu_err_vld; | |
823 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
824 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
825 | `endif | |
826 | ||
827 | //---------------------------------------------------------- | |
828 | // Initialize pipeline | |
829 | initial begin // { | |
830 | ||
831 | @ (posedge `SPC4.l2clk); | |
832 | // Initialize pipeline | |
833 | itlb_pipe_d = 0; | |
834 | itlb_pipe_e = 0; | |
835 | itlb_pipe_m = 0; | |
836 | itlb_pipe_b = 0; | |
837 | tid_e = 0; | |
838 | tid_m = 0; | |
839 | tid_b = 0; | |
840 | ||
841 | end // } | |
842 | ||
843 | //---------------------------------------------------------- | |
844 | // Combo logic | |
845 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
846 | case (tid_d) | |
847 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
848 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
849 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
850 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
851 | endcase | |
852 | end // } | |
853 | ||
854 | //---------------------------------------------------------- | |
855 | // Pipeline registers | |
856 | // Send Command to NAS | |
857 | ||
858 | always @ (posedge `SPC4.l2clk & ready) begin // { | |
859 | ||
860 | tstamp = `TOP.core_cycle_cnt - 1; | |
861 | ||
862 | // if POR|WMR, then no TLBread | |
863 | if (`TOP.in_reset_core) begin // { | |
864 | ||
865 | // flush pipeline during reset | |
866 | itlb_pipe_e <= 0; | |
867 | itlb_pipe_m <= 0; | |
868 | itlb_pipe_b <= 0; | |
869 | ||
870 | tid_e <= 0; | |
871 | tid_m <= 0; | |
872 | tid_b <= 0; | |
873 | ||
874 | end // } | |
875 | else begin // { | |
876 | ||
877 | //--------------------------------- | |
878 | // Pipeline signals | |
879 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
880 | itlb_pipe_m <= itlb_pipe_e; | |
881 | itlb_pipe_b <= itlb_pipe_m; | |
882 | ||
883 | tid_e <= inst_d ? tid_d : 0; | |
884 | tid_m <= tid_e; | |
885 | tid_b <= tid_m; | |
886 | ||
887 | //--------------------------------- | |
888 | // ITLBREAD | |
889 | ||
890 | if (inst_b) begin // { | |
891 | if (ts_b==0) begin // { | |
892 | `PR_ERROR ("tlb_sync", `ERROR, | |
893 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
894 | mycid,newtid); | |
895 | end // } | |
896 | else begin // { | |
897 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
898 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
899 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
900 | ||
901 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core4[newtid]) begin // { | |
902 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
903 | mycid,newtid,newtnum,ts_b,pc_b); | |
904 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
905 | ||
906 | //-------------------- | |
907 | if (`PARGS.show_tlb_on) begin // { | |
908 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
909 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
910 | end //} | |
911 | ||
912 | end //} | |
913 | ||
914 | end // } | |
915 | end // } | |
916 | end // in_reset} | |
917 | ||
918 | end // always} | |
919 | ||
920 | //---------------------------------------------------------- | |
921 | `endif | |
922 | endmodule | |
923 | ||
924 | `endif | |
925 | `ifdef CORE_5 | |
926 | ||
927 | module itlb_rd_c5 ( | |
928 | ||
929 | mytg, | |
930 | itlb_pipe_d0, | |
931 | itlb_pipe_d1, | |
932 | itlb_pipe_d2, | |
933 | itlb_pipe_d3 | |
934 | ); | |
935 | ||
936 | // common defines | |
937 | `include "tlb_sync.vh" | |
938 | ||
939 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
940 | ||
941 | input mytg; | |
942 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
943 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
944 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
945 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
946 | `ifndef GATESIM | |
947 | ||
948 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
949 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
950 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
951 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
952 | reg [1:0] tid_e; | |
953 | reg [1:0] tid_m; | |
954 | reg [1:0] tid_b; | |
955 | ||
956 | wire [1:0] tid_d; | |
957 | wire inst_d; | |
958 | wire inst_b; | |
959 | wire [47:0] pc_b; | |
960 | ||
961 | reg [2:0] mycid; | |
962 | reg [5:0] mytnum; | |
963 | wire [5:0] newtnum; | |
964 | wire [2:0] newtid; | |
965 | wire [(`TS_WIDTH-1):0] ts_b; | |
966 | reg [(`TS_WIDTH-1):0] tstamp; | |
967 | reg ready; | |
968 | integer junk; | |
969 | ||
970 | initial begin // { | |
971 | ready = 0; | |
972 | @(posedge `SPC5.l2clk) ; | |
973 | @(posedge `SPC5.l2clk) ; | |
974 | ready = `PARGS.tlb_sync_on; | |
975 | mycid = 5; | |
976 | end //} | |
977 | ||
978 | assign newtid = ((mytg*4) + tid_b); | |
979 | assign newtnum = (mycid * 8) + newtid; | |
980 | ||
981 | //---------------------------------------------------------- | |
982 | // DUT probes | |
983 | ||
984 | assign tid_d = mytg ? `SPC5.dec.dec_tid1_d : | |
985 | `SPC5.dec.dec_tid0_d; | |
986 | ||
987 | assign inst_d = mytg ? `SPC5.dec.dec_decode1_d : | |
988 | `SPC5.dec.dec_decode0_d; | |
989 | ||
990 | assign inst_b = mytg ? |(`PROBES5.select_pc_b[7:4]) : | |
991 | |(`PROBES5.select_pc_b[3:0]); | |
992 | ||
993 | assign pc_b = mytg ? `PROBES5.pc_1_b : | |
994 | `PROBES5.pc_0_b; | |
995 | ||
996 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
997 | ||
998 | `ifdef TLB_FIFO_WIDE | |
999 | wire [7:0] ifu_err_vect; | |
1000 | wire ifu_err_vld; | |
1001 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
1002 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
1003 | `endif | |
1004 | ||
1005 | //---------------------------------------------------------- | |
1006 | // Initialize pipeline | |
1007 | initial begin // { | |
1008 | ||
1009 | @ (posedge `SPC5.l2clk); | |
1010 | // Initialize pipeline | |
1011 | itlb_pipe_d = 0; | |
1012 | itlb_pipe_e = 0; | |
1013 | itlb_pipe_m = 0; | |
1014 | itlb_pipe_b = 0; | |
1015 | tid_e = 0; | |
1016 | tid_m = 0; | |
1017 | tid_b = 0; | |
1018 | ||
1019 | end // } | |
1020 | ||
1021 | //---------------------------------------------------------- | |
1022 | // Combo logic | |
1023 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
1024 | case (tid_d) | |
1025 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
1026 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
1027 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
1028 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
1029 | endcase | |
1030 | end // } | |
1031 | ||
1032 | //---------------------------------------------------------- | |
1033 | // Pipeline registers | |
1034 | // Send Command to NAS | |
1035 | ||
1036 | always @ (posedge `SPC5.l2clk & ready) begin // { | |
1037 | ||
1038 | tstamp = `TOP.core_cycle_cnt - 1; | |
1039 | ||
1040 | // if POR|WMR, then no TLBread | |
1041 | if (`TOP.in_reset_core) begin // { | |
1042 | ||
1043 | // flush pipeline during reset | |
1044 | itlb_pipe_e <= 0; | |
1045 | itlb_pipe_m <= 0; | |
1046 | itlb_pipe_b <= 0; | |
1047 | ||
1048 | tid_e <= 0; | |
1049 | tid_m <= 0; | |
1050 | tid_b <= 0; | |
1051 | ||
1052 | end // } | |
1053 | else begin // { | |
1054 | ||
1055 | //--------------------------------- | |
1056 | // Pipeline signals | |
1057 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
1058 | itlb_pipe_m <= itlb_pipe_e; | |
1059 | itlb_pipe_b <= itlb_pipe_m; | |
1060 | ||
1061 | tid_e <= inst_d ? tid_d : 0; | |
1062 | tid_m <= tid_e; | |
1063 | tid_b <= tid_m; | |
1064 | ||
1065 | //--------------------------------- | |
1066 | // ITLBREAD | |
1067 | ||
1068 | if (inst_b) begin // { | |
1069 | if (ts_b==0) begin // { | |
1070 | `PR_ERROR ("tlb_sync", `ERROR, | |
1071 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
1072 | mycid,newtid); | |
1073 | end // } | |
1074 | else begin // { | |
1075 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
1076 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
1077 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
1078 | ||
1079 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core5[newtid]) begin // { | |
1080 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
1081 | mycid,newtid,newtnum,ts_b,pc_b); | |
1082 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
1083 | ||
1084 | //-------------------- | |
1085 | if (`PARGS.show_tlb_on) begin // { | |
1086 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
1087 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
1088 | end //} | |
1089 | ||
1090 | end //} | |
1091 | ||
1092 | end // } | |
1093 | end // } | |
1094 | end // in_reset} | |
1095 | ||
1096 | end // always} | |
1097 | ||
1098 | //---------------------------------------------------------- | |
1099 | `endif | |
1100 | endmodule | |
1101 | ||
1102 | `endif | |
1103 | `ifdef CORE_6 | |
1104 | ||
1105 | module itlb_rd_c6 ( | |
1106 | ||
1107 | mytg, | |
1108 | itlb_pipe_d0, | |
1109 | itlb_pipe_d1, | |
1110 | itlb_pipe_d2, | |
1111 | itlb_pipe_d3 | |
1112 | ); | |
1113 | ||
1114 | // common defines | |
1115 | `include "tlb_sync.vh" | |
1116 | ||
1117 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
1118 | ||
1119 | input mytg; | |
1120 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
1121 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
1122 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
1123 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
1124 | `ifndef GATESIM | |
1125 | ||
1126 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
1127 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
1128 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
1129 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
1130 | reg [1:0] tid_e; | |
1131 | reg [1:0] tid_m; | |
1132 | reg [1:0] tid_b; | |
1133 | ||
1134 | wire [1:0] tid_d; | |
1135 | wire inst_d; | |
1136 | wire inst_b; | |
1137 | wire [47:0] pc_b; | |
1138 | ||
1139 | reg [2:0] mycid; | |
1140 | reg [5:0] mytnum; | |
1141 | wire [5:0] newtnum; | |
1142 | wire [2:0] newtid; | |
1143 | wire [(`TS_WIDTH-1):0] ts_b; | |
1144 | reg [(`TS_WIDTH-1):0] tstamp; | |
1145 | reg ready; | |
1146 | integer junk; | |
1147 | ||
1148 | initial begin // { | |
1149 | ready = 0; | |
1150 | @(posedge `SPC6.l2clk) ; | |
1151 | @(posedge `SPC6.l2clk) ; | |
1152 | ready = `PARGS.tlb_sync_on; | |
1153 | mycid = 6; | |
1154 | end //} | |
1155 | ||
1156 | assign newtid = ((mytg*4) + tid_b); | |
1157 | assign newtnum = (mycid * 8) + newtid; | |
1158 | ||
1159 | //---------------------------------------------------------- | |
1160 | // DUT probes | |
1161 | ||
1162 | assign tid_d = mytg ? `SPC6.dec.dec_tid1_d : | |
1163 | `SPC6.dec.dec_tid0_d; | |
1164 | ||
1165 | assign inst_d = mytg ? `SPC6.dec.dec_decode1_d : | |
1166 | `SPC6.dec.dec_decode0_d; | |
1167 | ||
1168 | assign inst_b = mytg ? |(`PROBES6.select_pc_b[7:4]) : | |
1169 | |(`PROBES6.select_pc_b[3:0]); | |
1170 | ||
1171 | assign pc_b = mytg ? `PROBES6.pc_1_b : | |
1172 | `PROBES6.pc_0_b; | |
1173 | ||
1174 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
1175 | ||
1176 | `ifdef TLB_FIFO_WIDE | |
1177 | wire [7:0] ifu_err_vect; | |
1178 | wire ifu_err_vld; | |
1179 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
1180 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
1181 | `endif | |
1182 | ||
1183 | //---------------------------------------------------------- | |
1184 | // Initialize pipeline | |
1185 | initial begin // { | |
1186 | ||
1187 | @ (posedge `SPC6.l2clk); | |
1188 | // Initialize pipeline | |
1189 | itlb_pipe_d = 0; | |
1190 | itlb_pipe_e = 0; | |
1191 | itlb_pipe_m = 0; | |
1192 | itlb_pipe_b = 0; | |
1193 | tid_e = 0; | |
1194 | tid_m = 0; | |
1195 | tid_b = 0; | |
1196 | ||
1197 | end // } | |
1198 | ||
1199 | //---------------------------------------------------------- | |
1200 | // Combo logic | |
1201 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
1202 | case (tid_d) | |
1203 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
1204 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
1205 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
1206 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
1207 | endcase | |
1208 | end // } | |
1209 | ||
1210 | //---------------------------------------------------------- | |
1211 | // Pipeline registers | |
1212 | // Send Command to NAS | |
1213 | ||
1214 | always @ (posedge `SPC6.l2clk & ready) begin // { | |
1215 | ||
1216 | tstamp = `TOP.core_cycle_cnt - 1; | |
1217 | ||
1218 | // if POR|WMR, then no TLBread | |
1219 | if (`TOP.in_reset_core) begin // { | |
1220 | ||
1221 | // flush pipeline during reset | |
1222 | itlb_pipe_e <= 0; | |
1223 | itlb_pipe_m <= 0; | |
1224 | itlb_pipe_b <= 0; | |
1225 | ||
1226 | tid_e <= 0; | |
1227 | tid_m <= 0; | |
1228 | tid_b <= 0; | |
1229 | ||
1230 | end // } | |
1231 | else begin // { | |
1232 | ||
1233 | //--------------------------------- | |
1234 | // Pipeline signals | |
1235 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
1236 | itlb_pipe_m <= itlb_pipe_e; | |
1237 | itlb_pipe_b <= itlb_pipe_m; | |
1238 | ||
1239 | tid_e <= inst_d ? tid_d : 0; | |
1240 | tid_m <= tid_e; | |
1241 | tid_b <= tid_m; | |
1242 | ||
1243 | //--------------------------------- | |
1244 | // ITLBREAD | |
1245 | ||
1246 | if (inst_b) begin // { | |
1247 | if (ts_b==0) begin // { | |
1248 | `PR_ERROR ("tlb_sync", `ERROR, | |
1249 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
1250 | mycid,newtid); | |
1251 | end // } | |
1252 | else begin // { | |
1253 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
1254 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
1255 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
1256 | ||
1257 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core6[newtid]) begin // { | |
1258 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
1259 | mycid,newtid,newtnum,ts_b,pc_b); | |
1260 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
1261 | ||
1262 | //-------------------- | |
1263 | if (`PARGS.show_tlb_on) begin // { | |
1264 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
1265 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
1266 | end //} | |
1267 | ||
1268 | end //} | |
1269 | ||
1270 | end // } | |
1271 | end // } | |
1272 | end // in_reset} | |
1273 | ||
1274 | end // always} | |
1275 | ||
1276 | //---------------------------------------------------------- | |
1277 | `endif | |
1278 | endmodule | |
1279 | ||
1280 | `endif | |
1281 | `ifdef CORE_7 | |
1282 | ||
1283 | module itlb_rd_c7 ( | |
1284 | ||
1285 | mytg, | |
1286 | itlb_pipe_d0, | |
1287 | itlb_pipe_d1, | |
1288 | itlb_pipe_d2, | |
1289 | itlb_pipe_d3 | |
1290 | ); | |
1291 | ||
1292 | // common defines | |
1293 | `include "tlb_sync.vh" | |
1294 | ||
1295 | parameter WIDTH = `TLB_FIFO_WIDTH; | |
1296 | ||
1297 | input mytg; | |
1298 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0; | |
1299 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1; | |
1300 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2; | |
1301 | input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3; | |
1302 | `ifndef GATESIM | |
1303 | ||
1304 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d; | |
1305 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e; | |
1306 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m; | |
1307 | reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b; | |
1308 | reg [1:0] tid_e; | |
1309 | reg [1:0] tid_m; | |
1310 | reg [1:0] tid_b; | |
1311 | ||
1312 | wire [1:0] tid_d; | |
1313 | wire inst_d; | |
1314 | wire inst_b; | |
1315 | wire [47:0] pc_b; | |
1316 | ||
1317 | reg [2:0] mycid; | |
1318 | reg [5:0] mytnum; | |
1319 | wire [5:0] newtnum; | |
1320 | wire [2:0] newtid; | |
1321 | wire [(`TS_WIDTH-1):0] ts_b; | |
1322 | reg [(`TS_WIDTH-1):0] tstamp; | |
1323 | reg ready; | |
1324 | integer junk; | |
1325 | ||
1326 | initial begin // { | |
1327 | ready = 0; | |
1328 | @(posedge `SPC7.l2clk) ; | |
1329 | @(posedge `SPC7.l2clk) ; | |
1330 | ready = `PARGS.tlb_sync_on; | |
1331 | mycid = 7; | |
1332 | end //} | |
1333 | ||
1334 | assign newtid = ((mytg*4) + tid_b); | |
1335 | assign newtnum = (mycid * 8) + newtid; | |
1336 | ||
1337 | //---------------------------------------------------------- | |
1338 | // DUT probes | |
1339 | ||
1340 | assign tid_d = mytg ? `SPC7.dec.dec_tid1_d : | |
1341 | `SPC7.dec.dec_tid0_d; | |
1342 | ||
1343 | assign inst_d = mytg ? `SPC7.dec.dec_decode1_d : | |
1344 | `SPC7.dec.dec_decode0_d; | |
1345 | ||
1346 | assign inst_b = mytg ? |(`PROBES7.select_pc_b[7:4]) : | |
1347 | |(`PROBES7.select_pc_b[3:0]); | |
1348 | ||
1349 | assign pc_b = mytg ? `PROBES7.pc_1_b : | |
1350 | `PROBES7.pc_0_b; | |
1351 | ||
1352 | assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0]; | |
1353 | ||
1354 | `ifdef TLB_FIFO_WIDE | |
1355 | wire [7:0] ifu_err_vect; | |
1356 | wire ifu_err_vld; | |
1357 | assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9]; | |
1358 | assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1]; | |
1359 | `endif | |
1360 | ||
1361 | //---------------------------------------------------------- | |
1362 | // Initialize pipeline | |
1363 | initial begin // { | |
1364 | ||
1365 | @ (posedge `SPC7.l2clk); | |
1366 | // Initialize pipeline | |
1367 | itlb_pipe_d = 0; | |
1368 | itlb_pipe_e = 0; | |
1369 | itlb_pipe_m = 0; | |
1370 | itlb_pipe_b = 0; | |
1371 | tid_e = 0; | |
1372 | tid_m = 0; | |
1373 | tid_b = 0; | |
1374 | ||
1375 | end // } | |
1376 | ||
1377 | //---------------------------------------------------------- | |
1378 | // Combo logic | |
1379 | always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // { | |
1380 | case (tid_d) | |
1381 | 2'b00: itlb_pipe_d = itlb_pipe_d0; | |
1382 | 2'b01: itlb_pipe_d = itlb_pipe_d1; | |
1383 | 2'b10: itlb_pipe_d = itlb_pipe_d2; | |
1384 | 2'b11: itlb_pipe_d = itlb_pipe_d3; | |
1385 | endcase | |
1386 | end // } | |
1387 | ||
1388 | //---------------------------------------------------------- | |
1389 | // Pipeline registers | |
1390 | // Send Command to NAS | |
1391 | ||
1392 | always @ (posedge `SPC7.l2clk & ready) begin // { | |
1393 | ||
1394 | tstamp = `TOP.core_cycle_cnt - 1; | |
1395 | ||
1396 | // if POR|WMR, then no TLBread | |
1397 | if (`TOP.in_reset_core) begin // { | |
1398 | ||
1399 | // flush pipeline during reset | |
1400 | itlb_pipe_e <= 0; | |
1401 | itlb_pipe_m <= 0; | |
1402 | itlb_pipe_b <= 0; | |
1403 | ||
1404 | tid_e <= 0; | |
1405 | tid_m <= 0; | |
1406 | tid_b <= 0; | |
1407 | ||
1408 | end // } | |
1409 | else begin // { | |
1410 | ||
1411 | //--------------------------------- | |
1412 | // Pipeline signals | |
1413 | itlb_pipe_e <= inst_d ? itlb_pipe_d : 0; | |
1414 | itlb_pipe_m <= itlb_pipe_e; | |
1415 | itlb_pipe_b <= itlb_pipe_m; | |
1416 | ||
1417 | tid_e <= inst_d ? tid_d : 0; | |
1418 | tid_m <= tid_e; | |
1419 | tid_b <= tid_m; | |
1420 | ||
1421 | //--------------------------------- | |
1422 | // ITLBREAD | |
1423 | ||
1424 | if (inst_b) begin // { | |
1425 | if (ts_b==0) begin // { | |
1426 | `PR_ERROR ("tlb_sync", `ERROR, | |
1427 | "C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.", | |
1428 | mycid,newtid); | |
1429 | end // } | |
1430 | else begin // { | |
1431 | // Must suppress PLI_ITLBREAD messages if th_check_enable=0. | |
1432 | // This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap). | |
1433 | // So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs. | |
1434 | ||
1435 | if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core7[newtid]) begin // { | |
1436 | `PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h", | |
1437 | mycid,newtid,newtnum,ts_b,pc_b); | |
1438 | junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b); | |
1439 | ||
1440 | //-------------------- | |
1441 | if (`PARGS.show_tlb_on) begin // { | |
1442 | $display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d", | |
1443 | mycid,newtid,pc_b,ts_b*`TOP.core_period); | |
1444 | end //} | |
1445 | ||
1446 | end //} | |
1447 | ||
1448 | end // } | |
1449 | end // } | |
1450 | end // in_reset} | |
1451 | ||
1452 | end // always} | |
1453 | ||
1454 | //---------------------------------------------------------- | |
1455 | `endif | |
1456 | endmodule | |
1457 | ||
1458 | `endif | |
1459 | //---------------------------------------------------------- | |
1460 | //---------------------------------------------------------- |