Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / spc / ifu / rtl / ifu_cmu_lsi_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ifu_cmu_lsi_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_cmu_lsi_ctl (
36 tcu_scan_en,
37 l2clk,
38 scan_in,
39 tcu_pce_ov,
40 spc_aclk,
41 spc_bclk,
42 const_cpuid,
43 mct_early_req,
44 ftu_cmiss,
45 ftu_rep_way,
46 ftu_thrx_un_cacheable,
47 ifu_l15_addr,
48 csm_valid_req,
49 l15_spc_data1,
50 l15_spc_cpkt,
51 l15_ifu_valid,
52 l15_ifu_grant,
53 lsu_ifu_ld_index,
54 cmu_fill_paddr,
55 mdp_lsi_nc_bit,
56 mdp_lsi_inv_bit,
57 mdp_lsi_rway,
58 lsu_ifu_cmu_pmen,
59 lsc_fill_rtn1,
60 lsc_fill_rtn2,
61 lsc_req_sel,
62 lsc_pending_req,
63 lsc_l15_valid,
64 lsc_data_sel,
65 cmu_any_data_ready,
66 cmu_any_un_cacheable,
67 cmu_data_ready,
68 cmu_inst0_v,
69 cmu_inst1_v,
70 cmu_inst2_v,
71 cmu_inst3_v,
72 cmu_icache_invalidate,
73 cmu_icache_invalidate_way,
74 cmu_icache_invalidate_index,
75 cmu_evic_invalidate,
76 cmu_icache_inv_way1,
77 cmu_inval_ack,
78 cmu_l2_err,
79 cmu_l2miss,
80 ifu_l15_valid,
81 ifu_l15_cpkt,
82 lsc_clken,
83 ifu_lsu_if_vld,
84 ifu_lsu_if_tid,
85 ifu_lsu_if_addr,
86 scan_out) ;
87wire pce_ov;
88wire stop;
89wire siclk;
90wire soclk;
91wire se;
92wire l1clk;
93wire go_to_l15_empty;
94wire l15_one_buff_state;
95wire l15_empty_state;
96wire leave_l15_empty;
97wire next_l15_empty;
98wire next_l15_empty_;
99wire empty_state_reg_scanin;
100wire empty_state_reg_scanout;
101wire l15_empty_state_;
102wire go_to_l15_one_buff;
103wire l15_hold_state;
104wire leave_l15_one_buff;
105wire next_l15_one_buff;
106wire one_buff_state_reg_scanin;
107wire one_buff_state_reg_scanout;
108wire go_to_l15_hold;
109wire leave_l15_hold;
110wire next_l15_hold;
111wire l15_hold_state_reg_scanin;
112wire l15_hold_state_reg_scanout;
113wire gkt_room_avail_in;
114wire [7:0] csm_rqv;
115wire lsc_early_req;
116wire [2:0] req_sel_tid;
117wire [2:0] cmiss_tid;
118wire ifu_l15_valid_in;
119wire [7:0] lsc_l15_valid_in;
120wire [2:0] ifu_l15_tid_in;
121wire [2:0] ifu_l15_rway_in;
122wire ifu_l15_nc_in;
123wire ifu_l15_inv_in;
124wire tg0_selected_in;
125wire tg1_selected_in;
126wire ifu_l15_valid_reg_scanin;
127wire ifu_l15_valid_reg_scanout;
128wire tg0_selected;
129wire tg1_selected;
130wire lsc_l15_valid_reg_scanin;
131wire lsc_l15_valid_reg_scanout;
132wire [7:0] lsc_l15_pre_valid;
133wire lsc_req_sel_reg_scanin;
134wire lsc_req_sel_reg_scanout;
135wire [7:0] lsc_req_sel_lat;
136wire lsc_cpkt_reg_scanin;
137wire lsc_cpkt_reg_scanout;
138wire [2:0] cpuid;
139wire [2:0] ifu_l15_rway;
140wire ifu_l15_nc;
141wire ifu_l15_inv;
142wire [2:0] ifu_l15_tid;
143wire ifu_lsu_lat_scanin;
144wire ifu_lsu_lat_scanout;
145wire favor_tg1_in;
146wire favor_tg1;
147wire favour_bit_reg_scanin;
148wire favour_bit_reg_scanout;
149wire [3:0] thr_ptr0;
150wire [3:0] thr_ptr0_lat;
151wire thr_ptr0_lat_0_;
152wire [7:4] thr_ptr1;
153wire [7:4] thr_ptr1_lat;
154wire thr_ptr1_lat_4_;
155wire thr_ptr0_0_;
156wire thr_ptr1_4_;
157wire ptr0_reg_scanin;
158wire ptr0_reg_scanout;
159wire ptr1_reg_scanin;
160wire ptr1_reg_scanout;
161wire [7:0] req_bit;
162wire tg0_valid;
163wire tg1_valid;
164wire sel_tg1;
165wire reg_pmen_scanin;
166wire reg_pmen_scanout;
167wire ifu_pmen;
168wire [3:0] l15_rtn_type;
169wire fill_return;
170wire cmu_nc_f4b;
171wire second_pkt;
172wire second_pkt_in;
173wire sec_pkt_lat_scanin;
174wire sec_pkt_lat_scanout;
175wire [1:0] cmu_l2_err_pkt1_in;
176wire stg_r1_lat0_scanin;
177wire stg_r1_lat0_scanout;
178wire [1:0] cmu_l2_err_pkt1;
179wire cmu_l2miss_in;
180wire cmu_inst0_v_in;
181wire cmu_inst1_v_in;
182wire cmu_inst2_v_in;
183wire cmu_inst3_v_in;
184wire cmu_inst_reg_scanin;
185wire cmu_inst_reg_scanout;
186wire [31:0] store_inval_vector;
187wire [31:0] evic_inv_vec_0;
188wire [31:0] evic_inv_vec_1;
189wire take_strm_store_ack;
190wire take_store_ack;
191wire take_inval_ack;
192wire take_load_return;
193wire take_evic_inv;
194wire [7:0] cmu_inval_ack_din;
195wire [3:0] inv_vector;
196wire evic_i_inv_0_true;
197wire [2:0] evic_inv_way0;
198wire evic_i_inv_1_true;
199wire [2:0] evic_inv_way1;
200wire str_strm_invalidate;
201wire cross_invalidate;
202wire evic_invalidate_w0;
203wire evic_invalidate_w1;
204wire evic_invalidate_w01;
205wire evic_invalidate_any;
206wire [2:0] evic_way0;
207wire [10:5] evic_index;
208wire cmu_icache_invalidate_din;
209wire [2:0] cmu_icache_invalidate_way_din;
210wire [10:5] cmu_icache_invalidate_index_din;
211wire cmu_evic_invalidate_din;
212wire [2:0] cmu_icache_inv_way1_din;
213wire stg_r1_lat_scanin;
214wire stg_r1_lat_scanout;
215wire [23:0] l15_spc_data_55_32_unused;
216wire [15:0] l15_spc_data_111_96_unused;
217wire [4:0] l15_spc_data_121_117_unused;
218wire [2:0] l15_spc_data_127_125_unused;
219wire [1:0] l15_spc_cpkt_1_0_unused;
220wire l15_spc_cpkt_13_unused;
221wire spares_so_0;
222wire spares_scanout;
223wire spares_scanin;
224wire out;
225wire q;
226
227
228input tcu_scan_en ;
229input l2clk;
230input scan_in;
231input tcu_pce_ov; // scan signals
232input spc_aclk;
233input spc_bclk;
234
235input [2:0] const_cpuid;
236input mct_early_req;
237input [7:0] ftu_cmiss; //from ftu tsm
238input [2:0] ftu_rep_way; // incoming replacement way from ftu
239input ftu_thrx_un_cacheable; // incoming cacheable bit from ftu
240
241
242input [10:5] ifu_l15_addr;
243input [7:0] csm_valid_req;
244
245
246input [127:0] l15_spc_data1;
247input [17:0] l15_spc_cpkt;
248input l15_ifu_valid;
249input l15_ifu_grant; //ACK from gkt when req is accepted
250
251input [10:5] lsu_ifu_ld_index; // on a load retn, lsu sends load index for cross invalidates,
252
253input [4:2] cmu_fill_paddr; //bits {4,3,2} of the fill phys addr
254
255input mdp_lsi_nc_bit; // Cacheable bit from Missbuffer
256input mdp_lsi_inv_bit; // Inv req bit from Missbuffer
257input [2:0] mdp_lsi_rway; // way information from missbuffer
258
259input lsu_ifu_cmu_pmen;
260
261
262output lsc_fill_rtn1; //enable for fill ready data to lsi_dp
263output lsc_fill_rtn2; //enable for fill ready data to lsi_dp
264output [7:0] lsc_req_sel; // selected thread from pending requests
265output lsc_pending_req;
266output [7:0] lsc_l15_valid; //req for thr0 ACKed by LSU, to TSM (indicates req accepted)
267
268output [7:0] lsc_data_sel; // decoded selects for muxing out instructions
269
270
271output cmu_any_data_ready;
272output cmu_any_un_cacheable;
273
274output [7:0] cmu_data_ready; //data ready for thr0
275
276output cmu_inst0_v; // valid for instruction 0
277output cmu_inst1_v; // valid for instruction 1
278output cmu_inst2_v; // valid for instruction 2
279output cmu_inst3_v; // valid for instruction 3
280
281output cmu_icache_invalidate; //invalidate icache request
282output [2:0] cmu_icache_invalidate_way;
283output [10:5] cmu_icache_invalidate_index;
284
285output cmu_evic_invalidate; // eviction invalidation
286output [2:0] cmu_icache_inv_way1;
287
288output [7:0] cmu_inval_ack;
289output [1:0] cmu_l2_err;
290output cmu_l2miss; // l2miss indicator on rtn pkt
291
292output ifu_l15_valid; // ifu_l15_valid, valid pcx pkt
293output [7:0] ifu_l15_cpkt;
294
295output lsc_clken;
296
297// **** LSU Interface ****
298output ifu_lsu_if_vld;
299output [2:0] ifu_lsu_if_tid;
300output [10:5] ifu_lsu_if_addr;
301
302output scan_out;
303
304
305// scan renames
306assign pce_ov = tcu_pce_ov;
307assign stop = 1'b0;
308assign siclk = spc_aclk;
309assign soclk = spc_bclk;
310assign se = tcu_scan_en ;
311// end scan
312
313
314///////////////////////////////////////////////////
315// clock header
316///////////////////////////////////////////////////
317ifu_cmu_lsi_ctl_l1clkhdr_ctl_macro clkgen (
318 .l2clk(l2clk),
319 .l1en (1'b1 ),
320 .l1clk(l1clk),
321 .pce_ov(pce_ov),
322 .stop(stop),
323 .se(se)
324);
325
326/////////////////////////////////////////////////////////
327// Create a state_machine to keep track of L15 buffers //
328/////////////////////////////////////////////////////////
329// Empty state: L15 has both IFU buffers empty. IFU //
330// can send two requests back to back. //
331/////////////////////////////////////////////////////////
332assign go_to_l15_empty = (l15_one_buff_state & l15_ifu_grant & ~ifu_l15_valid) |
333 (l15_empty_state & ~ifu_l15_valid) ;
334assign leave_l15_empty = (l15_empty_state & ifu_l15_valid) ;
335
336assign next_l15_empty = (go_to_l15_empty & ~leave_l15_empty) ;
337assign next_l15_empty_ = ~next_l15_empty ;
338
339ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 empty_state_reg (
340 .scan_in(empty_state_reg_scanin),
341 .scan_out(empty_state_reg_scanout),
342 .l1clk( l1clk ),
343 .din (next_l15_empty_),
344 .dout (l15_empty_state_),
345 .siclk(siclk),
346 .soclk(soclk)
347);
348
349assign l15_empty_state = ~l15_empty_state_ ;
350
351/////////////////////////////////////////////////////////
352// One buffer state: L15 has one buffer empty. We can //
353// send only one more request before we get grants. //
354/////////////////////////////////////////////////////////
355assign go_to_l15_one_buff = (l15_hold_state & l15_ifu_grant & ~ifu_l15_valid) | // Coming back from hold state
356 (l15_empty_state & ifu_l15_valid) | // Coming from empty state
357 (l15_one_buff_state & ~ifu_l15_valid & ~l15_ifu_grant) | // Nothing happened: stay in this state
358 (l15_one_buff_state & ifu_l15_valid & l15_ifu_grant) ; // Request accepted and new one issued
359
360assign leave_l15_one_buff = (l15_one_buff_state & l15_ifu_grant & ~ifu_l15_valid) |
361 (l15_one_buff_state & ~l15_ifu_grant & ifu_l15_valid) ;
362
363assign next_l15_one_buff = go_to_l15_one_buff & ~leave_l15_one_buff ;
364
365ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 one_buff_state_reg (
366 .scan_in(one_buff_state_reg_scanin),
367 .scan_out(one_buff_state_reg_scanout),
368 .l1clk( l1clk ),
369 .din (next_l15_one_buff),
370 .dout (l15_one_buff_state),
371 .siclk(siclk),
372 .soclk(soclk)
373);
374
375/////////////////////////////////////////////////////////
376// Hold state: L15 has no more room for IFU requests. //
377// Do not send any more requests until l15_ifu_grant is//
378// recieved. //
379/////////////////////////////////////////////////////////
380assign go_to_l15_hold = (l15_one_buff_state & ifu_l15_valid & ~l15_ifu_grant) |
381 (l15_hold_state & ifu_l15_valid & l15_ifu_grant) |
382 (l15_hold_state & ~l15_ifu_grant) ;
383
384assign leave_l15_hold = (l15_hold_state & ~ifu_l15_valid & l15_ifu_grant) ;
385
386assign next_l15_hold = go_to_l15_hold & ~leave_l15_hold ;
387ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 l15_hold_state_reg (
388 .scan_in(l15_hold_state_reg_scanin),
389 .scan_out(l15_hold_state_reg_scanout),
390 .l1clk( l1clk ),
391 .din (next_l15_hold),
392 .dout (l15_hold_state),
393 .siclk(siclk),
394 .soclk(soclk)
395);
396
397// ok to send a request to gkt next cycle.
398assign gkt_room_avail_in = next_l15_empty | next_l15_one_buff ;
399
400///////////////////////////////////////////////////
401// Select request sent to gkt.
402// If there are no pending requests, and a new request is coming
403// in this cycle, then the new request can be sent out to
404// gasket next cycle (cycle after C stage).
405// This is called "early_request".
406// Only cmiss can be an early request. Inval req cannot be sent out
407// early.
408// If there are pending requests, then the pending request will
409// have higher priority and it will get sent out.
410// On reset, select_pending_req will be 0.
411///////////////////////////////////////////////////
412
413// Qualify the pending requests with the request sent last cycle.
414// Thread remains in REQ_ST the cycle it is being launched to
415// gkt.
416// We do not want it to take part in arbitration again.
417
418//0in bits_on -var {lsc_l15_valid_in[7:0]} -max 1
419
420assign csm_rqv[7:0] = csm_valid_req[7:0] & ~lsc_l15_valid[7:0] ;
421
422assign lsc_pending_req = |(csm_rqv[7:0]);
423assign lsc_early_req = mct_early_req;
424
425assign req_sel_tid[0] = lsc_req_sel[1] | lsc_req_sel[3] | lsc_req_sel[5] | lsc_req_sel[7];
426assign req_sel_tid[1] = lsc_req_sel[2] | lsc_req_sel[3] | lsc_req_sel[6] | lsc_req_sel[7];
427assign req_sel_tid[2] = lsc_req_sel[4] | lsc_req_sel[5] | lsc_req_sel[6] | lsc_req_sel[7];
428
429assign cmiss_tid[0] = ftu_cmiss[1] | ftu_cmiss[3] | ftu_cmiss[5] | ftu_cmiss[7];
430assign cmiss_tid[1] = ftu_cmiss[2] | ftu_cmiss[3] | ftu_cmiss[6] | ftu_cmiss[7];
431assign cmiss_tid[2] = ftu_cmiss[4] | ftu_cmiss[5] | ftu_cmiss[6] | ftu_cmiss[7];
432
433assign ifu_l15_valid_in = (lsc_pending_req | lsc_early_req) & gkt_room_avail_in;
434
435assign lsc_l15_valid_in[7:0] = ({8{lsc_pending_req }} & lsc_req_sel[7:0]) |
436 ({8{~lsc_pending_req}} & ftu_cmiss[7:0]);
437
438assign ifu_l15_tid_in[2:0] = ({3{lsc_pending_req }} & req_sel_tid[2:0]) |
439 ({3{~lsc_pending_req}} & cmiss_tid[2:0]);
440
441assign ifu_l15_rway_in[2:0] = ({3{lsc_pending_req }} & mdp_lsi_rway[2:0]) |
442 ({3{~lsc_pending_req}} & ftu_rep_way[2:0]);
443
444assign ifu_l15_nc_in = (lsc_pending_req & mdp_lsi_nc_bit) |
445 (~lsc_pending_req & ftu_thrx_un_cacheable);
446
447// inval req cannot be sent early
448assign ifu_l15_inv_in = lsc_pending_req & mdp_lsi_inv_bit;
449
450assign tg0_selected_in = |(lsc_req_sel[3:0]) & gkt_room_avail_in;
451assign tg1_selected_in = |(lsc_req_sel[7:4]) & gkt_room_avail_in;
452
453ifu_cmu_lsi_ctl_msff_ctl_macro__width_3 ifu_l15_valid_reg (
454 .scan_in(ifu_l15_valid_reg_scanin),
455 .scan_out(ifu_l15_valid_reg_scanout),
456 .l1clk( l1clk ),
457 .din ({ifu_l15_valid_in, tg0_selected_in, tg1_selected_in}),
458 .dout ({ifu_l15_valid, tg0_selected, tg1_selected}),
459 .siclk(siclk),
460 .soclk(soclk)
461);
462
463ifu_cmu_lsi_ctl_msff_ctl_macro__width_8 lsc_l15_valid_reg (
464 .scan_in(lsc_l15_valid_reg_scanin),
465 .scan_out(lsc_l15_valid_reg_scanout),
466 .l1clk( l1clk ),
467 .din (lsc_l15_valid_in[7:0]),
468 .dout (lsc_l15_pre_valid[7:0]),
469 .siclk(siclk),
470 .soclk(soclk)
471);
472
473ifu_cmu_lsi_ctl_msff_ctl_macro__width_8 lsc_req_sel_reg (
474 .scan_in(lsc_req_sel_reg_scanin),
475 .scan_out(lsc_req_sel_reg_scanout),
476 .l1clk( l1clk ),
477 .din (lsc_req_sel[7:0]),
478 .dout (lsc_req_sel_lat[7:0]),
479 .siclk(siclk),
480 .soclk(soclk)
481);
482
483ifu_cmu_lsi_ctl_msff_ctl_macro__width_11 lsc_cpkt_reg (
484 .scan_in(lsc_cpkt_reg_scanin),
485 .scan_out(lsc_cpkt_reg_scanout),
486 .l1clk( l1clk ),
487 .din ({const_cpuid[2:0], ifu_l15_rway_in[2:0], ifu_l15_nc_in, ifu_l15_inv_in, ifu_l15_tid_in[2:0]}),
488 .dout ({cpuid[2:0], ifu_l15_rway[2:0], ifu_l15_nc, ifu_l15_inv, ifu_l15_tid[2:0]}),
489 .siclk(siclk),
490 .soclk(soclk)
491);
492
493assign lsc_l15_valid[7:0] = lsc_l15_pre_valid[7:0] & {8{ifu_l15_valid}};
494
495//assign ifu_l15_cpkt[25:0] = {ifu_l15_valid, ifu_l15_req_type[4:0], ifu_l15_nc, ifu_l15_cpuid[2:0],
496// ifu_l15_tid[2:0], ifu_l15_inv, ifu_l15_pf, ifu_l15_rway[2:0], ifu_l15_size[7:0]};
497
498// Actual ifu_l15_cpkt has following fields
499// ifu_l15_cpkt[25] = ifu_l15_valid
500// ifu_l15_cpkt[24:20] = ifu_l15_req_type[4:0] = 5'b10000
501// ifu_l15_cpkt[19] = ifu_l15_nc
502// ifu_l15_cpkt[18:16] = ifu_l15_cpuid[2:0]
503// ifu_l15_cpkt[15:13] = ifu_l15_tid[2:0]
504// ifu_l15_cpkt[12] = ifu_l15_inv
505// ifu_l15_cpkt[11] = ifu_l15_pf = 0
506// ifu_l15_cpkt[10:8] = ifu_l15_rway[2:0]
507// ifu_l15_cpkt[7:0] = ifu_l15_size[7:0] = 0
508
509// ifu_l15_cpkt is compressed to 8 bits. gkt converts this to final ifu packet
510assign ifu_l15_cpkt[7:0] = {ifu_l15_nc, ifu_l15_inv, ifu_l15_rway[2:0], ifu_l15_tid[2:0]};
511
512
513
514///////////////////////////////////////////////////
515// Generating following signals for LSU cross_invalidate
516///////////////////////////////////////////////////
517ifu_cmu_lsi_ctl_msff_ctl_macro__width_10 ifu_lsu_lat (
518 .scan_in(ifu_lsu_lat_scanin),
519 .scan_out(ifu_lsu_lat_scanout),
520 .l1clk( l1clk ),
521 .din ({ifu_l15_valid,
522 ifu_l15_tid[2:0],
523 ifu_l15_addr[10:5]}),
524 .dout ({ifu_lsu_if_vld,
525 ifu_lsu_if_tid[2:0],
526 ifu_lsu_if_addr[10:5]}),
527 .siclk(siclk),
528 .soclk(soclk)
529);
530
531
532///////////////////////////////////////////////////
533// Logic for selecting pending request
534///////////////////////////////////////////////////
535// Thread are divided into two groups.
536// A single favor bit will select alternatingly between the 2 groups.
537// Within a group, the threads will be prioritized based on a 4-bit rotating pointer.
538// The pointer always points to the thread with highest priority, and it gets updated
539// when a thread gets selected. The pointer updates such that the selected thread will
540// have the least priority.
541
542// The group is selected based on a favor bit.
543// The favor bit is updated based on what was selected last cycle
544
545assign favor_tg1_in = (favor_tg1 & ~tg1_selected) | tg0_selected;
546
547ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 favour_bit_reg (
548 .scan_in(favour_bit_reg_scanin),
549 .scan_out(favour_bit_reg_scanout),
550 .l1clk( l1clk ),
551 .din (favor_tg1_in),
552 .dout (favor_tg1),
553 .siclk(siclk),
554 .soclk(soclk)
555);
556
557///////////////////////////////////////////////////
558// Form the rotating pointer used to prioritize among threads
559// The pointer is updated when a thread group is selected, in a way that
560// gives the selected thread the least priority
561///////////////////////////////////////////////////
562assign thr_ptr0[3:0] = tg0_selected ? ({lsc_req_sel_lat[2:0],lsc_req_sel_lat[3]}): {thr_ptr0_lat[3:1],thr_ptr0_lat_0_};
563assign thr_ptr1[7:4] = tg1_selected ? ({lsc_req_sel_lat[6:4],lsc_req_sel_lat[7]}): {thr_ptr1_lat[7:5],thr_ptr1_lat_4_};
564
565assign thr_ptr0_0_ = ~thr_ptr0[0];
566assign thr_ptr1_4_ = ~thr_ptr1[4];
567
568ifu_cmu_lsi_ctl_msff_ctl_macro__width_4 ptr0_reg (
569 .scan_in(ptr0_reg_scanin),
570 .scan_out(ptr0_reg_scanout),
571 .l1clk( l1clk ),
572 .din ({thr_ptr0[3:1],thr_ptr0_0_}),
573 .dout ({thr_ptr0_lat[3:0]}),
574 .siclk(siclk),
575 .soclk(soclk)
576);
577
578ifu_cmu_lsi_ctl_msff_ctl_macro__width_4 ptr1_reg (
579 .scan_in(ptr1_reg_scanin),
580 .scan_out(ptr1_reg_scanout),
581 .l1clk( l1clk ),
582 .din ({thr_ptr1[7:5],thr_ptr1_4_}),
583 .dout ({thr_ptr1_lat[7:4]}),
584 .siclk(siclk),
585 .soclk(soclk)
586);
587
588assign thr_ptr0_lat_0_ = ~thr_ptr0_lat[0];
589assign thr_ptr1_lat_4_ = ~thr_ptr1_lat[4];
590
591///////////////////////////////////////////////////
592// select a thread based on the pointer value
593///////////////////////////////////////////////////
594assign req_bit[0] = (thr_ptr0[1] & ~csm_rqv[1] & ~csm_rqv[2] & ~csm_rqv[3] & csm_rqv[0]) |
595 (thr_ptr0[2] & ~csm_rqv[2] & ~csm_rqv[3] & csm_rqv[0]) |
596 (thr_ptr0[3] & ~csm_rqv[3] & csm_rqv[0]) |
597 (thr_ptr0[0] & csm_rqv[0]);
598
599
600assign req_bit[1] = (thr_ptr0[2] & ~csm_rqv[2] & ~csm_rqv[3] & ~csm_rqv[0] & csm_rqv[1]) |
601 (thr_ptr0[3] & ~csm_rqv[3] & ~csm_rqv[0] & csm_rqv[1]) |
602 (thr_ptr0[0] & ~csm_rqv[0] & csm_rqv[1]) |
603 (thr_ptr0[1] & csm_rqv[1]);
604
605
606assign req_bit[2] = (thr_ptr0[3] & ~csm_rqv[3] & ~csm_rqv[0] & ~csm_rqv[1] & csm_rqv[2]) |
607 (thr_ptr0[0] & ~csm_rqv[0] & ~csm_rqv[1] & csm_rqv[2]) |
608 (thr_ptr0[1] & ~csm_rqv[1] & csm_rqv[2]) |
609 (thr_ptr0[2] & csm_rqv[2]);
610
611
612assign req_bit[3] = (thr_ptr0[0] & ~csm_rqv[0] & ~csm_rqv[1] & ~csm_rqv[2] & csm_rqv[3]) |
613 (thr_ptr0[1] & ~csm_rqv[1] & ~csm_rqv[2] & csm_rqv[3]) |
614 (thr_ptr0[2] & ~csm_rqv[2] & csm_rqv[3]) |
615 (thr_ptr0[3] & csm_rqv[3]);
616
617
618
619assign req_bit[4] = (thr_ptr1[5] & ~csm_rqv[5] & ~csm_rqv[6] & ~csm_rqv[7] & csm_rqv[4]) |
620 (thr_ptr1[6] & ~csm_rqv[6] & ~csm_rqv[7] & csm_rqv[4]) |
621 (thr_ptr1[7] & ~csm_rqv[7] & csm_rqv[4]) |
622 (thr_ptr1[4] & csm_rqv[4]);
623
624
625assign req_bit[5] = (thr_ptr1[6] & ~csm_rqv[6] & ~csm_rqv[7] & ~csm_rqv[4] & csm_rqv[5]) |
626 (thr_ptr1[7] & ~csm_rqv[7] & ~csm_rqv[4] & csm_rqv[5]) |
627 (thr_ptr1[4] & ~csm_rqv[4] & csm_rqv[5]) |
628 (thr_ptr1[5] & csm_rqv[5]);
629
630
631assign req_bit[6] = (thr_ptr1[7] & ~csm_rqv[7] & ~csm_rqv[4] & ~csm_rqv[5] & csm_rqv[6]) |
632 (thr_ptr1[4] & ~csm_rqv[4] & ~csm_rqv[5] & csm_rqv[6]) |
633 (thr_ptr1[5] & ~csm_rqv[5] & csm_rqv[6]) |
634 (thr_ptr1[6] & csm_rqv[6]);
635
636
637assign req_bit[7] = (thr_ptr1[4] & ~csm_rqv[4] & ~csm_rqv[5] & ~csm_rqv[6] & csm_rqv[7]) |
638 (thr_ptr1[5] & ~csm_rqv[5] & ~csm_rqv[6] & csm_rqv[7]) |
639 (thr_ptr1[6] & ~csm_rqv[6] & csm_rqv[7]) |
640 (thr_ptr1[7] & csm_rqv[7]);
641
642
643// select the req based on favor bits
644assign tg0_valid = |(csm_rqv[3:0]);
645assign tg1_valid = |(csm_rqv[7:4]);
646
647assign sel_tg1 = (favor_tg1_in & tg1_valid) | ~tg0_valid;
648
649assign lsc_req_sel[7:0] = ({8{sel_tg1}} & {req_bit[7:4],4'b0000}) |
650 ({8{~sel_tg1}} & {4'b0000,req_bit[3:0]});
651
652// update tg0/tg1 pointers
653
654///////////////////////////////////////////////////
655///////////////////////////////////////////////////
656
657///////////////////////////////////////////////////
658// RETURN DATA TO IFU
659///////////////////////////////////////////////////
660// Decode l15_rtn_type opcode and generate enables
661// for fill data registers in DP block.
662///////////////////////////////////////////////////
663ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 reg_pmen (
664 .scan_in(reg_pmen_scanin),
665 .scan_out(reg_pmen_scanout),
666 .l1clk( l1clk ),
667 .din (lsu_ifu_cmu_pmen),
668 .dout (ifu_pmen),
669 .siclk(siclk),
670 .soclk(soclk)
671);
672
673// decode return pkt
674
675assign lsc_clken = l15_ifu_valid | ~ifu_pmen;
676
677assign l15_rtn_type[3:0] = l15_spc_cpkt[17:14];
678
679assign fill_return = ~l15_rtn_type[2] & ~l15_rtn_type[1] & l15_rtn_type[0] & l15_ifu_valid;
680
681assign cmu_nc_f4b = l15_spc_cpkt[9] & l15_spc_cpkt[2];
682
683assign lsc_fill_rtn1 = fill_return & ~second_pkt;
684assign lsc_fill_rtn2 = (fill_return & second_pkt) | (fill_return & cmu_nc_f4b);
685
686// set up state for second pkt of a two pkt ifill return.
687// non-cacheable and f4b ifill returns (nc_f4b_r0) are single pkt.
688assign second_pkt_in = ((second_pkt & ~fill_return) | (~second_pkt & fill_return & ~cmu_nc_f4b)) & ~(second_pkt & fill_return);
689
690ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 sec_pkt_lat (
691 .scan_in(sec_pkt_lat_scanin),
692 .scan_out(sec_pkt_lat_scanout),
693 .l1clk(l1clk),
694 .din (second_pkt_in),
695 .dout (second_pkt),
696 .siclk(siclk),
697 .soclk(soclk)
698);
699
700
701assign cmu_data_ready[0] = ~l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & ~l15_spc_cpkt[6] & lsc_fill_rtn2;
702assign cmu_data_ready[1] = ~l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & l15_spc_cpkt[6] & lsc_fill_rtn2;
703assign cmu_data_ready[2] = ~l15_spc_cpkt[8] & l15_spc_cpkt[7] & ~l15_spc_cpkt[6] & lsc_fill_rtn2;
704assign cmu_data_ready[3] = ~l15_spc_cpkt[8] & l15_spc_cpkt[7] & l15_spc_cpkt[6] & lsc_fill_rtn2;
705assign cmu_data_ready[4] = l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & ~l15_spc_cpkt[6] & lsc_fill_rtn2;
706assign cmu_data_ready[5] = l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & l15_spc_cpkt[6] & lsc_fill_rtn2;
707assign cmu_data_ready[6] = l15_spc_cpkt[8] & l15_spc_cpkt[7] & ~l15_spc_cpkt[6] & lsc_fill_rtn2;
708assign cmu_data_ready[7] = l15_spc_cpkt[8] & l15_spc_cpkt[7] & l15_spc_cpkt[6] & lsc_fill_rtn2;
709
710
711assign cmu_any_data_ready = lsc_fill_rtn2;
712assign cmu_any_un_cacheable = l15_spc_cpkt[9];
713
714///////////////////////////////////////////////////
715// decode l2 err and l2 miss and send to ifu
716///////////////////////////////////////////////////
717//assign cmu_l2_err[1:0] = l15_spc_cpkt[11:10];
718
719assign cmu_l2_err_pkt1_in[1:0] = ({2{lsc_fill_rtn1}} & l15_spc_cpkt[11:10]) & ~{2{lsc_fill_rtn2}};
720
721
722ifu_cmu_lsi_ctl_msff_ctl_macro__width_2 stg_r1_lat0 (
723 .scan_in(stg_r1_lat0_scanin),
724 .scan_out(stg_r1_lat0_scanout),
725 .l1clk( l1clk ),
726 .din (cmu_l2_err_pkt1_in[1:0]),
727 .dout (cmu_l2_err_pkt1[1:0]),
728 .siclk(siclk),
729 .soclk(soclk)
730);
731
732// l2 err
733// 00 - no err, 01 - correctable, 10 - uncorrectable, 11 - not data
734// report the worst offense if the two packets have different errors
735// not_data > uncorrectable > correctable > no err
736
737
738assign cmu_l2_err[1] = l15_spc_cpkt[11] | cmu_l2_err_pkt1[1];
739assign cmu_l2_err[0] = ( l15_spc_cpkt[11] & l15_spc_cpkt[10]) |
740 ( cmu_l2_err_pkt1[1] & cmu_l2_err_pkt1[0]) |
741 (~l15_spc_cpkt[11] & cmu_l2_err_pkt1[0]) |
742 ( l15_spc_cpkt[10] & ~cmu_l2_err_pkt1[1]);
743
744
745
746//assign cmu_l2_err[1:0] = (l15_spc_cpkt[11:10] | cmu_l2_err_pkt1[1:0]);
747
748
749
750// l2miss is asserted on the first packet only.
751
752assign cmu_l2miss_in = lsc_fill_rtn1 & l15_spc_cpkt[12];
753
754
755///////////////////////////////////////////////////
756// Word selects for muxing out instructions
757///////////////////////////////////////////////////
758assign cmu_inst0_v_in = lsc_fill_rtn2;
759assign cmu_inst1_v_in = ~(cmu_fill_paddr[4] & cmu_fill_paddr[3] & cmu_fill_paddr[2]) & ~cmu_nc_f4b & lsc_fill_rtn2;
760assign cmu_inst2_v_in = ~(cmu_fill_paddr[4] & cmu_fill_paddr[3]) & ~cmu_nc_f4b & lsc_fill_rtn2;
761assign cmu_inst3_v_in = ~((cmu_fill_paddr[4] & cmu_fill_paddr[2]) | (cmu_fill_paddr[4] & cmu_fill_paddr[3])) &
762 ~cmu_nc_f4b & lsc_fill_rtn2;
763
764
765ifu_cmu_lsi_ctl_msff_ctl_macro__width_4 cmu_inst_reg (
766 .scan_in(cmu_inst_reg_scanin),
767 .scan_out(cmu_inst_reg_scanout),
768 .l1clk( l1clk ),
769 .din ({cmu_inst0_v_in, cmu_inst1_v_in, cmu_inst2_v_in, cmu_inst3_v_in}),
770 .dout ({cmu_inst0_v, cmu_inst1_v, cmu_inst2_v, cmu_inst3_v}),
771 .siclk(siclk),
772 .soclk(soclk)
773);
774
775///////////////////////////////////////////////////
776// Generate decodes for muxing out instructions
777///////////////////////////////////////////////////
778assign lsc_data_sel[0] = ~cmu_fill_paddr[4] & ~cmu_fill_paddr[3] & ~cmu_fill_paddr[2];
779assign lsc_data_sel[1] = ~cmu_fill_paddr[4] & ~cmu_fill_paddr[3] & cmu_fill_paddr[2];
780assign lsc_data_sel[2] = ~cmu_fill_paddr[4] & cmu_fill_paddr[3] & ~cmu_fill_paddr[2];
781assign lsc_data_sel[3] = ~cmu_fill_paddr[4] & cmu_fill_paddr[3] & cmu_fill_paddr[2];
782assign lsc_data_sel[4] = cmu_fill_paddr[4] & ~cmu_fill_paddr[3] & ~cmu_fill_paddr[2];
783assign lsc_data_sel[5] = cmu_fill_paddr[4] & ~cmu_fill_paddr[3] & cmu_fill_paddr[2];
784assign lsc_data_sel[6] = cmu_fill_paddr[4] & cmu_fill_paddr[3] & ~cmu_fill_paddr[2];
785assign lsc_data_sel[7] = cmu_fill_paddr[4] & cmu_fill_paddr[3] & cmu_fill_paddr[2];
786
787
788///////////////////////////////////////////////////
789// Cache Invalidation
790///////////////////////////////////////////////////
791assign store_inval_vector[31:0] = l15_spc_data1[95:64];
792assign evic_inv_vec_0[31:0] = l15_spc_data1[31:0];
793assign evic_inv_vec_1[31:0] = l15_spc_data1[87:56];
794
795
796assign take_strm_store_ack = (~l15_rtn_type[3] & l15_rtn_type[2] & l15_rtn_type[1] & ~l15_rtn_type[0]) & l15_ifu_valid;
797assign take_store_ack = (~l15_rtn_type[3] & l15_rtn_type[2] & ~l15_rtn_type[1] & ~l15_rtn_type[0] &
798 ~l15_spc_data1[124] & ~l15_spc_data1[123]) & l15_ifu_valid;
799assign take_inval_ack = (~l15_rtn_type[3] & l15_rtn_type[2] & ~l15_rtn_type[1] & ~l15_rtn_type[0] &
800 l15_spc_data1[124] & ~l15_spc_data1[123]) & l15_ifu_valid;
801assign take_load_return = (~l15_rtn_type[3] & ~l15_rtn_type[2] & ~l15_rtn_type[1] & ~l15_rtn_type[0]) & l15_ifu_valid;
802assign take_evic_inv = (~l15_rtn_type[3] & ~l15_rtn_type[2] & l15_rtn_type[1] & l15_rtn_type[0]) & l15_ifu_valid;
803
804
805assign cmu_inval_ack_din[0] = take_inval_ack & (~l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & ~l15_spc_cpkt[6]);
806assign cmu_inval_ack_din[1] = take_inval_ack & (~l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & l15_spc_cpkt[6]);
807assign cmu_inval_ack_din[2] = take_inval_ack & (~l15_spc_cpkt[8] & l15_spc_cpkt[7] & ~l15_spc_cpkt[6]);
808assign cmu_inval_ack_din[3] = take_inval_ack & (~l15_spc_cpkt[8] & l15_spc_cpkt[7] & l15_spc_cpkt[6]);
809assign cmu_inval_ack_din[4] = take_inval_ack & ( l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & ~l15_spc_cpkt[6]);
810assign cmu_inval_ack_din[5] = take_inval_ack & ( l15_spc_cpkt[8] & ~l15_spc_cpkt[7] & l15_spc_cpkt[6]);
811assign cmu_inval_ack_din[6] = take_inval_ack & ( l15_spc_cpkt[8] & l15_spc_cpkt[7] & ~l15_spc_cpkt[6]);
812assign cmu_inval_ack_din[7] = take_inval_ack & ( l15_spc_cpkt[8] & l15_spc_cpkt[7] & l15_spc_cpkt[6]);
813
814assign inv_vector[0] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[0]
815 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[4]
816 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[8]
817 | (~cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[12]
818 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[16]
819 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[20]
820 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[24]
821 | ( cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[28]);
822
823assign inv_vector[1] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[1]
824 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[5]
825 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[9]
826 | (~cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[13]
827 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[17]
828 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[21]
829 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[25]
830 | ( cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[29]);
831
832assign inv_vector[2] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[2]
833 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[6]
834 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[10]
835 | (~cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[14]
836 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[18]
837 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[22]
838 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[26]
839 | ( cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[30]);
840
841assign inv_vector[3] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[3]
842 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[7]
843 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[11]
844 | (~cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[15]
845 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & store_inval_vector[19]
846 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & store_inval_vector[23]
847 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & store_inval_vector[27]
848 | ( cpuid[2] & cpuid[1] & cpuid[0]) & store_inval_vector[31]);
849
850// **************************************************
851
852assign evic_i_inv_0_true = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[0]
853 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[4]
854 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[8]
855 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[12]
856 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[16]
857 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[20]
858 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[24]
859 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[28]);
860
861assign evic_inv_way0[0] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[1]
862 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[5]
863 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[9]
864 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[13]
865 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[17]
866 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[21]
867 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[25]
868 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[29]);
869
870assign evic_inv_way0[1] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[2]
871 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[6]
872 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[10]
873 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[14]
874 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[18]
875 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[22]
876 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[26]
877 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[30]);
878
879assign evic_inv_way0[2] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[3]
880 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[7]
881 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[11]
882 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[15]
883 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[19]
884 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_0[23]
885 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_0[27]
886 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_0[31]);
887
888// **************************************************
889assign evic_i_inv_1_true = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[0]
890 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[4]
891 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[8]
892 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[12]
893 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[16]
894 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[20]
895 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[24]
896 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[28]);
897
898assign evic_inv_way1[0] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[1]
899 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[5]
900 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[9]
901 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[13]
902 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[17]
903 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[21]
904 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[25]
905 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[29]);
906
907assign evic_inv_way1[1] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[2]
908 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[6]
909 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[10]
910 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[14]
911 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[18]
912 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[22]
913 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[26]
914 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[30]);
915
916assign evic_inv_way1[2] = ( (~cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[3]
917 | (~cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[7]
918 | (~cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[11]
919 | (~cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[15]
920 | ( cpuid[2] & ~cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[19]
921 | ( cpuid[2] & ~cpuid[1] & cpuid[0]) & evic_inv_vec_1[23]
922 | ( cpuid[2] & cpuid[1] & ~cpuid[0]) & evic_inv_vec_1[27]
923 | ( cpuid[2] & cpuid[1] & cpuid[0]) & evic_inv_vec_1[31]);
924
925//0in bits_on -var {str_strm_invalidate, cross_invalidate} -max 1
926assign str_strm_invalidate = (take_strm_store_ack | take_store_ack) & inv_vector[0];
927assign cross_invalidate = take_load_return & l15_spc_cpkt[5]; // way valid
928
929
930assign evic_invalidate_w0 = take_evic_inv & evic_i_inv_0_true & ~evic_i_inv_1_true;
931assign evic_invalidate_w1 = take_evic_inv & ~evic_i_inv_0_true & evic_i_inv_1_true;
932assign evic_invalidate_w01 = take_evic_inv & evic_i_inv_0_true & evic_i_inv_1_true;
933assign evic_invalidate_any = take_evic_inv & (evic_i_inv_0_true | evic_i_inv_1_true);
934
935assign evic_way0[2:0] = (evic_inv_way0[2:0] & {3{evic_invalidate_w0}}) |
936 (evic_inv_way1[2:0] & {3{evic_invalidate_w1}}) |
937 (evic_inv_way0[2:0] & {3{evic_invalidate_w01}});
938
939assign evic_index[10:5] = ({l15_spc_data1[116:112], 1'b0} & {6{evic_invalidate_w01}}) |
940 ({l15_spc_data1[116:112], 1'b0} & {6{evic_invalidate_w0}}) |
941 ({l15_spc_data1[116:112], 1'b1} & {6{evic_invalidate_w1}}) ;
942
943assign cmu_icache_invalidate_din = str_strm_invalidate | cross_invalidate | evic_invalidate_any;
944assign cmu_icache_invalidate_way_din[2:0] = (inv_vector[3:1] & {3{str_strm_invalidate}}) |
945 (l15_spc_cpkt[4:2] & {3{cross_invalidate}}) |
946 (evic_way0[2:0] & {3{evic_invalidate_any}});
947assign cmu_icache_invalidate_index_din[10:5] = ({l15_spc_data1[116:112], l15_spc_data1[122]} & {6{str_strm_invalidate}}) |
948 ({l15_spc_data1[116:112], l15_spc_data1[122]} & {6{take_inval_ack}}) |
949 (lsu_ifu_ld_index[10:5] & {6{cross_invalidate}}) |
950 (evic_index[10:5] & {6{evic_invalidate_any}});
951
952assign cmu_evic_invalidate_din = evic_invalidate_w01;
953assign cmu_icache_inv_way1_din[2:0] = evic_inv_way1[2:0];
954
955ifu_cmu_lsi_ctl_msff_ctl_macro__width_22 stg_r1_lat (
956 .scan_in(stg_r1_lat_scanin),
957 .scan_out(stg_r1_lat_scanout),
958 .l1clk(l1clk ),
959 .din ({cmu_icache_invalidate_din,
960 cmu_icache_invalidate_way_din[2:0],
961 cmu_icache_invalidate_index_din[10:5],
962 cmu_icache_inv_way1_din[2:0],
963 cmu_evic_invalidate_din,
964 cmu_inval_ack_din[7:0]}),
965 .dout ({cmu_icache_invalidate,
966 cmu_icache_invalidate_way[2:0],
967 cmu_icache_invalidate_index[10:5],
968 cmu_icache_inv_way1[2:0],
969 cmu_evic_invalidate,
970 cmu_inval_ack[7:0]}),
971 .siclk(siclk),
972 .soclk(soclk)
973);
974
975assign l15_spc_data_55_32_unused[23:0] = l15_spc_data1[55:32];
976assign l15_spc_data_111_96_unused[15:0] = l15_spc_data1[111:96];
977assign l15_spc_data_121_117_unused[4:0] = l15_spc_data1[121:117];
978assign l15_spc_data_127_125_unused[2:0] = l15_spc_data1[127:125];
979assign l15_spc_cpkt_1_0_unused[1:0] = l15_spc_cpkt[1:0];
980assign l15_spc_cpkt_13_unused = l15_spc_cpkt[13];
981
982
983////////////////////////////////////////////////////////
984// SPARE CELLS
985////////////////////////////////////////////////////////
986//spare_ctl_macro spares (num=2) (
987// .scan_in(spares_scanin),
988// .scan_out(spares_scanout),
989// .l1clk (l1clk)
990//);
991////////////////////////////////////////////////////////
992// Flatten spare cells
993 cl_sc1_msff_8x spares_spare0_flop ( .l1clk(l1clk), .siclk(siclk), .soclk(soclk),
994 .d(cmu_l2miss_in), .q(cmu_l2miss), .si(stg_r1_lat_scanout), .so(spares_so_0) );
995 cl_u1_buf_32x spares_spare0_buf_32x ( .in(1'b1),
996 .out(out) );
997 cl_u1_nand3_8x spares_spare0_nand3_8x ( .in0(1'b1), .in1(1'b1), .in2(1'b1),
998 .out(out) );
999 cl_u1_inv_8x spares_spare0_inv_8x ( .in(1'b1),
1000 .out(out) );
1001 cl_u1_aoi22_4x spares_spare0_aoi22_4x ( .in00(1'b1), .in01(1'b1), .in10(1'b1), .in11(1'b1),
1002 .out(out) );
1003 cl_u1_buf_8x spares_spare0_buf_8x ( .in(1'b1),
1004 .out(out) );
1005 cl_u1_oai22_4x spares_spare0_oai22_4x ( .in00(1'b1), .in01(1'b1), .in10(1'b1), .in11(1'b1),
1006 .out(out) );
1007 cl_u1_inv_16x spares_spare0_inv_16x ( .in(1'b1),
1008 .out(out) );
1009 cl_u1_nand2_16x spares_spare0_nand2_16x ( .in0(1'b1), .in1(1'b1),
1010 .out(out) );
1011 cl_u1_nor3_4x spares_spare0_nor3_4x ( .in0(1'b0), .in1(1'b0), .in2(1'b0),
1012 .out(out) );
1013 cl_u1_nand2_8x spares_spare0_nand2_8x ( .in0(1'b1), .in1(1'b1),
1014 .out(out) );
1015 cl_u1_buf_16x spares_spare0_buf_16x ( .in(1'b1),
1016 .out(out) );
1017 cl_u1_nor2_16x spares_spare0_nor2_16x ( .in0(1'b0), .in1(1'b0),
1018 .out(out) );
1019 cl_u1_inv_32x spares_spare0_inv_32x ( .in(1'b1),
1020 .out(out) );
1021 cl_sc1_msff_8x spares_spare1_flop ( .l1clk(l1clk), .siclk(siclk), .soclk(soclk),
1022 .d(1'b0), .si(spares_so_0), .so(spares_scanout),
1023 .q(q) );
1024 cl_u1_buf_32x spares_spare1_buf_32x ( .in(1'b1),
1025 .out(out) );
1026 cl_u1_nand3_8x spares_spare1_nand3_8x ( .in0(1'b1), .in1(1'b1), .in2(1'b1),
1027 .out(out) );
1028 cl_u1_inv_8x spares_spare1_inv_8x ( .in(1'b1),
1029 .out(out) );
1030 cl_u1_aoi22_4x spares_spare1_aoi22_4x ( .in00(1'b1), .in01(1'b1), .in10(1'b1), .in11(1'b1),
1031 .out(out) );
1032 cl_u1_buf_8x spares_spare1_buf_8x ( .in(1'b1),
1033 .out(out) );
1034 cl_u1_oai22_4x spares_spare1_oai22_4x ( .in00(1'b1), .in01(1'b1), .in10(1'b1), .in11(1'b1),
1035 .out(out) );
1036 cl_u1_inv_16x spares_spare1_inv_16x ( .in(1'b1),
1037 .out(out) );
1038 cl_u1_nand2_16x spares_spare1_nand2_16x ( .in0(1'b1), .in1(1'b1),
1039 .out(out) );
1040 cl_u1_nor3_4x spares_spare1_nor3_4x ( .in0(1'b0), .in1(1'b0), .in2(1'b0),
1041 .out(out) );
1042 cl_u1_nand2_8x spares_spare1_nand2_8x ( .in0(1'b1), .in1(1'b1),
1043 .out(out) );
1044 cl_u1_buf_16x spares_spare1_buf_16x ( .in(1'b1),
1045 .out(out) );
1046 cl_u1_nor2_16x spares_spare1_nor2_16x ( .in0(1'b0), .in1(1'b0),
1047 .out(out) );
1048 cl_u1_inv_32x spares_spare1_inv_32x ( .in(1'b1),
1049 .out(out) );
1050////////////////////////////////////////////////////////
1051
1052supply0 vss;
1053supply1 vdd;
1054
1055// fixscan start:
1056assign empty_state_reg_scanin = scan_in ;
1057assign one_buff_state_reg_scanin = empty_state_reg_scanout ;
1058assign l15_hold_state_reg_scanin = one_buff_state_reg_scanout;
1059assign ifu_l15_valid_reg_scanin = l15_hold_state_reg_scanout;
1060assign lsc_l15_valid_reg_scanin = ifu_l15_valid_reg_scanout;
1061assign lsc_req_sel_reg_scanin = lsc_l15_valid_reg_scanout;
1062assign lsc_cpkt_reg_scanin = lsc_req_sel_reg_scanout ;
1063assign ifu_lsu_lat_scanin = lsc_cpkt_reg_scanout ;
1064assign favour_bit_reg_scanin = ifu_lsu_lat_scanout ;
1065assign ptr0_reg_scanin = favour_bit_reg_scanout ;
1066assign ptr1_reg_scanin = ptr0_reg_scanout ;
1067assign reg_pmen_scanin = ptr1_reg_scanout ;
1068assign sec_pkt_lat_scanin = reg_pmen_scanout ;
1069assign stg_r1_lat0_scanin = sec_pkt_lat_scanout ;
1070assign cmu_inst_reg_scanin = stg_r1_lat0_scanout ;
1071assign stg_r1_lat_scanin = cmu_inst_reg_scanout ;
1072assign spares_scanin = stg_r1_lat_scanout ;
1073assign scan_out = spares_scanout ;
1074
1075// fixscan end:
1076endmodule
1077
1078
1079
1080
1081
1082
1083// any PARAMS parms go into naming of macro
1084
1085module ifu_cmu_lsi_ctl_l1clkhdr_ctl_macro (
1086 l2clk,
1087 l1en,
1088 pce_ov,
1089 stop,
1090 se,
1091 l1clk);
1092
1093
1094 input l2clk;
1095 input l1en;
1096 input pce_ov;
1097 input stop;
1098 input se;
1099 output l1clk;
1100
1101
1102
1103
1104
1105cl_sc1_l1hdr_8x c_0 (
1106
1107
1108 .l2clk(l2clk),
1109 .pce(l1en),
1110 .l1clk(l1clk),
1111 .se(se),
1112 .pce_ov(pce_ov),
1113 .stop(stop)
1114);
1115
1116
1117
1118endmodule
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132// any PARAMS parms go into naming of macro
1133
1134module ifu_cmu_lsi_ctl_msff_ctl_macro__width_1 (
1135 din,
1136 l1clk,
1137 scan_in,
1138 siclk,
1139 soclk,
1140 dout,
1141 scan_out);
1142wire [0:0] fdin;
1143
1144 input [0:0] din;
1145 input l1clk;
1146 input scan_in;
1147
1148
1149 input siclk;
1150 input soclk;
1151
1152 output [0:0] dout;
1153 output scan_out;
1154assign fdin[0:0] = din[0:0];
1155
1156
1157
1158
1159
1160
1161dff #(1) d0_0 (
1162.l1clk(l1clk),
1163.siclk(siclk),
1164.soclk(soclk),
1165.d(fdin[0:0]),
1166.si(scan_in),
1167.so(scan_out),
1168.q(dout[0:0])
1169);
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182endmodule
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196// any PARAMS parms go into naming of macro
1197
1198module ifu_cmu_lsi_ctl_msff_ctl_macro__width_3 (
1199 din,
1200 l1clk,
1201 scan_in,
1202 siclk,
1203 soclk,
1204 dout,
1205 scan_out);
1206wire [2:0] fdin;
1207wire [1:0] so;
1208
1209 input [2:0] din;
1210 input l1clk;
1211 input scan_in;
1212
1213
1214 input siclk;
1215 input soclk;
1216
1217 output [2:0] dout;
1218 output scan_out;
1219assign fdin[2:0] = din[2:0];
1220
1221
1222
1223
1224
1225
1226dff #(3) d0_0 (
1227.l1clk(l1clk),
1228.siclk(siclk),
1229.soclk(soclk),
1230.d(fdin[2:0]),
1231.si({scan_in,so[1:0]}),
1232.so({so[1:0],scan_out}),
1233.q(dout[2:0])
1234);
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247endmodule
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261// any PARAMS parms go into naming of macro
1262
1263module ifu_cmu_lsi_ctl_msff_ctl_macro__width_8 (
1264 din,
1265 l1clk,
1266 scan_in,
1267 siclk,
1268 soclk,
1269 dout,
1270 scan_out);
1271wire [7:0] fdin;
1272wire [6:0] so;
1273
1274 input [7:0] din;
1275 input l1clk;
1276 input scan_in;
1277
1278
1279 input siclk;
1280 input soclk;
1281
1282 output [7:0] dout;
1283 output scan_out;
1284assign fdin[7:0] = din[7:0];
1285
1286
1287
1288
1289
1290
1291dff #(8) d0_0 (
1292.l1clk(l1clk),
1293.siclk(siclk),
1294.soclk(soclk),
1295.d(fdin[7:0]),
1296.si({scan_in,so[6:0]}),
1297.so({so[6:0],scan_out}),
1298.q(dout[7:0])
1299);
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312endmodule
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326// any PARAMS parms go into naming of macro
1327
1328module ifu_cmu_lsi_ctl_msff_ctl_macro__width_11 (
1329 din,
1330 l1clk,
1331 scan_in,
1332 siclk,
1333 soclk,
1334 dout,
1335 scan_out);
1336wire [10:0] fdin;
1337wire [9:0] so;
1338
1339 input [10:0] din;
1340 input l1clk;
1341 input scan_in;
1342
1343
1344 input siclk;
1345 input soclk;
1346
1347 output [10:0] dout;
1348 output scan_out;
1349assign fdin[10:0] = din[10:0];
1350
1351
1352
1353
1354
1355
1356dff #(11) d0_0 (
1357.l1clk(l1clk),
1358.siclk(siclk),
1359.soclk(soclk),
1360.d(fdin[10:0]),
1361.si({scan_in,so[9:0]}),
1362.so({so[9:0],scan_out}),
1363.q(dout[10:0])
1364);
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377endmodule
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391// any PARAMS parms go into naming of macro
1392
1393module ifu_cmu_lsi_ctl_msff_ctl_macro__width_10 (
1394 din,
1395 l1clk,
1396 scan_in,
1397 siclk,
1398 soclk,
1399 dout,
1400 scan_out);
1401wire [9:0] fdin;
1402wire [8:0] so;
1403
1404 input [9:0] din;
1405 input l1clk;
1406 input scan_in;
1407
1408
1409 input siclk;
1410 input soclk;
1411
1412 output [9:0] dout;
1413 output scan_out;
1414assign fdin[9:0] = din[9:0];
1415
1416
1417
1418
1419
1420
1421dff #(10) d0_0 (
1422.l1clk(l1clk),
1423.siclk(siclk),
1424.soclk(soclk),
1425.d(fdin[9:0]),
1426.si({scan_in,so[8:0]}),
1427.so({so[8:0],scan_out}),
1428.q(dout[9:0])
1429);
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442endmodule
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456// any PARAMS parms go into naming of macro
1457
1458module ifu_cmu_lsi_ctl_msff_ctl_macro__width_4 (
1459 din,
1460 l1clk,
1461 scan_in,
1462 siclk,
1463 soclk,
1464 dout,
1465 scan_out);
1466wire [3:0] fdin;
1467wire [2:0] so;
1468
1469 input [3:0] din;
1470 input l1clk;
1471 input scan_in;
1472
1473
1474 input siclk;
1475 input soclk;
1476
1477 output [3:0] dout;
1478 output scan_out;
1479assign fdin[3:0] = din[3:0];
1480
1481
1482
1483
1484
1485
1486dff #(4) d0_0 (
1487.l1clk(l1clk),
1488.siclk(siclk),
1489.soclk(soclk),
1490.d(fdin[3:0]),
1491.si({scan_in,so[2:0]}),
1492.so({so[2:0],scan_out}),
1493.q(dout[3:0])
1494);
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507endmodule
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521// any PARAMS parms go into naming of macro
1522
1523module ifu_cmu_lsi_ctl_msff_ctl_macro__width_2 (
1524 din,
1525 l1clk,
1526 scan_in,
1527 siclk,
1528 soclk,
1529 dout,
1530 scan_out);
1531wire [1:0] fdin;
1532wire [0:0] so;
1533
1534 input [1:0] din;
1535 input l1clk;
1536 input scan_in;
1537
1538
1539 input siclk;
1540 input soclk;
1541
1542 output [1:0] dout;
1543 output scan_out;
1544assign fdin[1:0] = din[1:0];
1545
1546
1547
1548
1549
1550
1551dff #(2) d0_0 (
1552.l1clk(l1clk),
1553.siclk(siclk),
1554.soclk(soclk),
1555.d(fdin[1:0]),
1556.si({scan_in,so[0:0]}),
1557.so({so[0:0],scan_out}),
1558.q(dout[1:0])
1559);
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572endmodule
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586// any PARAMS parms go into naming of macro
1587
1588module ifu_cmu_lsi_ctl_msff_ctl_macro__width_22 (
1589 din,
1590 l1clk,
1591 scan_in,
1592 siclk,
1593 soclk,
1594 dout,
1595 scan_out);
1596wire [21:0] fdin;
1597wire [20:0] so;
1598
1599 input [21:0] din;
1600 input l1clk;
1601 input scan_in;
1602
1603
1604 input siclk;
1605 input soclk;
1606
1607 output [21:0] dout;
1608 output scan_out;
1609assign fdin[21:0] = din[21:0];
1610
1611
1612
1613
1614
1615
1616dff #(22) d0_0 (
1617.l1clk(l1clk),
1618.siclk(siclk),
1619.soclk(soclk),
1620.d(fdin[21:0]),
1621.si({scan_in,so[20:0]}),
1622.so({so[20:0],scan_out}),
1623.q(dout[21:0])
1624);
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637endmodule
1638
1639
1640
1641
1642
1643
1644
1645