Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / db1 / rtl / db1_ucbbusout4_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: db1_ucbbusout4_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 ============================================
35`define UCB_BUS_WIDTH 4
36`define UCB_BUS_WIDTH_M1 3
37`define CYC_NUM 32
38`define CYC_NUM_M1 31
39
40module db1_ucbbusout4_ctl (
41 iol2clk,
42 scan_in,
43 scan_out,
44 tcu_pce_ov,
45 tcu_clk_stop,
46 tcu_aclk,
47 tcu_bclk,
48 tcu_scan_en,
49 vld,
50 data,
51 stall,
52 outdata_buf_busy,
53 outdata_buf_in,
54 outdata_vec_in,
55 outdata_buf_wr) ;
56wire [31:0] outdata_vec;
57wire [127:0] outdata_buf;
58wire stall_d1_ff_scanin;
59wire stall_d1_ff_scanout;
60wire stall_d1;
61wire l1clk;
62wire load_outdata;
63wire shift_outdata;
64wire [31:0] outdata_vec_next;
65wire outdata_vec_ff_scanin;
66wire outdata_vec_ff_scanout;
67wire [127:0] outdata_buf_next;
68wire outdata_buf_ff_scanin;
69wire outdata_buf_ff_scanout;
70wire siclk;
71wire soclk;
72wire pce_ov;
73wire stop;
74wire se;
75
76
77// Globals
78input iol2clk;
79input scan_in;
80output scan_out;
81input tcu_pce_ov;
82input tcu_clk_stop;
83input tcu_aclk ;
84input tcu_bclk ;
85input tcu_scan_en ;
86
87// UCB bus interface
88output vld;
89output [`UCB_BUS_WIDTH_M1 :0] data;
90input stall;
91
92// Local interface
93output outdata_buf_busy;
94input [127:0] outdata_buf_in;
95input [`CYC_NUM_M1 :0] outdata_vec_in;
96input outdata_buf_wr;
97
98// Local signals
99
100////////////////////////////////////////////////////////////////////////
101// Code starts here
102////////////////////////////////////////////////////////////////////////
103/************************************************************
104 * UCB bus interface flops
105 ************************************************************/
106assign vld = outdata_vec[0];
107assign data[`UCB_BUS_WIDTH_M1 :0] = outdata_buf[`UCB_BUS_WIDTH_M1 :0];
108
109db1_ucbbusout4_ctl_msff_ctl_macro__width_1 stall_d1_ff
110 (
111 .scan_in(stall_d1_ff_scanin),
112 .scan_out(stall_d1_ff_scanout),
113 .dout (stall_d1),
114 .l1clk (l1clk),
115 .din (stall),
116 .siclk(siclk),
117 .soclk(soclk)
118 );
119
120/************************************************************
121 * Outbound Data
122 ************************************************************/
123// accept new data only if there is none being processed
124assign load_outdata = outdata_buf_wr & ~outdata_buf_busy;
125
126assign outdata_buf_busy = outdata_vec[0] | stall_d1;
127
128assign shift_outdata = outdata_vec[0] & ~stall_d1;
129
130assign outdata_vec_next[`CYC_NUM_M1 :0] =
131 load_outdata ? outdata_vec_in[`CYC_NUM_M1 :0] :
132 shift_outdata ? {1'b0,outdata_vec[`CYC_NUM_M1 :1]} :
133 outdata_vec[`CYC_NUM_M1 :0] ;
134
135db1_ucbbusout4_ctl_msff_ctl_macro__width_32 outdata_vec_ff
136 (
137 .scan_in(outdata_vec_ff_scanin),
138 .scan_out(outdata_vec_ff_scanout),
139 .dout (outdata_vec[`CYC_NUM_M1 :0]),
140 .l1clk (l1clk),
141 .din (outdata_vec_next[`CYC_NUM_M1 :0]),
142 .siclk(siclk),
143 .soclk(soclk)
144 );
145
146assign outdata_buf_next[127:0] = load_outdata ? outdata_buf_in[127:0] :
147 shift_outdata ? (outdata_buf[127:0] >> `UCB_BUS_WIDTH ) :
148 outdata_buf[127:0] ;
149
150db1_ucbbusout4_ctl_msff_ctl_macro__width_128 outdata_buf_ff
151 (
152 .scan_in(outdata_buf_ff_scanin),
153 .scan_out(outdata_buf_ff_scanout),
154 .dout (outdata_buf[127:0]),
155 .l1clk (l1clk),
156 .din (outdata_buf_next[127:0]),
157 .siclk(siclk),
158 .soclk(soclk)
159 );
160
161
162
163/**** adding clock header ****/
164db1_ucbbusout4_ctl_l1clkhdr_ctl_macro clkgen (
165 .l2clk (iol2clk),
166 .l1en (1'b1),
167 .l1clk (l1clk),
168 .pce_ov(pce_ov),
169 .stop(stop),
170 .se(se)
171 );
172
173/*** building tcu port ***/
174assign siclk = tcu_aclk ;
175assign soclk = tcu_bclk ;
176assign pce_ov = tcu_pce_ov ;
177assign stop = tcu_clk_stop;
178// scan renames
179assign se = tcu_scan_en ;
180// end scan
181
182// fixscan start:
183assign stall_d1_ff_scanin = scan_in ;
184assign outdata_vec_ff_scanin = stall_d1_ff_scanout ;
185assign outdata_buf_ff_scanin = outdata_vec_ff_scanout ;
186assign scan_out = outdata_buf_ff_scanout ;
187// fixscan end:
188endmodule // ucb_bus_out
189
190
191
192
193
194
195// any PARAMS parms go into naming of macro
196
197module db1_ucbbusout4_ctl_msff_ctl_macro__width_1 (
198 din,
199 l1clk,
200 scan_in,
201 siclk,
202 soclk,
203 dout,
204 scan_out);
205wire [0:0] fdin;
206
207 input [0:0] din;
208 input l1clk;
209 input scan_in;
210
211
212 input siclk;
213 input soclk;
214
215 output [0:0] dout;
216 output scan_out;
217assign fdin[0:0] = din[0:0];
218
219
220
221
222
223
224dff #(1) d0_0 (
225.l1clk(l1clk),
226.siclk(siclk),
227.soclk(soclk),
228.d(fdin[0:0]),
229.si(scan_in),
230.so(scan_out),
231.q(dout[0:0])
232);
233
234
235
236
237
238
239
240
241
242
243
244
245endmodule
246
247
248
249
250
251
252
253
254
255
256
257
258
259// any PARAMS parms go into naming of macro
260
261module db1_ucbbusout4_ctl_msff_ctl_macro__width_32 (
262 din,
263 l1clk,
264 scan_in,
265 siclk,
266 soclk,
267 dout,
268 scan_out);
269wire [31:0] fdin;
270wire [30:0] so;
271
272 input [31:0] din;
273 input l1clk;
274 input scan_in;
275
276
277 input siclk;
278 input soclk;
279
280 output [31:0] dout;
281 output scan_out;
282assign fdin[31:0] = din[31:0];
283
284
285
286
287
288
289dff #(32) d0_0 (
290.l1clk(l1clk),
291.siclk(siclk),
292.soclk(soclk),
293.d(fdin[31:0]),
294.si({scan_in,so[30:0]}),
295.so({so[30:0],scan_out}),
296.q(dout[31:0])
297);
298
299
300
301
302
303
304
305
306
307
308
309
310endmodule
311
312
313
314
315
316
317
318
319
320
321
322
323
324// any PARAMS parms go into naming of macro
325
326module db1_ucbbusout4_ctl_msff_ctl_macro__width_128 (
327 din,
328 l1clk,
329 scan_in,
330 siclk,
331 soclk,
332 dout,
333 scan_out);
334wire [127:0] fdin;
335wire [126:0] so;
336
337 input [127:0] din;
338 input l1clk;
339 input scan_in;
340
341
342 input siclk;
343 input soclk;
344
345 output [127:0] dout;
346 output scan_out;
347assign fdin[127:0] = din[127:0];
348
349
350
351
352
353
354dff #(128) d0_0 (
355.l1clk(l1clk),
356.siclk(siclk),
357.soclk(soclk),
358.d(fdin[127:0]),
359.si({scan_in,so[126:0]}),
360.so({so[126:0],scan_out}),
361.q(dout[127:0])
362);
363
364
365
366
367
368
369
370
371
372
373
374
375endmodule
376
377
378
379
380
381
382
383
384
385
386
387
388
389// any PARAMS parms go into naming of macro
390
391module db1_ucbbusout4_ctl_l1clkhdr_ctl_macro (
392 l2clk,
393 l1en,
394 pce_ov,
395 stop,
396 se,
397 l1clk);
398
399
400 input l2clk;
401 input l1en;
402 input pce_ov;
403 input stop;
404 input se;
405 output l1clk;
406
407
408
409
410
411cl_sc1_l1hdr_8x c_0 (
412
413
414 .l2clk(l2clk),
415 .pce(l1en),
416 .l1clk(l1clk),
417 .se(se),
418 .pce_ov(pce_ov),
419 .stop(stop)
420);
421
422
423
424endmodule
425
426
427
428
429
430
431
432