Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / spc / ifu / rtl / ifu_ftu_tsm_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ifu_ftu_tsm_ctl.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 ============================================
35module ifu_ftu_tsm_ctl (
36 l1clk,
37 scan_in,
38 spc_aclk,
39 spc_bclk,
40 asi_rd_request,
41 asi_wr_request,
42 thrx_is_null,
43 thrx_is_dupmiss,
44 ftp_asi_rd_done,
45 ftp_asi_wr_done,
46 agc_redirect_bf,
47 agc_lsu_no_ic_miss,
48 agc_tlu_redirect_bf,
49 inv_req_c,
50 err_detect_c,
51 cmu_inv_req_ack,
52 ftu_agc_cmiss_c,
53 data_ready,
54 cmu_any_data_ready,
55 itb_miss_c,
56 ftp_room_is_less_t_3,
57 tlu_flush_thrx_ifu,
58 thrx_go_to_sf_wait,
59 itc_demap_next,
60 reset_dmiss_bf,
61 ftp_reset_fill_wait,
62 tsm_fill_rdy0,
63 next_thrx_is_ready,
64 tsm_no_new_miss,
65 tsm_ignore_by_pass,
66 tsm_thrx_ifu_quiesce,
67 scan_out) ;
68wire siclk;
69wire soclk;
70wire next_reset_wait;
71wire reset_wait_state;
72wire next_reset_wait_;
73wire reset_wait_reg_scanin;
74wire reset_wait_reg_scanout;
75wire reset_wait_state_;
76wire go_to_rmiss_null;
77wire rmiss_wait_state;
78wire dmiss_wait_state;
79wire no_new_miss_state;
80wire can_miss_wait_state;
81wire reset_dmiss_f;
82wire inv_req_ack_ff;
83wire rmiss_null_state;
84wire tsm_ifill_done_bf;
85wire leave_rmiss_null;
86wire next_rmill_null_;
87wire rmiss_null_reg_l_scanin;
88wire rmiss_null_reg_l_scanout;
89wire rmiss_null_state_;
90wire go_to_rmiss_wait;
91wire leave_rmiss_wait;
92wire next_rmiss_wait;
93wire rmiss_wait_reg_scanin;
94wire rmiss_wait_reg_scanout;
95wire go_to_no_new_miss;
96wire leave_no_new_miss;
97wire next_no_new_miss;
98wire no_new_miss_reg_scanin;
99wire no_new_miss_reg_scanout;
100wire tsm_lsu_no_ic_miss_state;
101wire go_to_lsu_ic_miss;
102wire lsu_no_ic_miss_reg_scanin;
103wire lsu_no_ic_miss_reg_scanout;
104wire go_to_lsu_wait;
105wire tsm_lsu_wait_state;
106wire leave_lsu_wait;
107wire next_lsu_wait;
108wire lsu_stops_fetch_reg_scanin;
109wire lsu_stops_fetch_reg_scanout;
110wire go_to_inv_wait;
111wire tsm_inv_wait_state;
112wire leave_inv_wait;
113wire next_inv_wait;
114wire inv_stops_fetch_reg_scanin;
115wire inv_stops_fetch_reg_scanout;
116wire go_to_can_miss_refill;
117wire can_miss_refill_state;
118wire leave_can_miss_refill;
119wire next_can_miss_refill;
120wire can_miss_refill_reg_scanin;
121wire can_miss_refill_reg_scanout;
122wire go_to_can_miss_wait;
123wire leave_can_miss_wait;
124wire next_can_miss_wait;
125wire can_miss_wait_reg_scanin;
126wire can_miss_wait_reg_scanout;
127wire go_to_fill_rdy0;
128wire leave_fill_rdy0;
129wire fill_rdy0_state;
130wire next_fill_rdy0;
131wire fill_rdy0_reg_scanin;
132wire fill_rdy0_reg_scanout;
133wire go_to_asi_rd_wait;
134wire tsm_asi_rd_wait_state;
135wire leave_asi_rd_wait;
136wire next_asi_rd_wait;
137wire asi_rd_stops_fetch_reg_scanin;
138wire asi_rd_stops_fetch_reg_scanout;
139wire go_to_asi_wr_wait;
140wire tsm_asi_wr_wait_state;
141wire leave_asi_wr_wait;
142wire next_asi_wr_wait;
143wire asi_wr_stops_fetch_reg_scanin;
144wire asi_wr_stops_fetch_reg_scanout;
145wire go_to_dmiss_wait;
146wire leave_dmiss_wait;
147wire next_dmiss_wait;
148wire dmiss_wait_reg_scanin;
149wire dmiss_wait_reg_scanout;
150wire reset_dmiss_reg_scanin;
151wire reset_dmiss_reg_scanout;
152wire go_to_fill_wait;
153wire fill_wait_state;
154wire leave_fill_wait;
155wire next_fill_wait;
156wire fill_wait_reg_scanin;
157wire fill_wait_reg_scanout;
158wire go_to_itlb_miss_wait;
159wire itlb_miss_wait_state;
160wire leave_itlb_miss_wait;
161wire next_itlb_miss_wait;
162wire itlb_miss_wait_reg_scanin;
163wire itlb_miss_wait_reg_scanout;
164wire go_to_err_wait;
165wire err_wait_state;
166wire leave_err_wait;
167wire next_err_wait;
168wire err_wait_reg_scanin;
169wire err_wait_reg_scanout;
170wire go_to_no_room_wait;
171wire no_room_wait_state;
172wire leave_no_room_wait;
173wire next_no_room_wait;
174wire no_room_wait_reg_scanin;
175wire no_room_wait_reg_scanout;
176wire go_to_itlb_demap;
177wire leave_itlb_demap;
178wire itlb_demap_state;
179wire next_itlb_demap;
180wire itlb_demap_reg_scanin;
181wire itlb_demap_reg_scanout;
182wire go_to_itlb_write;
183wire leave_itlb_write;
184wire itlb_write_state;
185wire next_itlb_write;
186wire itlb_write_reg_scanin;
187wire itlb_write_reg_scanout;
188wire flush_ifu_reg_scanin;
189wire flush_ifu_reg_scanout;
190wire tlu_flush_thrx_ifu_d;
191wire go_to_tlu_redr;
192wire tsm_tlu_redr_wait_state;
193wire leave_tlu_redr;
194wire next_tlu_redr_wait;
195wire tlu_red_reg_scanin;
196wire tlu_red_reg_scanout;
197wire next_sf_wait;
198wire sf_wait_state;
199wire tlu_sf_reg_scanin;
200wire tlu_sf_reg_scanout;
201wire next_ignore_by_pass;
202wire ignore_by_pass_reg_scanin;
203wire ignore_by_pass_reg_scanout;
204wire next_ifu_quiesce;
205wire no_icmiss_pending_reg_scanin;
206wire no_icmiss_pending_reg_scanout;
207wire ifill_done_reg_scanin;
208wire ifill_done_reg_scanout;
209wire spares_scanin;
210wire spares_scanout;
211
212
213input l1clk;
214input scan_in;
215input spc_aclk;
216input spc_bclk;
217
218input asi_rd_request;
219input asi_wr_request;
220input thrx_is_null;
221input thrx_is_dupmiss;
222input ftp_asi_rd_done;
223input ftp_asi_wr_done;
224input agc_redirect_bf;
225input agc_lsu_no_ic_miss;
226input agc_tlu_redirect_bf;
227input inv_req_c;
228input err_detect_c;
229input cmu_inv_req_ack;
230input ftu_agc_cmiss_c;
231input data_ready;
232input cmu_any_data_ready;
233input itb_miss_c;
234input ftp_room_is_less_t_3;
235input tlu_flush_thrx_ifu ;
236input thrx_go_to_sf_wait ;
237input itc_demap_next;
238input reset_dmiss_bf;
239input ftp_reset_fill_wait;
240// output tsm_ready_hp_bf;
241output tsm_fill_rdy0;
242output next_thrx_is_ready ;
243// output tsm_fill_rdy1;
244output tsm_no_new_miss;
245output tsm_ignore_by_pass;
246output tsm_thrx_ifu_quiesce;
247output scan_out;
248
249// scan renames
250assign siclk = spc_aclk;
251assign soclk = spc_bclk;
252// end scan
253
254////////////////////////////////////////////////////////
255////////////////////////////////////////////////////////
256
257
258
259
260////////////////////////////////////////////////////////
261////////////////////////////////////////////////////////
262////////////////////////////////////////////////////////
263// First state machine controls the thread if it //
264// initiated the cache miss. //
265////////////////////////////////////////////////////////
266// First wait state is to wait the initial trap //
267// redirection from the trap unit. //
268////////////////////////////////////////////////////////
269assign next_reset_wait = reset_wait_state & ~agc_redirect_bf ;
270assign next_reset_wait_ = ~next_reset_wait ;
271ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 reset_wait_reg (
272 .scan_in(reset_wait_reg_scanin),
273 .scan_out(reset_wait_reg_scanout),
274 .l1clk( l1clk ),
275 .din (next_reset_wait_),
276 .dout (reset_wait_state_),
277 .siclk(siclk),
278 .soclk(soclk));
279
280assign reset_wait_state = ~reset_wait_state_ ;
281////////////////////////////////////////////////////////
282// Real_Miss_Null state //
283// Note: Null state comes up as ONE after reset //
284// There is a case that we get reset_dmiss_bf the //
285// cycle that we trying to go dmiss_state.In that case//
286// we should come to NULL state. //
287////////////////////////////////////////////////////////
288assign go_to_rmiss_null = ( rmiss_wait_state & thrx_is_null ) |
289 // ( rmiss_wait_state & agc_tg_or_v_err_p) |
290 ( dmiss_wait_state & (thrx_is_null | agc_redirect_bf)) |
291 ( thrx_is_dupmiss & agc_redirect_bf) |
292 ( no_new_miss_state & thrx_is_null) |
293 ( can_miss_wait_state & thrx_is_null) |
294 reset_dmiss_f |
295 inv_req_ack_ff |
296 rmiss_null_state |
297 tsm_ifill_done_bf ;
298assign leave_rmiss_null = ((ftu_agc_cmiss_c | inv_req_c) & ~tsm_ifill_done_bf & ~tsm_no_new_miss) ;
299assign next_rmill_null_ = ~(go_to_rmiss_null & ~leave_rmiss_null) ;
300
301ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 rmiss_null_reg_l (
302 .scan_in(rmiss_null_reg_l_scanin),
303 .scan_out(rmiss_null_reg_l_scanout),
304 .l1clk( l1clk ),
305 .din (next_rmill_null_),
306 .dout (rmiss_null_state_),
307 .siclk(siclk),
308 .soclk(soclk));
309
310assign rmiss_null_state = ~rmiss_null_state_ ;
311////////////////////////////////////////////////////////
312// Real_Miss_Wait state: rmiss_wait_state //
313////////////////////////////////////////////////////////
314assign go_to_rmiss_wait = (ftu_agc_cmiss_c & rmiss_null_state & ~tsm_no_new_miss) |
315 rmiss_wait_state;
316// assign leave_rmiss_wait = (agc_redirect_bf | data_ready | (rmiss_wait_state & thrx_is_null) | thrx_is_dupmiss | agc_tg_or_v_err_p );
317assign leave_rmiss_wait = (agc_redirect_bf | data_ready | (rmiss_wait_state & thrx_is_null) | thrx_is_dupmiss ) ; // | agc_tg_or_v_err_p );
318assign next_rmiss_wait = go_to_rmiss_wait & ~leave_rmiss_wait ;
319
320ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 rmiss_wait_reg (
321 .scan_in(rmiss_wait_reg_scanin),
322 .scan_out(rmiss_wait_reg_scanout),
323 .l1clk( l1clk ),
324 .din (next_rmiss_wait),
325 .dout (rmiss_wait_state),
326 .siclk(siclk),
327 .soclk(soclk));
328
329////////////////////////////////////////////////////////
330// No_New_Miss state: no_new_miss_state //
331// NOTE: we do not want to leave no_new_miss_state //
332// even when we go to can_miss_wait_state because it //
333// possible to get flush before the data comes for //
334// the original miss. In that case we simply reset //
335// can_miss_wait_state and we are ready to fetch again//
336////////////////////////////////////////////////////////
337assign go_to_no_new_miss = (rmiss_wait_state & agc_redirect_bf & ~thrx_is_null & ~thrx_is_dupmiss) |
338 no_new_miss_state;
339assign leave_no_new_miss = tsm_ifill_done_bf | thrx_is_null ;
340assign next_no_new_miss = go_to_no_new_miss & ~leave_no_new_miss ;
341
342ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 no_new_miss_reg (
343 .scan_in(no_new_miss_reg_scanin),
344 .scan_out(no_new_miss_reg_scanout),
345 .l1clk( l1clk ),
346 .din (next_no_new_miss),
347 .dout (no_new_miss_state),
348 .siclk(siclk),
349 .soclk(soclk));
350
351assign tsm_no_new_miss = no_new_miss_state | tsm_lsu_no_ic_miss_state ;
352
353
354//////////////////////////////////////////////////////////
355// LSU no new_miss state. LSU needs to delay new misses //
356//////////////////////////////////////////////////////////
357assign go_to_lsu_ic_miss = agc_lsu_no_ic_miss ;
358
359ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 lsu_no_ic_miss_reg (
360 .scan_in(lsu_no_ic_miss_reg_scanin),
361 .scan_out(lsu_no_ic_miss_reg_scanout),
362 .l1clk( l1clk ),
363 .din (go_to_lsu_ic_miss),
364 .dout (tsm_lsu_no_ic_miss_state),
365 .siclk(siclk),
366 .soclk(soclk));
367
368
369/////////////////////////////////////////////////////////
370// Stop fetch if lsu can not handle new miss and we //
371// detect new miss. //
372/////////////////////////////////////////////////////////
373assign go_to_lsu_wait = (tsm_lsu_no_ic_miss_state & ftu_agc_cmiss_c) |
374 tsm_lsu_wait_state ;
375assign leave_lsu_wait = ~agc_lsu_no_ic_miss ; // | agc_tg_or_v_err_p;
376assign next_lsu_wait = go_to_lsu_wait & ~leave_lsu_wait ;
377
378ifu_ftu_tsm_ctl_msff_ctl_macro__width_2 lsu_stops_fetch_reg (
379 .scan_in(lsu_stops_fetch_reg_scanin),
380 .scan_out(lsu_stops_fetch_reg_scanout),
381 .l1clk( l1clk ),
382 .din ({next_lsu_wait, cmu_inv_req_ack}),
383 .dout ({tsm_lsu_wait_state,inv_req_ack_ff}),
384 .siclk(siclk),
385 .soclk(soclk));
386
387/////////////////////////////////////////////////////////
388// Stop fetch if parity eeror is dtetcted and INV is //
389// requested from L2. Wait for inv ack. //
390/////////////////////////////////////////////////////////
391assign go_to_inv_wait = (inv_req_c & rmiss_null_state & ~tsm_no_new_miss) |
392 tsm_inv_wait_state ;
393assign leave_inv_wait = inv_req_ack_ff ;
394assign next_inv_wait = go_to_inv_wait & ~leave_inv_wait ;
395
396ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 inv_stops_fetch_reg (
397 .scan_in(inv_stops_fetch_reg_scanin),
398 .scan_out(inv_stops_fetch_reg_scanout),
399 .l1clk( l1clk ),
400 .din (next_inv_wait),
401 .dout (tsm_inv_wait_state),
402 .siclk(siclk),
403 .soclk(soclk));
404
405// Canceled_Miss_refill: can_miss_refill_state //
406////////////////////////////////////////////////////////
407assign go_to_can_miss_refill = (no_new_miss_state & ftu_agc_cmiss_c & ~thrx_is_null) |
408 can_miss_refill_state ;
409assign leave_can_miss_refill = tsm_ifill_done_bf | thrx_is_null ; // | agc_tg_or_v_err_p;
410assign next_can_miss_refill = go_to_can_miss_refill & ~leave_can_miss_refill ;
411
412ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 can_miss_refill_reg (
413 .scan_in(can_miss_refill_reg_scanin),
414 .scan_out(can_miss_refill_reg_scanout),
415 .l1clk( l1clk ),
416 .din (next_can_miss_refill),
417 .dout (can_miss_refill_state),
418 .siclk(siclk),
419 .soclk(soclk));
420
421////////////////////////////////////////////////////////
422// Canceled_Miss_Wait: can_miss_wait_state //
423////////////////////////////////////////////////////////
424assign go_to_can_miss_wait = (no_new_miss_state & ftu_agc_cmiss_c & ~thrx_is_null) |
425 can_miss_wait_state ;
426assign leave_can_miss_wait = tsm_ifill_done_bf | agc_redirect_bf | thrx_is_null ; // | agc_tg_or_v_err_p;
427assign next_can_miss_wait = go_to_can_miss_wait & ~leave_can_miss_wait ;
428
429ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 can_miss_wait_reg (
430 .scan_in(can_miss_wait_reg_scanin),
431 .scan_out(can_miss_wait_reg_scanout),
432 .l1clk( l1clk ),
433 .din (next_can_miss_wait),
434 .dout (can_miss_wait_state),
435 .siclk(siclk),
436 .soclk(soclk));
437
438////////////////////////////////////////////////////////
439// Fill_rdy0 state : //
440////////////////////////////////////////////////////////
441assign go_to_fill_rdy0 = (data_ready & (rmiss_wait_state |
442 no_new_miss_state | can_miss_refill_state));
443assign leave_fill_rdy0 = fill_rdy0_state ;
444assign next_fill_rdy0 = go_to_fill_rdy0 & ~leave_fill_rdy0 ;
445
446ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 fill_rdy0_reg (
447 .scan_in(fill_rdy0_reg_scanin),
448 .scan_out(fill_rdy0_reg_scanout),
449 .l1clk( l1clk ),
450 .din (next_fill_rdy0),
451 .dout (fill_rdy0_state),
452 .siclk(siclk),
453 .soclk(soclk));
454
455////////////////////////////////////////////////////////
456// Fill_rdy1 state : //
457////////////////////////////////////////////////////////
458// assign go_to_fill_rdy1 = fill_rdy0_state ;
459// assign leave_fill_rdy1 = fill_rdy1_state ;
460// assign next_fill_rdy1 = go_to_fill_rdy1 & ~leave_fill_rdy1 ;
461
462// msff_ctl_macro fill_rdy1_reg (width=1) (
463// .scan_in(fill_rdy1_reg_scanin),
464// .scan_out(fill_rdy1_reg_scanout),
465// .l1clk( l1clk ),
466// .din (next_fill_rdy1),
467// .dout (fill_rdy1_state));
468
469/////////////////////////////////////////////////////////
470// asi read wait //
471// when asi_request comes stop all threads to gain //
472// access to the arrays. The only thing that may delay//
473// the access is writes to the Icache caused by fill //
474/////////////////////////////////////////////////////////
475assign go_to_asi_rd_wait = (asi_rd_request ) |
476 tsm_asi_rd_wait_state ;
477assign leave_asi_rd_wait = ftp_asi_rd_done ;
478assign next_asi_rd_wait = go_to_asi_rd_wait & ~leave_asi_rd_wait ;
479
480ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 asi_rd_stops_fetch_reg (
481 .scan_in(asi_rd_stops_fetch_reg_scanin),
482 .scan_out(asi_rd_stops_fetch_reg_scanout),
483 .l1clk( l1clk ),
484 .din (next_asi_rd_wait),
485 .dout (tsm_asi_rd_wait_state),
486 .siclk(siclk),
487 .soclk(soclk));
488
489/////////////////////////////////////////////////////////
490// asi write wait //
491// when asi_request comes stop all threads to gain //
492// access to the arrays. The only thing that may delay//
493// the access is writes to the Icache caused by fill //
494/////////////////////////////////////////////////////////
495assign go_to_asi_wr_wait = (asi_wr_request ) |
496 tsm_asi_wr_wait_state ;
497assign leave_asi_wr_wait = ftp_asi_wr_done ;
498assign next_asi_wr_wait = go_to_asi_wr_wait & ~leave_asi_wr_wait ;
499
500ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 asi_wr_stops_fetch_reg (
501 .scan_in(asi_wr_stops_fetch_reg_scanin),
502 .scan_out(asi_wr_stops_fetch_reg_scanout),
503 .l1clk( l1clk ),
504 .din (next_asi_wr_wait),
505 .dout (tsm_asi_wr_wait_state),
506 .siclk(siclk),
507 .soclk(soclk));
508
509////////////////////////////////////////////////////////
510////////////////////////////////////////////////////////
511////////////////////////////////////////////////////////
512////////////////////////////////////////////////////////
513////////////////////////////////////////////////////////
514// second state machine is activated if the thread is //
515// waiting on a duplicate miss. //
516////////////////////////////////////////////////////////
517////////////////////////////////////////////////////////
518////////////////////////////////////////////////////////
519// Duplicate_Miss_Wait state: dmiss_wait_state //
520////////////////////////////////////////////////////////
521assign go_to_dmiss_wait = (rmiss_wait_state & thrx_is_dupmiss ) |
522 dmiss_wait_state;
523assign leave_dmiss_wait = (agc_redirect_bf | reset_dmiss_f | thrx_is_null);
524assign next_dmiss_wait = go_to_dmiss_wait & ~leave_dmiss_wait ;
525
526ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 dmiss_wait_reg (
527 .scan_in(dmiss_wait_reg_scanin),
528 .scan_out(dmiss_wait_reg_scanout),
529 .l1clk( l1clk ),
530 .din (next_dmiss_wait),
531 .dout (dmiss_wait_state),
532 .siclk(siclk),
533 .soclk(soclk));
534
535ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 reset_dmiss_reg (
536 .scan_in(reset_dmiss_reg_scanin),
537 .scan_out(reset_dmiss_reg_scanout),
538 .l1clk( l1clk ),
539 .din (reset_dmiss_bf),
540 .dout (reset_dmiss_f),
541 .siclk(siclk),
542 .soclk(soclk));
543
544////////////////////////////////////////////////////////
545////////////////////////////////////////////////////////
546////////////////////////////////////////////////////////
547////////////////////////////////////////////////////////
548////////////////////////////////////////////////////////
549// Third state machine is activated if the thread is //
550// waiting on a cache line being filled by an other //
551// thread. //
552////////////////////////////////////////////////////////
553////////////////////////////////////////////////////////
554////////////////////////////////////////////////////////
555// Fill_Wait state: fill_wait_state //
556////////////////////////////////////////////////////////
557assign go_to_fill_wait = cmu_any_data_ready | fill_wait_state;
558assign leave_fill_wait = ftp_reset_fill_wait & ~cmu_any_data_ready;
559assign next_fill_wait = go_to_fill_wait & ~leave_fill_wait ;
560
561ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 fill_wait_reg (
562 .scan_in(fill_wait_reg_scanin),
563 .scan_out(fill_wait_reg_scanout),
564 .l1clk( l1clk ),
565 .din (next_fill_wait),
566 .dout (fill_wait_state),
567 .siclk(siclk),
568 .soclk(soclk));
569
570////////////////////////////////////////////////////////
571////////////////////////////////////////////////////////
572////////////////////////////////////////////////////////
573////////////////////////////////////////////////////////
574////////////////////////////////////////////////////////
575// Fourth state machine is activated if the thread is //
576// waiting on a ITLB miss. //
577////////////////////////////////////////////////////////
578////////////////////////////////////////////////////////
579////////////////////////////////////////////////////////
580// Fill_Wait state: itlb_miss_wait_state //
581////////////////////////////////////////////////////////
582assign go_to_itlb_miss_wait = itb_miss_c | itlb_miss_wait_state;
583assign leave_itlb_miss_wait = agc_redirect_bf ;
584assign next_itlb_miss_wait = go_to_itlb_miss_wait & ~leave_itlb_miss_wait ;
585
586ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 itlb_miss_wait_reg (
587 .scan_in(itlb_miss_wait_reg_scanin),
588 .scan_out(itlb_miss_wait_reg_scanout),
589 .l1clk( l1clk ),
590 .din (next_itlb_miss_wait),
591 .dout (itlb_miss_wait_state),
592 .siclk(siclk),
593 .soclk(soclk));
594
595////////////////////////////////////////////////////////
596////////////////////////////////////////////////////////
597// err_wait state: err_wait_state //
598////////////////////////////////////////////////////////
599assign go_to_err_wait = err_detect_c | err_wait_state;
600assign leave_err_wait = agc_redirect_bf ;
601assign next_err_wait = go_to_err_wait & ~leave_err_wait ;
602
603ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 err_wait_reg (
604 .scan_in(err_wait_reg_scanin),
605 .scan_out(err_wait_reg_scanout),
606 .l1clk( l1clk ),
607 .din (next_err_wait),
608 .dout (err_wait_state),
609 .siclk(siclk),
610 .soclk(soclk));
611
612////////////////////////////////////////////////////////
613////////////////////////////////////////////////////////
614////////////////////////////////////////////////////////
615////////////////////////////////////////////////////////
616////////////////////////////////////////////////////////
617// Fifth state machine is activated if the thread //
618// does not have room for 3 more instructions. //
619////////////////////////////////////////////////////////
620////////////////////////////////////////////////////////
621////////////////////////////////////////////////////////
622////////////////////////////////////////////////////////
623// Fill_Wait state: no_room_wait_state //
624////////////////////////////////////////////////////////
625assign go_to_no_room_wait = ftp_room_is_less_t_3 | no_room_wait_state;
626assign leave_no_room_wait = ~ftp_room_is_less_t_3 ;
627assign next_no_room_wait = go_to_no_room_wait & ~leave_no_room_wait ;
628
629ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 no_room_wait_reg (
630 .scan_in(no_room_wait_reg_scanin),
631 .scan_out(no_room_wait_reg_scanout),
632 .l1clk( l1clk ),
633 .din (next_no_room_wait),
634 .dout (no_room_wait_state),
635 .siclk(siclk),
636 .soclk(soclk));
637
638////////////////////////////////////////////////////////
639////////////////////////////////////////////////////////
640////////////////////////////////////////////////////////
641////////////////////////////////////////////////////////
642////////////////////////////////////////////////////////
643// sixth state machine is activated whenever a ITLB //
644// write is requested by TLU. //
645////////////////////////////////////////////////////////
646////////////////////////////////////////////////////////
647////////////////////////////////////////////////////////
648////////////////////////////////////////////////////////
649// Itlb_Demap state: itlb_demap_state //
650////////////////////////////////////////////////////////
651assign go_to_itlb_demap = itc_demap_next ;
652assign leave_itlb_demap = itlb_demap_state ;
653assign next_itlb_demap = go_to_itlb_demap & ~leave_itlb_demap ;
654
655ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 itlb_demap_reg (
656 .scan_in(itlb_demap_reg_scanin),
657 .scan_out(itlb_demap_reg_scanout),
658 .l1clk( l1clk ),
659 .din (next_itlb_demap),
660 .dout (itlb_demap_state),
661 .siclk(siclk),
662 .soclk(soclk));
663
664////////////////////////////////////////////////////////
665// Itlb_write state: itlb_write_state //
666////////////////////////////////////////////////////////
667assign go_to_itlb_write = itlb_demap_state ;
668assign leave_itlb_write = itlb_write_state ;
669assign next_itlb_write = go_to_itlb_write & ~leave_itlb_write ;
670
671ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 itlb_write_reg (
672 .scan_in(itlb_write_reg_scanin),
673 .scan_out(itlb_write_reg_scanout),
674 .l1clk( l1clk ),
675 .din (next_itlb_write),
676 .dout (itlb_write_state),
677 .siclk(siclk),
678 .soclk(soclk));
679
680// assign itlb_miss_write_done = itlb_write_state ;
681//////////////////////////////////////////////////////////
682// TLU flush causes the thread to wait until TLU redirection
683/////////////////////////////////////////////////////////
684ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 flush_ifu_reg (
685 .scan_in(flush_ifu_reg_scanin),
686 .scan_out(flush_ifu_reg_scanout),
687 .l1clk( l1clk ),
688 .din (tlu_flush_thrx_ifu),
689 .dout (tlu_flush_thrx_ifu_d),
690 .siclk(siclk),
691 .soclk(soclk));
692
693assign go_to_tlu_redr = tlu_flush_thrx_ifu_d | tsm_tlu_redr_wait_state ;
694assign leave_tlu_redr = agc_tlu_redirect_bf ;
695assign next_tlu_redr_wait = go_to_tlu_redr & ~leave_tlu_redr ;
696
697ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 tlu_red_reg (
698 .scan_in(tlu_red_reg_scanin),
699 .scan_out(tlu_red_reg_scanout),
700 .l1clk( l1clk ),
701 .din (next_tlu_redr_wait),
702 .dout (tsm_tlu_redr_wait_state),
703 .siclk(siclk),
704 .soclk(soclk));
705
706assign next_sf_wait = (thrx_go_to_sf_wait | sf_wait_state) & ~agc_tlu_redirect_bf & ~ftu_agc_cmiss_c ;
707ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 tlu_sf_reg (
708 .scan_in(tlu_sf_reg_scanin),
709 .scan_out(tlu_sf_reg_scanout),
710 .l1clk( l1clk ),
711 .din (next_sf_wait),
712 .dout (sf_wait_state),
713 .siclk(siclk),
714 .soclk(soclk));
715
716////////////////////////////////////////////////////////
717// Now generate a cumulative Ready for this thread //
718////////////////////////////////////////////////////////
719assign next_thrx_is_ready = ( ~next_rmiss_wait & ~next_can_miss_wait & ~next_itlb_write & ~next_itlb_miss_wait & ~next_err_wait &
720 ~next_dmiss_wait & ~next_fill_wait & ~next_reset_wait & ~next_itlb_demap & ~next_lsu_wait & ~next_sf_wait &
721 ~next_inv_wait & ~next_asi_rd_wait & ~next_asi_wr_wait & ~next_itlb_demap & ~next_tlu_redr_wait) ;
722 // | next_fill_rdy0 | next_fill_rdy1 ;
723
724// msff_ctl_macro thrx_is_ready_reg (width=1) (
725// .scan_in(thrx_is_ready_reg_scanin),
726// .scan_out(thrx_is_ready_reg_scanout),
727// .l1clk( l1clk ),
728// .din (next_thrx_is_ready),
729// .dout (thrx_is_ready));
730
731
732 // assign next_ignore_by_pass = (~next_dmiss_wait & ~next_rmiss_wait) | next_can_miss_refill | next_no_new_miss ;
733 assign next_ignore_by_pass = (~next_dmiss_wait & ~rmiss_wait_state) | can_miss_refill_state | next_no_new_miss ;
734
735ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 ignore_by_pass_reg (
736 .scan_in(ignore_by_pass_reg_scanin),
737 .scan_out(ignore_by_pass_reg_scanout),
738 .l1clk( l1clk ),
739 .din (next_ignore_by_pass),
740 .dout (tsm_ignore_by_pass),
741 .siclk(siclk),
742 .soclk(soclk));
743
744
745// assign tsm_ready_hp_bf = thrx_is_ready ; // & ftp_buffer_is_empty;
746
747assign next_ifu_quiesce = (~rmiss_wait_state & ~dmiss_wait_state &
748 ~can_miss_wait_state & ~no_new_miss_state) & (tsm_tlu_redr_wait_state |
749 (next_sf_wait & sf_wait_state)) ;
750
751ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 no_icmiss_pending_reg (
752 .scan_in(no_icmiss_pending_reg_scanin),
753 .scan_out(no_icmiss_pending_reg_scanout),
754 .l1clk( l1clk ),
755 .din (next_ifu_quiesce),
756 .dout (tsm_thrx_ifu_quiesce),
757 .siclk(siclk),
758 .soclk(soclk));
759
760/////////////////////////////////////////////////////////////////////////////////
761// assign tsm_ifill_done_bf = leave_fill_rdy0 ;
762// Delay fill done for one cycle so that any fetches still in progress which
763// match the current fill will have a chance to be flagged as duplicate in
764// the CMU. Otherwise we have to compare the current fetch in C (about to
765// miss) to what is being written and if they match kill the miss.
766/////////////////////////////////////////////////////////////////////////////////
767ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 ifill_done_reg (
768 .scan_in(ifill_done_reg_scanin),
769 .scan_out(ifill_done_reg_scanout),
770 .l1clk( l1clk ),
771 .din (leave_fill_rdy0),
772 .dout (tsm_ifill_done_bf),
773 .siclk(siclk),
774 .soclk(soclk));
775
776assign tsm_fill_rdy0 = fill_rdy0_state ;
777
778///////////////////////////////////////////////////////////////////////
779// Spare circuits //
780///////////////////////////////////////////////////////////////////////
781ifu_ftu_tsm_ctl_spare_ctl_macro__num_1 spares (
782 .scan_in(spares_scanin),
783 .scan_out(spares_scanout),
784 .l1clk (l1clk),
785 .siclk(siclk),
786 .soclk(soclk)
787);
788
789
790
791
792// assign tsm_fill_rdy1 = fill_rdy1_state ;
793supply0 vss;
794supply1 vdd;
795// fixscan start:
796assign reset_wait_reg_scanin = scan_in ;
797assign rmiss_null_reg_l_scanin = reset_wait_reg_scanout ;
798assign rmiss_wait_reg_scanin = rmiss_null_reg_l_scanout ;
799assign no_new_miss_reg_scanin = rmiss_wait_reg_scanout ;
800assign lsu_no_ic_miss_reg_scanin = no_new_miss_reg_scanout ;
801assign lsu_stops_fetch_reg_scanin = lsu_no_ic_miss_reg_scanout;
802assign inv_stops_fetch_reg_scanin = lsu_stops_fetch_reg_scanout;
803assign can_miss_refill_reg_scanin = inv_stops_fetch_reg_scanout;
804assign can_miss_wait_reg_scanin = can_miss_refill_reg_scanout;
805assign fill_rdy0_reg_scanin = can_miss_wait_reg_scanout;
806assign asi_rd_stops_fetch_reg_scanin = fill_rdy0_reg_scanout ;
807assign asi_wr_stops_fetch_reg_scanin = asi_rd_stops_fetch_reg_scanout;
808assign dmiss_wait_reg_scanin = asi_wr_stops_fetch_reg_scanout;
809assign reset_dmiss_reg_scanin = dmiss_wait_reg_scanout ;
810assign fill_wait_reg_scanin = reset_dmiss_reg_scanout ;
811assign itlb_miss_wait_reg_scanin = fill_wait_reg_scanout ;
812assign err_wait_reg_scanin = itlb_miss_wait_reg_scanout;
813assign no_room_wait_reg_scanin = err_wait_reg_scanout ;
814assign itlb_demap_reg_scanin = no_room_wait_reg_scanout ;
815assign itlb_write_reg_scanin = itlb_demap_reg_scanout ;
816assign flush_ifu_reg_scanin = itlb_write_reg_scanout ;
817assign tlu_red_reg_scanin = flush_ifu_reg_scanout ;
818assign tlu_sf_reg_scanin = tlu_red_reg_scanout ;
819assign ignore_by_pass_reg_scanin = tlu_sf_reg_scanout ;
820assign no_icmiss_pending_reg_scanin = ignore_by_pass_reg_scanout;
821assign ifill_done_reg_scanin = no_icmiss_pending_reg_scanout;
822assign spares_scanin = ifill_done_reg_scanout ;
823assign scan_out = spares_scanout ;
824// fixscan end:
825endmodule
826
827
828
829
830
831
832// any PARAMS parms go into naming of macro
833
834module ifu_ftu_tsm_ctl_msff_ctl_macro__width_1 (
835 din,
836 l1clk,
837 scan_in,
838 siclk,
839 soclk,
840 dout,
841 scan_out);
842wire [0:0] fdin;
843
844 input [0:0] din;
845 input l1clk;
846 input scan_in;
847
848
849 input siclk;
850 input soclk;
851
852 output [0:0] dout;
853 output scan_out;
854assign fdin[0:0] = din[0:0];
855
856
857
858
859
860
861dff #(1) d0_0 (
862.l1clk(l1clk),
863.siclk(siclk),
864.soclk(soclk),
865.d(fdin[0:0]),
866.si(scan_in),
867.so(scan_out),
868.q(dout[0:0])
869);
870
871
872
873
874
875
876
877
878
879
880
881
882endmodule
883
884
885
886
887
888
889
890
891
892
893
894
895
896// any PARAMS parms go into naming of macro
897
898module ifu_ftu_tsm_ctl_msff_ctl_macro__width_2 (
899 din,
900 l1clk,
901 scan_in,
902 siclk,
903 soclk,
904 dout,
905 scan_out);
906wire [1:0] fdin;
907wire [0:0] so;
908
909 input [1:0] din;
910 input l1clk;
911 input scan_in;
912
913
914 input siclk;
915 input soclk;
916
917 output [1:0] dout;
918 output scan_out;
919assign fdin[1:0] = din[1:0];
920
921
922
923
924
925
926dff #(2) d0_0 (
927.l1clk(l1clk),
928.siclk(siclk),
929.soclk(soclk),
930.d(fdin[1:0]),
931.si({scan_in,so[0:0]}),
932.so({so[0:0],scan_out}),
933.q(dout[1:0])
934);
935
936
937
938
939
940
941
942
943
944
945
946
947endmodule
948
949
950
951
952
953
954
955
956
957// Description: Spare gate macro for control blocks
958//
959// Param num controls the number of times the macro is added
960// flops=0 can be used to use only combination spare logic
961
962
963module ifu_ftu_tsm_ctl_spare_ctl_macro__num_1 (
964 l1clk,
965 scan_in,
966 siclk,
967 soclk,
968 scan_out);
969wire si_0;
970wire so_0;
971wire spare0_flop_unused;
972wire spare0_buf_32x_unused;
973wire spare0_nand3_8x_unused;
974wire spare0_inv_8x_unused;
975wire spare0_aoi22_4x_unused;
976wire spare0_buf_8x_unused;
977wire spare0_oai22_4x_unused;
978wire spare0_inv_16x_unused;
979wire spare0_nand2_16x_unused;
980wire spare0_nor3_4x_unused;
981wire spare0_nand2_8x_unused;
982wire spare0_buf_16x_unused;
983wire spare0_nor2_16x_unused;
984wire spare0_inv_32x_unused;
985
986
987input l1clk;
988input scan_in;
989input siclk;
990input soclk;
991output scan_out;
992
993cl_sc1_msff_8x spare0_flop (.l1clk(l1clk),
994 .siclk(siclk),
995 .soclk(soclk),
996 .si(si_0),
997 .so(so_0),
998 .d(1'b0),
999 .q(spare0_flop_unused));
1000assign si_0 = scan_in;
1001
1002cl_u1_buf_32x spare0_buf_32x (.in(1'b1),
1003 .out(spare0_buf_32x_unused));
1004cl_u1_nand3_8x spare0_nand3_8x (.in0(1'b1),
1005 .in1(1'b1),
1006 .in2(1'b1),
1007 .out(spare0_nand3_8x_unused));
1008cl_u1_inv_8x spare0_inv_8x (.in(1'b1),
1009 .out(spare0_inv_8x_unused));
1010cl_u1_aoi22_4x spare0_aoi22_4x (.in00(1'b1),
1011 .in01(1'b1),
1012 .in10(1'b1),
1013 .in11(1'b1),
1014 .out(spare0_aoi22_4x_unused));
1015cl_u1_buf_8x spare0_buf_8x (.in(1'b1),
1016 .out(spare0_buf_8x_unused));
1017cl_u1_oai22_4x spare0_oai22_4x (.in00(1'b1),
1018 .in01(1'b1),
1019 .in10(1'b1),
1020 .in11(1'b1),
1021 .out(spare0_oai22_4x_unused));
1022cl_u1_inv_16x spare0_inv_16x (.in(1'b1),
1023 .out(spare0_inv_16x_unused));
1024cl_u1_nand2_16x spare0_nand2_16x (.in0(1'b1),
1025 .in1(1'b1),
1026 .out(spare0_nand2_16x_unused));
1027cl_u1_nor3_4x spare0_nor3_4x (.in0(1'b0),
1028 .in1(1'b0),
1029 .in2(1'b0),
1030 .out(spare0_nor3_4x_unused));
1031cl_u1_nand2_8x spare0_nand2_8x (.in0(1'b1),
1032 .in1(1'b1),
1033 .out(spare0_nand2_8x_unused));
1034cl_u1_buf_16x spare0_buf_16x (.in(1'b1),
1035 .out(spare0_buf_16x_unused));
1036cl_u1_nor2_16x spare0_nor2_16x (.in0(1'b0),
1037 .in1(1'b0),
1038 .out(spare0_nor2_16x_unused));
1039cl_u1_inv_32x spare0_inv_32x (.in(1'b1),
1040 .out(spare0_inv_32x_unused));
1041assign scan_out = so_0;
1042
1043
1044
1045endmodule
1046