Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / mcu / rtl / mcu_ucbout_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: mcu_ucbout_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 mcu_ucbout_ctl (
36 l1clk,
37 scan_in,
38 scan_out,
39 tcu_aclk,
40 tcu_bclk,
41 tcu_scan_en,
42 vld,
43 data,
44 stall,
45 outdata_buf_busy,
46 outdata_buf_in,
47 outdata_vec_in,
48 outdata_buf_wr);
49wire siclk;
50wire soclk;
51wire se;
52wire stall_d1_ff_scanin;
53wire stall_d1_ff_scanout;
54wire outdata_vec_ff_scanin;
55wire outdata_vec_ff_scanout;
56wire outdata_buf_ff_scanin;
57wire outdata_buf_ff_scanout;
58
59
60
61//parameter UCB_BUS_WIDTH = 4;
62//parameter REG_WIDTH = 64; // maximum data bits that needs to
63 // be sent. Set to 64 or 128
64
65// Globals
66input l1clk;
67input scan_in;
68output scan_out;
69input tcu_aclk;
70input tcu_bclk;
71input tcu_scan_en;
72
73
74// UCB bus interface
75output vld;
76output [3:0] data;
77input stall;
78
79
80// Local interface
81output outdata_buf_busy;
82input [127:0] outdata_buf_in;
83input [31:0] outdata_vec_in;
84input outdata_buf_wr;
85
86
87// Local signals
88wire stall_d1;
89wire [31:0] outdata_vec;
90wire [31:0] outdata_vec_next;
91wire [127:0] outdata_buf;
92wire [127:0] outdata_buf_next;
93wire load_outdata;
94wire shift_outdata;
95
96////////////////////////////////////////////////////////////////////////
97// Code starts here
98////////////////////////////////////////////////////////////////////////
99
100// Scan reassigns
101assign siclk = tcu_aclk;
102assign soclk = tcu_bclk;
103assign se = tcu_scan_en;
104
105/************************************************************
106 * UCB bus interface flops
107 ************************************************************/
108assign vld = outdata_vec[0];
109assign data = outdata_buf[3:0];
110
111mcu_ucbout_ctl_msff_ctl_macro__width_1 stall_d1_ff (
112 .scan_in(stall_d1_ff_scanin),
113 .scan_out(stall_d1_ff_scanout),
114 .din(stall),
115 .l1clk(l1clk),
116 .dout(stall_d1),
117 .siclk(siclk),
118 .soclk(soclk));
119
120
121/************************************************************
122 * Outbound Data
123 ************************************************************/
124// accept new data only if there is none being processed
125assign load_outdata = outdata_buf_wr & ~outdata_buf_busy;
126
127assign outdata_buf_busy = outdata_vec[0] | stall_d1;
128
129assign shift_outdata = outdata_vec[0] & ~stall_d1;
130
131assign outdata_vec_next =
132 load_outdata ? outdata_vec_in:
133 shift_outdata ? outdata_vec >> 1:
134 outdata_vec;
135
136mcu_ucbout_ctl_msff_ctl_macro__width_32 outdata_vec_ff (
137 .scan_in(outdata_vec_ff_scanin),
138 .scan_out(outdata_vec_ff_scanout),
139 .din(outdata_vec_next),
140 .l1clk(l1clk),
141 .dout(outdata_vec),
142 .siclk(siclk),
143 .soclk(soclk));
144
145assign outdata_buf_next =
146 load_outdata ? outdata_buf_in:
147 shift_outdata ? (outdata_buf >> 4):
148 outdata_buf;
149
150mcu_ucbout_ctl_msff_ctl_macro__width_128 outdata_buf_ff (
151 .scan_in(outdata_buf_ff_scanin),
152 .scan_out(outdata_buf_ff_scanout),
153 .din(outdata_buf_next),
154 .l1clk(l1clk),
155 .dout(outdata_buf),
156 .siclk(siclk),
157 .soclk(soclk));
158
159
160// fixscan start:
161assign stall_d1_ff_scanin = scan_in ;
162assign outdata_vec_ff_scanin = stall_d1_ff_scanout ;
163assign outdata_buf_ff_scanin = outdata_vec_ff_scanout ;
164assign scan_out = outdata_buf_ff_scanout ;
165// fixscan end:
166endmodule
167
168
169
170
171
172
173
174
175
176
177
178
179// any PARAMS parms go into naming of macro
180
181module mcu_ucbout_ctl_msff_ctl_macro__width_1 (
182 din,
183 l1clk,
184 scan_in,
185 siclk,
186 soclk,
187 dout,
188 scan_out);
189wire [0:0] fdin;
190
191 input [0:0] din;
192 input l1clk;
193 input scan_in;
194
195
196 input siclk;
197 input soclk;
198
199 output [0:0] dout;
200 output scan_out;
201assign fdin[0:0] = din[0:0];
202
203
204
205
206
207
208dff #(1) d0_0 (
209.l1clk(l1clk),
210.siclk(siclk),
211.soclk(soclk),
212.d(fdin[0:0]),
213.si(scan_in),
214.so(scan_out),
215.q(dout[0:0])
216);
217
218
219
220
221
222
223
224
225
226
227
228
229endmodule
230
231
232
233
234
235
236
237
238
239
240
241
242
243// any PARAMS parms go into naming of macro
244
245module mcu_ucbout_ctl_msff_ctl_macro__width_32 (
246 din,
247 l1clk,
248 scan_in,
249 siclk,
250 soclk,
251 dout,
252 scan_out);
253wire [31:0] fdin;
254wire [30:0] so;
255
256 input [31:0] din;
257 input l1clk;
258 input scan_in;
259
260
261 input siclk;
262 input soclk;
263
264 output [31:0] dout;
265 output scan_out;
266assign fdin[31:0] = din[31:0];
267
268
269
270
271
272
273dff #(32) d0_0 (
274.l1clk(l1clk),
275.siclk(siclk),
276.soclk(soclk),
277.d(fdin[31:0]),
278.si({scan_in,so[30:0]}),
279.so({so[30:0],scan_out}),
280.q(dout[31:0])
281);
282
283
284
285
286
287
288
289
290
291
292
293
294endmodule
295
296
297
298
299
300
301
302
303
304
305
306
307
308// any PARAMS parms go into naming of macro
309
310module mcu_ucbout_ctl_msff_ctl_macro__width_128 (
311 din,
312 l1clk,
313 scan_in,
314 siclk,
315 soclk,
316 dout,
317 scan_out);
318wire [127:0] fdin;
319wire [126:0] so;
320
321 input [127:0] din;
322 input l1clk;
323 input scan_in;
324
325
326 input siclk;
327 input soclk;
328
329 output [127:0] dout;
330 output scan_out;
331assign fdin[127:0] = din[127:0];
332
333
334
335
336
337
338dff #(128) d0_0 (
339.l1clk(l1clk),
340.siclk(siclk),
341.soclk(soclk),
342.d(fdin[127:0]),
343.si({scan_in,so[126:0]}),
344.so({so[126:0],scan_out}),
345.q(dout[127:0])
346);
347
348
349
350
351
352
353
354
355
356
357
358
359endmodule
360
361
362
363
364
365
366
367