Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / spc / lsu / rtl / lsu_arc_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: lsu_arc_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 lsu_arc_ctl (
36 l2clk,
37 scan_in,
38 tcu_pce_ov,
39 tcu_scan_en,
40 spc_aclk,
41 spc_bclk,
42 scan_out,
43 ard_retl_ctl_1f,
44 ard_retl_vld_1f,
45 ard_retl_rd_1f,
46 ard_retl_tid_1f,
47 ard_retl_ack_1f,
48 ard_retl_exc_1f,
49 ard_retf_ctl_1f,
50 ard_retf_vld_1f,
51 ard_retf_rd_1f,
52 ard_retf_tid_1f,
53 ard_retf_ack_1f,
54 ard_retf_exc_1f,
55 lsu_asi_clken,
56 tlu_rngf_cdbus_error,
57 arc_retl_vld_2f,
58 arc_retf_vld_2f,
59 arc_sel_fast,
60 arc_pid_ctl_2f,
61 lsu_priv_action_g,
62 lsu_tid_g);
63wire se;
64wire pce_ov;
65wire stop;
66wire siclk;
67wire soclk;
68wire l1clk_pm1;
69wire arcl_retl_vld_1;
70wire [1:0] arcl_retl_exc_1;
71wire rngl_stg2_reg_scanin;
72wire rngl_stg2_reg_scanout;
73wire [1:0] arcl_retl_exc_2f;
74wire arcl_retl_rd_2f;
75wire [2:0] arcl_retl_tid_2f;
76wire [6:0] arcl_pidl_ctl_2;
77wire clr_local;
78wire [6:0] arcl_pidl_ctl_3f;
79wire rngl_stg3_reg_scanin;
80wire rngl_stg3_reg_scanout;
81wire arcl_retf_vld_1;
82wire [1:0] arcl_retf_exc_1;
83wire rngf_stg2_reg_scanin;
84wire rngf_stg2_reg_scanout;
85wire [1:0] arcl_retf_exc_2f;
86wire arcl_retf_rd_2f;
87wire [2:0] arcl_retf_tid_2f;
88wire rngf_error_2f;
89wire [6:0] arcl_pidf_ctl_2;
90wire clr_fast;
91wire [6:0] arcl_pidf_ctl_3f;
92wire rngf_stg3_reg_scanin;
93wire rngf_stg3_reg_scanout;
94wire arc_sel_fast_2f;
95wire spares_scanin;
96wire spares_scanout;
97
98
99// globals
100input l2clk;
101input scan_in;
102input tcu_pce_ov; // scan signals
103input tcu_scan_en;
104input spc_aclk;
105input spc_bclk;
106output scan_out;
107
108input ard_retl_ctl_1f; // Control/Data bit from returning ring
109input ard_retl_vld_1f; // Valid/hold bit on returning ring
110input ard_retl_rd_1f; // rd/wrx bit on returning ring
111input [2:0] ard_retl_tid_1f; // Thread id on returning ring
112input ard_retl_ack_1f; // Ack bit returning on ring
113input [1:0] ard_retl_exc_1f; // Exception status returning on ring
114
115input ard_retf_ctl_1f; // Control/Data bit from returning ring
116input ard_retf_vld_1f; // Valid/hold bit on returning ring
117input ard_retf_rd_1f; // rd/wrx bit on returning ring
118input [2:0] ard_retf_tid_1f; // Thread id on returning ring
119input ard_retf_ack_1f; // Ack bit returning on ring
120input [1:0] ard_retf_exc_1f; // Exception status returning on ring
121
122input lsu_asi_clken;
123
124input tlu_rngf_cdbus_error;
125
126output arc_retl_vld_2f; // Valid data returned on the ring
127output arc_retf_vld_2f; // Valid data returned on the ring
128output arc_sel_fast; // select fast ring data
129
130output [6:0] arc_pid_ctl_2f;
131
132output lsu_priv_action_g;
133output [2:0] lsu_tid_g;
134
135// scan renames
136assign se = tcu_scan_en;
137assign pce_ov = tcu_pce_ov;
138assign stop = 1'b0;
139assign siclk = spc_aclk;
140assign soclk = spc_bclk;
141// end scan
142
143////////////////////////////////////////////////////////
144lsu_arc_ctl_l1clkhdr_ctl_macro clkgen
145 (
146 .l2clk(l2clk),
147 .l1en (lsu_asi_clken ),
148 .l1clk(l1clk_pm1),
149 .pce_ov(pce_ov),
150 .stop(stop),
151 .se(se));
152////////////////////////////////////////////////////////
153
154
155
156////////////////////////////////////////////////////////////
157// Return data coming from the ring.
158// This comes over two cycles. Combine
159// into a single packet before returning.
160
161// local ring
162
163assign arcl_retl_vld_1 = ard_retl_ctl_1f & ard_retl_vld_1f;
164
165// clear exceptions if no ack bit
166assign arcl_retl_exc_1[1:0] = {ard_retl_ack_1f & ard_retl_exc_1f[1],
167 ard_retl_ack_1f & ard_retl_exc_1f[0]};
168
169
170// Another staging register for the control bits.
171lsu_arc_ctl_msff_ctl_macro__width_7 rngl_stg2_reg
172(
173 .scan_in(rngl_stg2_reg_scanin),
174 .scan_out(rngl_stg2_reg_scanout),
175 .l1clk(l1clk_pm1),
176 .din ({arcl_retl_vld_1,arcl_retl_exc_1[1:0],ard_retl_rd_1f,ard_retl_tid_1f[2:0]}),
177 .dout ({arc_retl_vld_2f,arcl_retl_exc_2f[1:0],arcl_retl_rd_2f,arcl_retl_tid_2f[2:0]}),
178 .siclk(siclk),
179 .soclk(soclk)
180 );
181
182// stage the control bits for 1 more cycle to align it with output register
183// which holds data being returned to pid
184// This is the output register and is loaded only when valid
185// control is set in stage2. This can happen at the most every
186// other cycle.
187assign arcl_pidl_ctl_2[6:0] = ({7 { arc_retl_vld_2f}} & {arc_retl_vld_2f,arcl_retl_exc_2f[1:0],arcl_retl_rd_2f,arcl_retl_tid_2f[2:0]}) |
188 ({7 {~arc_retl_vld_2f & ~clr_local}} & arcl_pidl_ctl_3f[6:0]);
189
190lsu_arc_ctl_msff_ctl_macro__width_7 rngl_stg3_reg
191(
192 .scan_in(rngl_stg3_reg_scanin),
193 .scan_out(rngl_stg3_reg_scanout),
194 .l1clk(l1clk_pm1),
195 .din (arcl_pidl_ctl_2[6:0]),
196 .dout(arcl_pidl_ctl_3f[6:0]),
197 .siclk(siclk),
198 .soclk(soclk)
199 );
200
201// Fast ring
202assign arcl_retf_vld_1 = ard_retf_ctl_1f & ard_retf_vld_1f;
203// clear exceptions if no ack bit
204assign arcl_retf_exc_1[1:0] = {ard_retf_ack_1f & ard_retf_exc_1f[1],
205 ard_retf_ack_1f & ard_retf_exc_1f[0]};
206
207
208// Another staging register for the control bits.
209lsu_arc_ctl_msff_ctl_macro__width_8 rngf_stg2_reg
210(
211 .scan_in(rngf_stg2_reg_scanin),
212 .scan_out(rngf_stg2_reg_scanout),
213 .l1clk(l1clk_pm1),
214 .din ({arcl_retf_vld_1,arcl_retf_exc_1[1:0],ard_retf_rd_1f,ard_retf_tid_1f[2:0],tlu_rngf_cdbus_error}),
215 .dout ({arc_retf_vld_2f,arcl_retf_exc_2f[1:0],arcl_retf_rd_2f,arcl_retf_tid_2f[2:0],rngf_error_2f}),
216 .siclk(siclk),
217 .soclk(soclk)
218 );
219
220// stage the control bits for 1 more cycle to align it with
221// data being returned to pid.
222// This is the output register and is loaded only when valid
223// control is set in stage2. This can happen at the most every
224// other cycle.
225// Set Fast bit (bit 4)
226
227assign arcl_pidf_ctl_2[6:0] =
228 ({7 { arc_retf_vld_2f}} & {arc_retf_vld_2f,arcl_retf_exc_2f[1],(arcl_retf_exc_2f[0] | rngf_error_2f),
229 arcl_retf_rd_2f,arcl_retf_tid_2f[2:0]}) |
230 ({7 {~arc_retf_vld_2f & !clr_fast}} & arcl_pidf_ctl_3f[6:0]);
231
232lsu_arc_ctl_msff_ctl_macro__width_7 rngf_stg3_reg
233(
234 .scan_in(rngf_stg3_reg_scanin),
235 .scan_out(rngf_stg3_reg_scanout),
236 .l1clk(l1clk_pm1),
237 .din (arcl_pidf_ctl_2[6:0]),
238 .dout(arcl_pidf_ctl_3f[6:0]),
239 .siclk(siclk),
240 .soclk(soclk)
241 );
242
243// mux between the two output registers (fast and local). Give priority to the fast register.
244// Once valid pkt is sent to pid, clear the corresponding output register.
245// sel_fast if fast packet is valid (bit 7)
246
247assign arc_sel_fast_2f = arcl_pidf_ctl_2[6];
248assign arc_pid_ctl_2f[6:0] = arc_sel_fast_2f ? arcl_pidf_ctl_2[6:0]: arcl_pidl_ctl_2[6:0];
249
250assign arc_sel_fast = arcl_pidf_ctl_3f[6];
251assign clr_fast = arc_sel_fast;
252assign clr_local = !arc_sel_fast & arcl_pidl_ctl_3f[6];
253
254assign lsu_priv_action_g = arc_pid_ctl_2f[6] & arc_pid_ctl_2f[5] & ~arc_pid_ctl_2f[4];
255assign lsu_tid_g[2:0] = arc_pid_ctl_2f[2:0];
256
257lsu_arc_ctl_spare_ctl_macro spares (
258 .scan_in(spares_scanin),
259 .scan_out(spares_scanout),
260 .l1clk (l1clk_pm1),
261 .siclk(siclk),
262 .soclk(soclk)
263);
264
265supply0 vss;
266supply1 vdd;
267// fixscan start:
268assign rngl_stg2_reg_scanin = scan_in ;
269assign rngl_stg3_reg_scanin = rngl_stg2_reg_scanout ;
270assign rngf_stg2_reg_scanin = rngl_stg3_reg_scanout ;
271assign rngf_stg3_reg_scanin = rngf_stg2_reg_scanout ;
272assign spares_scanin = rngf_stg3_reg_scanout ;
273assign scan_out = spares_scanout ;
274// fixscan end:
275endmodule
276
277
278
279
280
281
282
283// any PARAMS parms go into naming of macro
284
285module lsu_arc_ctl_l1clkhdr_ctl_macro (
286 l2clk,
287 l1en,
288 pce_ov,
289 stop,
290 se,
291 l1clk);
292
293
294 input l2clk;
295 input l1en;
296 input pce_ov;
297 input stop;
298 input se;
299 output l1clk;
300
301
302
303
304
305cl_sc1_l1hdr_8x c_0 (
306
307
308 .l2clk(l2clk),
309 .pce(l1en),
310 .l1clk(l1clk),
311 .se(se),
312 .pce_ov(pce_ov),
313 .stop(stop)
314);
315
316
317
318endmodule
319
320
321
322
323
324
325
326
327
328
329
330
331
332// any PARAMS parms go into naming of macro
333
334module lsu_arc_ctl_msff_ctl_macro__width_7 (
335 din,
336 l1clk,
337 scan_in,
338 siclk,
339 soclk,
340 dout,
341 scan_out);
342wire [6:0] fdin;
343wire [5:0] so;
344
345 input [6:0] din;
346 input l1clk;
347 input scan_in;
348
349
350 input siclk;
351 input soclk;
352
353 output [6:0] dout;
354 output scan_out;
355assign fdin[6:0] = din[6:0];
356
357
358
359
360
361
362dff #(7) d0_0 (
363.l1clk(l1clk),
364.siclk(siclk),
365.soclk(soclk),
366.d(fdin[6:0]),
367.si({scan_in,so[5:0]}),
368.so({so[5:0],scan_out}),
369.q(dout[6:0])
370);
371
372
373
374
375
376
377
378
379
380
381
382
383endmodule
384
385
386
387
388
389
390
391
392
393
394
395
396
397// any PARAMS parms go into naming of macro
398
399module lsu_arc_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
457
458// Description: Spare gate macro for control blocks
459//
460// Param num controls the number of times the macro is added
461// flops=0 can be used to use only combination spare logic
462
463
464module lsu_arc_ctl_spare_ctl_macro (
465 l1clk,
466 scan_in,
467 siclk,
468 soclk,
469 scan_out);
470wire si_0;
471wire so_0;
472wire spare0_flop_unused;
473wire spare0_buf_32x_unused;
474wire spare0_nand3_8x_unused;
475wire spare0_inv_8x_unused;
476wire spare0_aoi22_4x_unused;
477wire spare0_buf_8x_unused;
478wire spare0_oai22_4x_unused;
479wire spare0_inv_16x_unused;
480wire spare0_nand2_16x_unused;
481wire spare0_nor3_4x_unused;
482wire spare0_nand2_8x_unused;
483wire spare0_buf_16x_unused;
484wire spare0_nor2_16x_unused;
485wire spare0_inv_32x_unused;
486
487
488input l1clk;
489input scan_in;
490input siclk;
491input soclk;
492output scan_out;
493
494cl_sc1_msff_8x spare0_flop (.l1clk(l1clk),
495 .siclk(siclk),
496 .soclk(soclk),
497 .si(si_0),
498 .so(so_0),
499 .d(1'b0),
500 .q(spare0_flop_unused));
501assign si_0 = scan_in;
502
503cl_u1_buf_32x spare0_buf_32x (.in(1'b1),
504 .out(spare0_buf_32x_unused));
505cl_u1_nand3_8x spare0_nand3_8x (.in0(1'b1),
506 .in1(1'b1),
507 .in2(1'b1),
508 .out(spare0_nand3_8x_unused));
509cl_u1_inv_8x spare0_inv_8x (.in(1'b1),
510 .out(spare0_inv_8x_unused));
511cl_u1_aoi22_4x spare0_aoi22_4x (.in00(1'b1),
512 .in01(1'b1),
513 .in10(1'b1),
514 .in11(1'b1),
515 .out(spare0_aoi22_4x_unused));
516cl_u1_buf_8x spare0_buf_8x (.in(1'b1),
517 .out(spare0_buf_8x_unused));
518cl_u1_oai22_4x spare0_oai22_4x (.in00(1'b1),
519 .in01(1'b1),
520 .in10(1'b1),
521 .in11(1'b1),
522 .out(spare0_oai22_4x_unused));
523cl_u1_inv_16x spare0_inv_16x (.in(1'b1),
524 .out(spare0_inv_16x_unused));
525cl_u1_nand2_16x spare0_nand2_16x (.in0(1'b1),
526 .in1(1'b1),
527 .out(spare0_nand2_16x_unused));
528cl_u1_nor3_4x spare0_nor3_4x (.in0(1'b0),
529 .in1(1'b0),
530 .in2(1'b0),
531 .out(spare0_nor3_4x_unused));
532cl_u1_nand2_8x spare0_nand2_8x (.in0(1'b1),
533 .in1(1'b1),
534 .out(spare0_nand2_8x_unused));
535cl_u1_buf_16x spare0_buf_16x (.in(1'b1),
536 .out(spare0_buf_16x_unused));
537cl_u1_nor2_16x spare0_nor2_16x (.in0(1'b0),
538 .in1(1'b0),
539 .out(spare0_nor2_16x_unused));
540cl_u1_inv_32x spare0_inv_32x (.in(1'b1),
541 .out(spare0_inv_32x_unused));
542assign scan_out = so_0;
543
544
545
546endmodule
547