Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / spc / pku / rtl / pku_pck_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: pku_pck_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 pku_pck_ctl (
36 lsu_pku_pmen,
37 pku_pick_p,
38 swl_ready_p,
39 swl_spec_ready_p,
40 ifu_buf0_valid_p,
41 scan_in,
42 l2clk,
43 tcu_pce_ov,
44 spc_aclk,
45 spc_bclk,
46 tcu_scan_en,
47 pku_raw_pick_p,
48 scan_out);
49wire pce_ov;
50wire stop;
51wire siclk;
52wire soclk;
53wire se;
54wire pick_en;
55wire [3:0] nsready;
56wire [3:0] sready;
57wire l1clk_pm1;
58wire spares_scanin;
59wire spares_scanout;
60wire nspick_sel;
61wire [3:0] nspick;
62wire [7:0] lru;
63wire [3:0] spick;
64wire [3:0] ipick;
65wire [7:0] nlru;
66wire any_pick;
67wire [7:0] real_nlru_in;
68wire [7:0] lru_out;
69wire lruf_scanin;
70wire lruf_scanout;
71
72
73input lsu_pku_pmen; // power management enable for pku
74input [3:0] pku_pick_p; // from datapath logic
75
76input [3:0] swl_ready_p; // thread is in ready state
77input [3:0] swl_spec_ready_p; // thread is in speculative ready state
78input [3:0] ifu_buf0_valid_p; // oldest instruction for thread i is valid
79input scan_in;
80input l2clk;
81input tcu_pce_ov; // scan signals
82input spc_aclk;
83input spc_bclk;
84input tcu_scan_en;
85
86
87
88output [3:0] pku_raw_pick_p; // raw pick signals to mux the pc addresses in the ifu (no swl_cancel_pick or decode cancel)
89output scan_out;
90
91// scan renames
92assign pce_ov = tcu_pce_ov;
93assign stop = 1'b0;
94assign siclk = spc_aclk;
95assign soclk = spc_bclk;
96assign se = tcu_scan_en;
97// end scan
98
99
100assign pick_en = (|nsready[3:0]) | (|sready[3:0]) | ~lsu_pku_pmen;
101
102pku_pck_ctl_l1clkhdr_ctl_macro clkgen (
103 .l2clk(l2clk),
104 .l1en (pick_en ),
105 .l1clk(l1clk_pm1),
106 .pce_ov(pce_ov),
107 .stop(stop),
108 .se(se));
109
110pku_pck_ctl_spare_ctl_macro__num_1 spares (
111 .scan_in(spares_scanin),
112 .scan_out(spares_scanout),
113 .l1clk (l1clk_pm1),
114 .siclk(siclk),
115 .soclk(soclk)
116);
117
118assign nsready[3:0] = (swl_ready_p[3:0] & ifu_buf0_valid_p[3:0]);
119
120assign nspick_sel = |nsready[3:0];
121
122// 0in value -var nspick[3:0] -val 4'b0000 4'b0001 4'b0010 4'b0100 4'b1000
123// 0in value -var spick[3:0] -val 4'b0000 4'b0001 4'b0010 4'b0100 4'b1000
124// 0in value -var ipick[3:0] -val 4'b0000 4'b0001 4'b0010 4'b0100 4'b1000
125
126assign nspick[3] = (nsready[3]&!nsready[1]&!nsready[0]&lru[1]&!lru[0]) | (nsready[3]
127 &!nsready[2]&!nsready[0]&!lru[1]&lru[0]) | (nsready[3]&!nsready[1]&!lru[2]
128 &!lru[0]) | (nsready[3]&!nsready[2]&!lru[3]&!lru[1]) | (nsready[3]&!nsready[2]
129 &!nsready[1]&!lru[1]&!lru[0]) | (nsready[3]&!nsready[0]&!lru[7]&!lru[6]
130 &lru[5]&lru[4]) | (nsready[3]&lru[7]&lru[6]) | (nsready[3]&!nsready[2]
131 &!nsready[1]&!nsready[0]);
132
133assign nspick[2] = (!nsready[3]&nsready[2]&!nsready[1]&!lru[1]&!lru[0]) | (nsready[2]
134 &!nsready[1]&!nsready[0]&lru[1]&lru[0]) | (nsready[2]&!nsready[0]&lru[2]
135 &lru[0]) | (!nsready[3]&nsready[2]&!lru[3]&!lru[1]) | (!nsready[3]&nsready[2]
136 &!nsready[0]&!lru[1]&lru[0]) | (nsready[2]&!nsready[1]&!lru[7]&lru[6]
137 &lru[5]&!lru[4]) | (nsready[2]&lru[7]&!lru[6]) | (!nsready[3]&nsready[2]
138 &!nsready[1]&!nsready[0]);
139
140assign nspick[1] = (!nsready[3]&!nsready[2]&nsready[1]&!lru[1]&!lru[0]) | (!nsready[2]
141 &nsready[1]&!nsready[0]&lru[1]&lru[0]) | (!nsready[3]&nsready[1]&!lru[2]
142 &!lru[0]) | (nsready[1]&!nsready[0]&lru[3]&lru[1]) | (!nsready[3]&nsready[1]
143 &!nsready[0]&lru[1]&!lru[0]) | (!nsready[2]&nsready[1]&lru[7]&!lru[6]
144 &!lru[5]&lru[4]) | (nsready[1]&!lru[7]&lru[6]) | (!nsready[3]&!nsready[2]
145 &nsready[1]&!nsready[0]);
146
147assign nspick[0] = (!nsready[3]&!nsready[1]&nsready[0]&lru[1]&!lru[0]) | (!nsready[3]
148 &!nsready[2]&nsready[0]&!lru[1]&lru[0]) | (!nsready[2]&nsready[0]&lru[2]
149 &lru[0]) | (!nsready[1]&nsready[0]&lru[3]&lru[1]) | (!nsready[2]&!nsready[1]
150 &nsready[0]&lru[1]&lru[0]) | (!nsready[3]&nsready[0]&lru[7]&lru[6]&!lru[5]
151 &!lru[4]) | (nsready[0]&!lru[7]&!lru[6]) | (!nsready[3]&!nsready[2]
152 &!nsready[1]&nsready[0]);
153
154assign sready[3:0] = (swl_spec_ready_p[3:0] & ifu_buf0_valid_p[3:0]);
155
156assign spick[3] = (sready[3]&!sready[1]&!sready[0]&lru[1]&!lru[0]) | (sready[3]
157 &!sready[2]&!sready[0]&!lru[1]&lru[0]) | (sready[3]&!sready[1]&!lru[2]
158 &!lru[0]) | (sready[3]&!sready[2]&!lru[3]&!lru[1]) | (sready[3]&!sready[2]
159 &!sready[1]&!lru[1]&!lru[0]) | (sready[3]&!sready[0]&!lru[7]&!lru[6]
160 &lru[5]&lru[4]) | (sready[3]&lru[7]&lru[6]) | (sready[3]&!sready[2]
161 &!sready[1]&!sready[0]);
162
163assign spick[2] = (!sready[3]&sready[2]&!sready[1]&!lru[1]&!lru[0]) | (sready[2]
164 &!sready[1]&!sready[0]&lru[1]&lru[0]) | (sready[2]&!sready[0]&lru[2]
165 &lru[0]) | (!sready[3]&sready[2]&!lru[3]&!lru[1]) | (!sready[3]&sready[2]
166 &!sready[0]&!lru[1]&lru[0]) | (sready[2]&!sready[1]&!lru[7]&lru[6]
167 &lru[5]&!lru[4]) | (sready[2]&lru[7]&!lru[6]) | (!sready[3]&sready[2]
168 &!sready[1]&!sready[0]);
169
170assign spick[1] = (!sready[3]&!sready[2]&sready[1]&!lru[1]&!lru[0]) | (!sready[2]
171 &sready[1]&!sready[0]&lru[1]&lru[0]) | (!sready[3]&sready[1]&!lru[2]
172 &!lru[0]) | (sready[1]&!sready[0]&lru[3]&lru[1]) | (!sready[3]&sready[1]
173 &!sready[0]&lru[1]&!lru[0]) | (!sready[2]&sready[1]&lru[7]&!lru[6]
174 &!lru[5]&lru[4]) | (sready[1]&!lru[7]&lru[6]) | (!sready[3]&!sready[2]
175 &sready[1]&!sready[0]);
176
177assign spick[0] = (!sready[3]&!sready[1]&sready[0]&lru[1]&!lru[0]) | (!sready[3]
178 &!sready[2]&sready[0]&!lru[1]&lru[0]) | (!sready[2]&sready[0]&lru[2]
179 &lru[0]) | (!sready[1]&sready[0]&lru[3]&lru[1]) | (!sready[2]&!sready[1]
180 &sready[0]&lru[1]&lru[0]) | (!sready[3]&sready[0]&lru[7]&lru[6]&!lru[5]
181 &!lru[4]) | (sready[0]&!lru[7]&!lru[6]) | (!sready[3]&!sready[2]
182 &!sready[1]&sready[0]);
183
184assign ipick[3:0] = ({4{nspick_sel}} & nspick[3:0]) |
185 ({4{~nspick_sel}} & spick[3:0]);
186
187assign pku_raw_pick_p[3:0] = ipick[3:0];
188
189// lru is msb pair of the lru vector
190assign nlru[7] = (ipick[0]&!lru[6]&lru[5]) | (ipick[1]&lru[6]&lru[5]) | (!lru[3]
191 &!lru[1]) | (!ipick[2]&lru[7]&!lru[6]) | (!ipick[3]&lru[7]&lru[6]);
192
193assign nlru[6] = (ipick[0]&!lru[7]&lru[4]) | (ipick[2]&lru[7]&lru[4]) | (!lru[2]
194 &!lru[0]) | (!ipick[1]&!lru[7]&lru[6]) | (!ipick[3]&lru[7]&lru[6]);
195
196assign nlru[5] = (!ipick[3]&!ipick[0]&lru[5]&lru[4]&lru[2]&lru[1]) | (ipick[0]
197 &!lru[1]&lru[0]) | (ipick[1]&lru[3]&lru[1]) | (ipick[3]&lru[3]&!lru[2]
198 &!lru[1]) | (ipick[0]&!lru[7]&lru[3]) | (ipick[2]&lru[3]&lru[2]&!lru[1]) | (
199 ipick[1]&lru[3]&!lru[0]) | (!ipick[2]&!ipick[0]&!lru[7]&lru[5]&!lru[4]
200 &lru[2]) | (!ipick[3]&!ipick[1]&!lru[7]&lru[5]&lru[4]&!lru[2]) | (
201 !ipick[2]&!ipick[1]&!lru[7]&lru[5]&!lru[2]&lru[0]) | (!ipick[3]&!ipick[2]
202 &lru[5]&!lru[1]);
203
204assign nlru[4] = (ipick[0]&lru[1]&!lru[0]) | (ipick[2]&lru[2]&lru[0]) | (!ipick[3]
205 &!ipick[2]&lru[4]&!lru[3]&!lru[1]) | (ipick[3]&!lru[3]&lru[2]&!lru[0]) | (
206 ipick[0]&!lru[6]&lru[2]) | (ipick[1]&lru[3]&lru[2]&!lru[0]) | (ipick[2]
207 &lru[2]&!lru[1]) | (!ipick[3]&!ipick[0]&!lru[7]&!lru[6]&lru[5]&lru[4]) | (
208 !ipick[1]&!ipick[0]&!lru[6]&!lru[5]&lru[4]&lru[3]) | (!ipick[2]&!ipick[1]
209 &!lru[6]&lru[4]&!lru[3]&lru[1]) | (!ipick[3]&!ipick[1]&lru[4]&!lru[0]);
210
211assign nlru[3] = (ipick[3]&lru[1]&!lru[0]) | (ipick[2]&lru[1]&lru[0]) | (!ipick[3]
212 &!ipick[2]&!ipick[1]&lru[3]&!lru[0]) | (!ipick[3]&!ipick[2]&!ipick[0]
213 &lru[3]&lru[0]) | (ipick[1]&lru[1]) | (ipick[0]&lru[1]) | (lru[3]
214 &lru[1]);
215
216assign nlru[2] = (ipick[3]&!lru[1]&lru[0]) | (ipick[1]&lru[1]&lru[0]) | (lru[2]
217 &lru[0]) | (!ipick[3]&!ipick[2]&!ipick[1]&lru[2]&!lru[1]) | (!ipick[3]
218 &!ipick[1]&!ipick[0]&lru[2]&lru[1]) | (ipick[2]&lru[0]) | (ipick[0]
219 &lru[0]);
220
221assign nlru[1] = (!ipick[1]&!ipick[0]&lru[1]) | (ipick[3]) | (ipick[2]);
222
223assign nlru[0] = (!ipick[2]&!ipick[0]&lru[0]) | (ipick[3]) | (ipick[1]);
224
225// only update the lru with the actual pick signals
226assign any_pick = |pku_pick_p[3:0];
227
228assign real_nlru_in[7:0] = ({8{any_pick}} & {nlru[7],nlru[6],nlru[5],~nlru[4],~nlru[3],nlru[2],~nlru[1],~nlru[0]}) |
229 ({8{!any_pick}} & lru_out[7:0]);
230
231pku_pck_ctl_msff_ctl_macro__width_8 lruf (
232 .scan_in(lruf_scanin),
233 .scan_out(lruf_scanout),
234 .l1clk(l1clk_pm1),
235 .din (real_nlru_in[7:0]),
236 .dout (lru_out[7:0]),
237 .siclk(siclk),
238 .soclk(soclk)
239);
240assign lru[7:0] = {lru_out[7],lru_out[6],lru_out[5],~lru_out[4],~lru_out[3],lru_out[2],~lru_out[1],~lru_out[0]};
241
242
243supply0 vss;
244supply1 vdd;
245// fixscan start:
246assign spares_scanin = scan_in ;
247assign lruf_scanin = spares_scanout ;
248assign scan_out = lruf_scanout ;
249// fixscan end:
250endmodule
251
252
253
254
255
256
257// any PARAMS parms go into naming of macro
258
259module pku_pck_ctl_l1clkhdr_ctl_macro (
260 l2clk,
261 l1en,
262 pce_ov,
263 stop,
264 se,
265 l1clk);
266
267
268 input l2clk;
269 input l1en;
270 input pce_ov;
271 input stop;
272 input se;
273 output l1clk;
274
275
276
277
278
279cl_sc1_l1hdr_8x c_0 (
280
281
282 .l2clk(l2clk),
283 .pce(l1en),
284 .l1clk(l1clk),
285 .se(se),
286 .pce_ov(pce_ov),
287 .stop(stop)
288);
289
290
291
292endmodule
293
294
295
296
297
298
299
300
301
302// Description: Spare gate macro for control blocks
303//
304// Param num controls the number of times the macro is added
305// flops=0 can be used to use only combination spare logic
306
307
308module pku_pck_ctl_spare_ctl_macro__num_1 (
309 l1clk,
310 scan_in,
311 siclk,
312 soclk,
313 scan_out);
314wire si_0;
315wire so_0;
316wire spare0_flop_unused;
317wire spare0_buf_32x_unused;
318wire spare0_nand3_8x_unused;
319wire spare0_inv_8x_unused;
320wire spare0_aoi22_4x_unused;
321wire spare0_buf_8x_unused;
322wire spare0_oai22_4x_unused;
323wire spare0_inv_16x_unused;
324wire spare0_nand2_16x_unused;
325wire spare0_nor3_4x_unused;
326wire spare0_nand2_8x_unused;
327wire spare0_buf_16x_unused;
328wire spare0_nor2_16x_unused;
329wire spare0_inv_32x_unused;
330
331
332input l1clk;
333input scan_in;
334input siclk;
335input soclk;
336output scan_out;
337
338cl_sc1_msff_8x spare0_flop (.l1clk(l1clk),
339 .siclk(siclk),
340 .soclk(soclk),
341 .si(si_0),
342 .so(so_0),
343 .d(1'b0),
344 .q(spare0_flop_unused));
345assign si_0 = scan_in;
346
347cl_u1_buf_32x spare0_buf_32x (.in(1'b1),
348 .out(spare0_buf_32x_unused));
349cl_u1_nand3_8x spare0_nand3_8x (.in0(1'b1),
350 .in1(1'b1),
351 .in2(1'b1),
352 .out(spare0_nand3_8x_unused));
353cl_u1_inv_8x spare0_inv_8x (.in(1'b1),
354 .out(spare0_inv_8x_unused));
355cl_u1_aoi22_4x spare0_aoi22_4x (.in00(1'b1),
356 .in01(1'b1),
357 .in10(1'b1),
358 .in11(1'b1),
359 .out(spare0_aoi22_4x_unused));
360cl_u1_buf_8x spare0_buf_8x (.in(1'b1),
361 .out(spare0_buf_8x_unused));
362cl_u1_oai22_4x spare0_oai22_4x (.in00(1'b1),
363 .in01(1'b1),
364 .in10(1'b1),
365 .in11(1'b1),
366 .out(spare0_oai22_4x_unused));
367cl_u1_inv_16x spare0_inv_16x (.in(1'b1),
368 .out(spare0_inv_16x_unused));
369cl_u1_nand2_16x spare0_nand2_16x (.in0(1'b1),
370 .in1(1'b1),
371 .out(spare0_nand2_16x_unused));
372cl_u1_nor3_4x spare0_nor3_4x (.in0(1'b0),
373 .in1(1'b0),
374 .in2(1'b0),
375 .out(spare0_nor3_4x_unused));
376cl_u1_nand2_8x spare0_nand2_8x (.in0(1'b1),
377 .in1(1'b1),
378 .out(spare0_nand2_8x_unused));
379cl_u1_buf_16x spare0_buf_16x (.in(1'b1),
380 .out(spare0_buf_16x_unused));
381cl_u1_nor2_16x spare0_nor2_16x (.in0(1'b0),
382 .in1(1'b0),
383 .out(spare0_nor2_16x_unused));
384cl_u1_inv_32x spare0_inv_32x (.in(1'b1),
385 .out(spare0_inv_32x_unused));
386assign scan_out = so_0;
387
388
389
390endmodule
391
392
393
394
395
396
397// any PARAMS parms go into naming of macro
398
399module pku_pck_ctl_msff_ctl_macro__width_8 (
400 din,
401 l1clk,
402 scan_in,
403 siclk,
404 soclk,
405 dout,
406 scan_out);
407wire [7:0] fdin;
408wire [6:0] so;
409
410 input [7:0] din;
411 input l1clk;
412 input scan_in;
413
414
415 input siclk;
416 input soclk;
417
418 output [7:0] dout;
419 output scan_out;
420assign fdin[7:0] = din[7:0];
421
422
423
424
425
426
427dff #(8) d0_0 (
428.l1clk(l1clk),
429.siclk(siclk),
430.soclk(soclk),
431.d(fdin[7:0]),
432.si({scan_in,so[6:0]}),
433.so({so[6:0],scan_out}),
434.q(dout[7:0])
435);
436
437
438
439
440
441
442
443
444
445
446
447
448endmodule
449
450
451
452
453
454
455
456