Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / sio / rtl / sio_opcs_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: sio_opcs_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 sio_opcs_ctl (
36 iol2clk,
37 ncu_sio_ctag_cei,
38 ncu_sio_ctag_uei,
39 sibling_is_elder_flag,
40 sibling_ncu_ctag_ue,
41 sibling_ncu_ctag_ce,
42 sibling_ncu_d_pe,
43 opcs_ncu_ctag_ue,
44 opcs_ncu_ctag_ce,
45 opcs_ncu_d_pe,
46 opcs_new_opdhqx1,
47 opcs_new_opdhqx0,
48 opcc_opcs_opddqx0_wr_addr,
49 opcc_opcs_opddqx1_wr_addr,
50 opcc_opcs_opdhqx_wr_addr,
51 opdhqx_dout,
52 parity_result,
53 opcs_packet_flowmode_vld,
54 opcs_packet_ack_in,
55 tcu_scan_en,
56 scan_in,
57 tcu_aclk,
58 tcu_bclk,
59 tcu_pce_ov,
60 tcu_clk_stop,
61 tcu_dbr_gateoff,
62 opcs_opcc_opdhqx_rd_addr,
63 opcs_packet_req,
64 opcs_packet_datareq,
65 opcs_opddqx0_rd_addr,
66 opcs_opddqx1_rd_addr,
67 opcs_opdhqx_rd_addr,
68 opcs_opddqx0_rd_en,
69 opcs_opddqx1_rd_en,
70 opcs_opdhqx_rd_en,
71 opcs_opds_reloadhdr,
72 opcs_opds_selhdr,
73 scan_out);
74wire se;
75wire siclk;
76wire soclk;
77wire pce_ov;
78wire stop;
79wire l1clk;
80wire spares_scanin;
81wire spares_scanout;
82wire sio_ext_hdr_vld_l;
83wire arc_start_hdr;
84wire arc_start_hdrpayld;
85wire arc_data4_hdr;
86wire arc_data4_hdrpayld;
87wire arc_hdr_hdr;
88wire arc_hdr_hdrpayld;
89wire sio_ext_hdr_vld_r;
90wire sio_ext_datareq_l;
91wire [4:0] opcs_opdhqx_rd_addr_l;
92wire [4:0] opcs_opdhqx_rd_addr_r;
93wire [6:0] opcs_opddqx0_rd_addr_l;
94wire [6:0] opcs_opddqx1_rd_addr_l;
95wire data_inc;
96wire [6:0] opcs_opddqx0_rd_addr_r;
97wire hqempty;
98wire data_phase_en;
99wire [5:0] cmd;
100wire opdhq_e_bit;
101wire opcs_opds_ue;
102wire [5:0] hqctageccout;
103wire [15:0] hqtagout;
104wire myctag_ue;
105wire hdr_cycle;
106wire data_cycle;
107wire [7:0] cstate;
108wire myctag_ce;
109wire myd_pe;
110wire ncu_ctag_ue_l;
111wire ncu_ctag_ce_l;
112wire ncu_d_pe_l;
113wire [5:0] c;
114wire [15:0] id;
115wire opdhqx_ue_bit;
116wire [4:0] opcs_opcc_opdhqx_rd_addr_l;
117wire opdhqx_r_bit;
118wire valid;
119wire hq_almost_empty;
120wire del_hq_almost;
121wire pqempty;
122wire [6:0] opddqx0_wr_addr;
123wire [6:0] opddqx1_wr_addr;
124wire [6:0] opcs_opddqx1_rd_addr_r;
125wire [4:0] opdhqx_wr_addr;
126wire hq_almost_empty_r;
127wire arc_data3_data4;
128wire go;
129wire dq;
130wire [2:0] crd_cnt_r;
131wire [2:0] crd_cnt_l;
132wire [1:0] op;
133wire inc;
134wire [7:0] nstate;
135wire [7:0] cstate_r;
136wire valid_r;
137wire arc_hdr_no_c;
138wire reg_cstate_scanin;
139wire reg_cstate_scanout;
140wire reg_packet_req_scanin;
141wire reg_packet_req_scanout;
142wire reg_packet_datareq_scanin;
143wire reg_packet_datareq_scanout;
144wire reg_opddqx0_rd_addr_scanin;
145wire reg_opddqx0_rd_addr_scanout;
146wire reg_opddqx1_rd_addr_scanin;
147wire reg_opddqx1_rd_addr_scanout;
148wire reg_opdhqx_rd_addr_scanin;
149wire reg_opdhqx_rd_addr_scanout;
150wire reg_opcs_opcc_opdhqx_rd_addr_scanin;
151wire reg_opcs_opcc_opdhqx_rd_addr_scanout;
152wire reg_crd_cnt_scanin;
153wire reg_crd_cnt_scanout;
154wire reg_opdhqx_wr_addr_scanin;
155wire reg_opdhqx_wr_addr_scanout;
156wire reg_opddqx0_wr_addr_scanin;
157wire reg_opddqx0_wr_addr_scanout;
158wire reg_opddqx1_wr_addr_scanin;
159wire reg_opddqx1_wr_addr_scanout;
160wire reg_valid_scanin;
161wire reg_valid_scanout;
162wire reg_opdhqx_ue_bit_scanin;
163wire reg_opdhqx_ue_bit_scanout;
164wire opdhqx_ue_bit_r;
165wire reg_hq_almost_r_scanin;
166wire reg_hq_almost_r_scanout;
167wire reg_ncu_ctag_ue_scanin;
168wire reg_ncu_ctag_ue_scanout;
169wire reg_ncu_ctag_ce_scanin;
170wire reg_ncu_ctag_ce_scanout;
171wire reg_ncu_d_pe_scanin;
172wire reg_ncu_d_pe_scanout;
173
174
175 input iol2clk; // IO level 2 clock
176
177 // THESE SETS OF SIGNALS ARE FOR RAS -- TO NCU
178 input ncu_sio_ctag_cei;
179 input ncu_sio_ctag_uei;
180
181 // sibling opcs signals used only if sibling_is_elder_flag is FALSE for dmu=0, niu=1
182 input sibling_is_elder_flag;
183 input sibling_ncu_ctag_ue; // input from sibling opcs
184 input sibling_ncu_ctag_ce; // input from sibling opcs
185 input sibling_ncu_d_pe; // input from sibling opcs
186
187 output opcs_ncu_ctag_ue;
188 output opcs_ncu_ctag_ce;
189 output opcs_ncu_d_pe;
190
191 output [63:0] opcs_new_opdhqx1; // dataq -- valid on
192 output [63:0] opcs_new_opdhqx0; // dataq -- valid on
193
194 // THE ABOVE SETS OF SIGNALS ARE FOR RAS -- TO NCU
195 input [6:0] opcc_opcs_opddqx0_wr_addr; // dataq -- cmp domain synced, gray-coded + 1 bit
196 input [6:0] opcc_opcs_opddqx1_wr_addr; // dataq -- cmp domain synced, gray-coded + 1 bit
197 input [4:0] opcc_opcs_opdhqx_wr_addr; // hdrq -- cmp domain synced, gray-coded + 1 bit
198 input [31:0] opdhqx_dout;
199 input [7:0] parity_result;
200 input opcs_packet_flowmode_vld; // 1 = flow control mode is active - should be a static signal
201 input opcs_packet_ack_in; // if flowmode_vld=1, if count_vld, this is a release of a credit, otherwise, this means stop
202
203 //TCU related signals
204 input tcu_scan_en;
205 input scan_in;
206 input tcu_aclk;
207 input tcu_bclk;
208 input tcu_pce_ov;
209 input tcu_clk_stop;
210 input tcu_dbr_gateoff;
211
212 output [4:0] opcs_opcc_opdhqx_rd_addr; // hdrq -- io domain, gray-coded + 1 bit, valid on
213 output opcs_packet_req; // SIO requesting to send packet to IO
214 output opcs_packet_datareq; // SIO requesting to send packet w/data to IO
215 output [5:0] opcs_opddqx0_rd_addr; // dataq -- valid on
216 output [5:0] opcs_opddqx1_rd_addr; // dataq -- valid on
217 output [3:0] opcs_opdhqx_rd_addr; // hdrq -- valid on
218 output opcs_opddqx0_rd_en; // dataq -- valid on
219 output opcs_opddqx1_rd_en; // dataq -- valid on
220 output opcs_opdhqx_rd_en; // hdrq -- valid on
221 output opcs_opds_reloadhdr; // recircular the header
222 output opcs_opds_selhdr; // select header and data
223 output scan_out;
224
225 reg [7:0] nstate_r;
226 reg [5:0] e;
227 reg [5:0] p;
228 reg [15:0] newid;
229 reg [5:0] new_c;
230
231 ///////////////////////////////////////
232 // Scan chain connections
233 ///////////////////////////////////////
234 // scan renames
235 assign se = tcu_scan_en;
236 assign siclk = tcu_aclk;
237 assign soclk = tcu_bclk;
238 assign pce_ov = tcu_pce_ov;
239 assign stop = tcu_clk_stop;
240 // end scan
241
242 sio_opcs_ctl_l1clkhdr_ctl_macro clkgen (
243 .l2clk (iol2clk ),
244 .l1en (1'b1 ),
245 .l1clk (l1clk ),
246 .pce_ov(pce_ov),
247 .stop(stop),
248 .se(se)
249 );
250 // Spare gate
251 sio_opcs_ctl_spare_ctl_macro__num_2 spares (
252 .scan_in(spares_scanin),
253 .scan_out(spares_scanout),
254 .l1clk (l1clk),
255 .siclk(siclk),
256 .soclk(soclk)
257 );
258
259//************************************************************************
260// STATE DEFINITION
261//************************************************************************
262
263`define START_ST 8'b00000001
264`define HDR_ST 8'b00000010
265`define HDR_PAYLD_ST 8'b00000100
266`define DATA1_ST 8'b00001000
267`define DATA2_ST 8'b00010000
268`define DATA3_ST 8'b00100000
269`define DATA4_ST 8'b01000000
270`define NO_C_ST 8'b10000000
271
272`define START 0
273`define HDR 1
274`define HDR_PAYLD 2
275`define DATA1 3
276`define DATA2 4
277`define DATA3 5
278`define DATA4 6
279`define NO_C 7
280
281//************************************************************************
282// OUTPUT LOGICS
283//************************************************************************
284assign sio_ext_hdr_vld_l = arc_start_hdr || arc_start_hdrpayld || arc_data4_hdr ||
285 arc_data4_hdrpayld || arc_hdr_hdr || arc_hdr_hdrpayld ;
286
287assign opcs_packet_req = sio_ext_hdr_vld_r & ~tcu_dbr_gateoff;
288
289assign sio_ext_datareq_l = arc_start_hdrpayld || arc_hdr_hdrpayld ||
290 arc_data4_hdrpayld;
291
292assign opcs_opdhqx_rd_addr[3:0] = opcs_opdhqx_rd_addr_l[3:0];
293assign opcs_opdhqx_rd_addr_l[4:0] = sio_ext_hdr_vld_l ?
294
295 (opcs_opdhqx_rd_addr_r[4:0] + 5'h1) :
296 opcs_opdhqx_rd_addr_r[4:0];
297
298assign opcs_opddqx0_rd_addr[5:0] = opcs_opddqx0_rd_addr_l[5:0];
299assign opcs_opddqx1_rd_addr[5:0] = opcs_opddqx1_rd_addr_l[5:0];
300
301assign opcs_opddqx0_rd_addr_l[6:0] = data_inc ?
302 (opcs_opddqx0_rd_addr_r[6:0] + 7'h01 ) :
303 opcs_opddqx0_rd_addr_r[6:0];
304assign opcs_opddqx1_rd_addr_l[6:0] = opcs_opddqx0_rd_addr_l[6:0];
305
306assign opcs_opdhqx_rd_en = ~(hqempty);
307//assign opcs_opdhqx_rd_en = 1'b1;
308//assign opcs_opdhqx_rd_en = valid ;
309assign opcs_opddqx0_rd_en = data_phase_en;
310assign opcs_opddqx1_rd_en = data_phase_en;
311
312//assign opcs_new_opdhqx1[63:0] = {2'b00, hqctageccout[5:0], {56{1'b0}}};
313//assign opcs_new_opdhqx0[63:0] = {cmd[5:0], {39{1'b0}}, 1'b0, opdhq_e_bit, opcs_opds_ue, hqtagout[15:0]};
314
315assign opcs_new_opdhqx1[63:0] = {2'b00, new_c[5:0], {56{1'b0}}};
316assign opcs_new_opdhqx0[63:0] = {cmd[5:0], {39{1'b0}}, 1'b0, opdhq_e_bit, opcs_opds_ue, newid[15:0]};
317
318//assign out_ctag_ue = opcs_ncu_ctag_ue;
319//assign out_ctag_ce = opcs_ncu_ctag_ce;
320//assign out_d_pe = opcs_ncu_d_pe;
321
322//--------------------------------------------------------
323// New Header generation
324//--------------------------------------------------------
325
326assign hqctageccout[5:0] = opdhqx_dout[25:20];
327assign cmd[5:0] = {2'b10, opdhqx_dout[17], 3'b010};
328assign hqtagout[15:0] = ncu_sio_ctag_cei ? {opdhqx_dout[15:1], ~opdhqx_dout[0]} :
329 ncu_sio_ctag_uei ? {opdhqx_dout[15:2], ~opdhqx_dout[1], ~opdhqx_dout[0]} :
330 opdhqx_dout[15:0];
331assign opdhq_e_bit = opdhqx_dout[19] || myctag_ue ;
332
333//--------------------------------------------------------
334// RAS
335//--------------------------------------------------------
336
337assign hdr_cycle = arc_hdr_hdr || arc_start_hdr || arc_start_hdrpayld ||
338 arc_hdr_hdrpayld || arc_data4_hdr || arc_data4_hdrpayld;
339
340assign data_cycle = cstate[`HDR_PAYLD] || cstate[`DATA1] || cstate[`DATA2] || cstate[`DATA3] ;
341
342assign myctag_ue = |e[4:0] && (~e[5] || (e[4:0] > 5'd21)) && hdr_cycle && ~opdhqx_dout[19];
343assign myctag_ce = (e[4:0] <= 5'd21) && e[5] && hdr_cycle && ~opdhqx_dout[19] ;
344assign myd_pe = (|parity_result[7:0]) && data_cycle;
345
346assign ncu_ctag_ue_l = myctag_ue || (sibling_ncu_ctag_ue && ~sibling_is_elder_flag );
347assign ncu_ctag_ce_l = myctag_ce || (sibling_ncu_ctag_ce && ~sibling_is_elder_flag );
348assign ncu_d_pe_l = myd_pe || (sibling_ncu_d_pe && ~sibling_is_elder_flag );
349
350
351
352//----------------------------------------
353// CTAG ERROR CORRECTION AND CHECKING
354//----------------------------------------
355assign c[5:0] = hqctageccout[5:0];
356assign id[15:0] = hqtagout[15:0];
357
358always @ ( id[15:0] or c[5:0] )
359 begin
360
361 p[0] = id[0] ^ id[1] ^ id[3] ^ id[4] ^ id[6] ^ id[8] ^ id[10] ^ id[11] ^id[13] ^ id[15];
362 p[1] = id[0] ^ id[2] ^ id[3] ^ id[5] ^ id[6] ^ id[9] ^ id[10] ^ id[12] ^id[13] ;
363 p[2] = id[1] ^ id[2] ^ id[3] ^ id[7] ^ id[8] ^ id[9] ^ id[10] ^ id[14] ^id[15] ;
364 p[3] = id[4] ^ id[5] ^ id[6] ^ id[7] ^ id[8] ^ id[9] ^ id[10] ;
365 p[4] = id[11] ^ id[12] ^ id[13] ^ id[14] ^ id[15] ;
366 p[5] = id[0] ^ id[1] ^ id[2] ^ id[3] ^ id[4] ^ id[5] ^ id[6] ^ id[7] ^ id[8] ^ id[9] ^
367 id[10] ^ id[11] ^ id[12] ^ id[13] ^ id[14] ^id[15] ^ c[0] ^ c[1] ^ c[2] ^ c[3] ^ c[4];
368
369 e[0] = p[0] ^ c[0];
370 e[1] = p[1] ^ c[1];
371 e[2] = p[2] ^ c[2];
372 e[3] = p[3] ^ c[3];
373 e[4] = p[4] ^ c[4];
374 e[5] = p[5] ^ c[5];
375
376 new_c[5:0] = c[5:0];
377 newid[15:0] = id[15:0];
378
379 if (e[5])
380 begin
381 case (e[4:0]) //synopsys parallel_case
382 5'b00000 : new_c[5] = ~c[5];
383 5'b00001 : new_c[0] = ~c[0];
384 5'b00010 : new_c[1] = ~c[1];
385 5'b00011 : newid[0] = ~id[0];
386 5'b00100 : new_c[2] = ~c[2];
387 5'b00101 : newid[1] = ~id[1];
388 5'b00110 : newid[2] = ~id[2];
389 5'b00111 : newid[3] = ~id[3];
390 5'b01000 : new_c[3] = ~c[3];
391 5'b01001 : newid[4] = ~id[4];
392 5'b01010 : newid[5] = ~id[5];
393 5'b01011 : newid[6] = ~id[6];
394 5'b01100 : newid[7] = ~id[7];
395 5'b01101 : newid[8] = ~id[8];
396 5'b01110 : newid[9] = ~id[9];
397 5'b01111 : newid[10] = ~id[10];
398 5'b10000 : new_c[4] = ~c[4];
399 5'b10001 : newid[11] = ~id[11];
400 5'b10010 : newid[12] = ~id[12];
401 5'b10011 : newid[13] = ~id[13];
402 5'b10100 : newid[14] = ~id[14];
403 5'b10101 : newid[15] = ~id[15];
404 default : ;
405 endcase
406 end
407
408 end
409
410
411assign opcs_opds_ue = opdhqx_ue_bit;
412assign opcs_opcc_opdhqx_rd_addr_l[4:0] = opcs_packet_req ? opcs_opdhqx_rd_addr_r[4:0] - 5'h01
413 : opcs_opcc_opdhqx_rd_addr[4:0];
414assign opcs_opds_reloadhdr = 1'b0 ; // recircular the header ???
415assign opcs_opds_selhdr= sio_ext_hdr_vld_l;
416
417//************************************************************************
418// INTERNAL LOCIGS
419//************************************************************************
420assign opdhqx_r_bit = opdhqx_dout[17];
421assign opdhqx_ue_bit = opdhqx_dout[16];
422assign valid = ~((hq_almost_empty && del_hq_almost) || hqempty) && ~(opdhqx_r_bit && pqempty );
423assign pqempty = (opddqx0_wr_addr[6:2] == opcs_opddqx0_rd_addr_r[6:2]) ||
424 (opddqx1_wr_addr[6:2] == opcs_opddqx1_rd_addr_r[6:2]);
425assign hqempty = (opdhqx_wr_addr[4:0] == opcs_opdhqx_rd_addr_r[4:0]);
426assign hq_almost_empty = ((opdhqx_wr_addr[4:0] - opcs_opdhqx_rd_addr_r[4:0]) == 5'b01) ||
427 ((opcs_opdhqx_rd_addr_r[4:0] - opdhqx_wr_addr[4:0]) == 5'b01);
428assign del_hq_almost = hq_almost_empty_r && ~hqempty && ~hq_almost_empty;
429
430// same cycle as header, since the data memory come out 1 cycle late
431assign data_inc = arc_start_hdrpayld || arc_hdr_hdrpayld ||
432 arc_data4_hdrpayld ||
433// (cstate[`NO_C] && go && opdhqx_r_bit) ||
434 cstate[`HDR_PAYLD] || cstate[`DATA1] || cstate[`DATA2];
435
436assign data_phase_en = (cstate[`START] && valid ) ||
437 arc_start_hdrpayld ||
438 (arc_data3_data4 && opdhqx_r_bit) || //rd-rd
439 cstate[`DATA4] || cstate[`HDR] || //rd-rd, rd_wr_rd, rd_i_rd
440 arc_hdr_hdrpayld || //rd-wr-rd, rd at previous 1s rd d4
441 (cstate[`NO_C] && opdhqx_r_bit) ||
442 cstate[`HDR_PAYLD] || cstate[`DATA1] ;
443
444assign go = dq || ~crd_cnt_r[2] || ~opcs_packet_flowmode_vld ;
445//assign almost_not_go = crd_cnt_l[2] && ~dq;
446assign crd_cnt_l[2:0] = (op[1:0] == 2'b10) ? crd_cnt_r[2:0] + 3'b001 :
447 (op[1:0] == 2'b01) && (| crd_cnt_r[2:0])?
448 (crd_cnt_r[2:0] - 3'b001) :
449 crd_cnt_r[2:0];
450assign op[1:0] = {inc,dq};
451assign inc = sio_ext_hdr_vld_l;
452assign dq = opcs_packet_ack_in;
453
454
455//************************************************************************
456// STATE TRANSITION SECTION
457//************************************************************************
458//0in one_hot -var cstate[7:0]
459//0in one_hot -var nstate_r[7:0]
460
461assign nstate[7:0] = {nstate_r[7:1], ~nstate_r[0]};
462assign cstate[7:0] = {cstate_r[7:1], ~cstate_r[0]};
463
464//valid_r is the slower version of valid, so that is enough time to read data fr.
465//memory before transition to various header state
466assign arc_start_hdr = cstate[`START] && ~opdhqx_r_bit && go &&
467 ~((hq_almost_empty && del_hq_almost)|| hqempty) ;
468assign arc_start_hdrpayld = cstate[`START] && opdhqx_r_bit && valid_r && go ;
469assign arc_hdr_hdrpayld = cstate[`HDR] && opdhqx_r_bit && valid_r && ~pqempty && go ;
470assign arc_hdr_hdr = cstate[`HDR] && ~opdhqx_r_bit &&
471 ~((hq_almost_empty && del_hq_almost) || hqempty) && go ;
472assign arc_data3_data4 = cstate[`DATA3] ;
473assign arc_data4_hdr = cstate[`DATA4] && ~opdhqx_r_bit &&
474 ~((hq_almost_empty && del_hq_almost) || hqempty) && go ;
475assign arc_data4_hdrpayld = cstate[`DATA4] && opdhqx_r_bit && valid_r && go;
476assign arc_hdr_no_c = cstate[`HDR] && ~go && opdhqx_r_bit && ~hqempty ;
477
478always @ (arc_start_hdr or arc_start_hdrpayld or arc_hdr_hdrpayld or
479 arc_hdr_hdr or arc_data4_hdr or arc_data4_hdrpayld or
480 arc_hdr_no_c or cstate)
481
482 begin
483 case (1'b1) //synopsys parallel_case full_case
484 cstate[`START] : if (arc_start_hdr)
485 nstate_r = `HDR_ST;
486 else if (arc_start_hdrpayld)
487 nstate_r = `HDR_PAYLD_ST;
488 else
489 nstate_r = `START_ST;
490 cstate[`HDR] : if (arc_hdr_hdrpayld)
491 nstate_r = `HDR_PAYLD_ST;
492 else if (arc_hdr_hdr)
493 nstate_r = `HDR_ST;
494 else if (arc_hdr_no_c)
495 nstate_r = `NO_C_ST;
496 else
497 nstate_r = `START_ST;
498 cstate[`NO_C] : nstate_r = `START_ST;
499
500 cstate[`HDR_PAYLD] :
501 nstate_r = `DATA1_ST;
502 cstate[`DATA1] :
503 nstate_r = `DATA2_ST;
504
505 cstate[`DATA2] :
506 nstate_r = `DATA3_ST;
507 cstate[`DATA3] :
508 nstate_r = `DATA4_ST;
509 cstate[`DATA4] : if (arc_data4_hdr)
510 nstate_r = `HDR_ST;
511 else if (arc_data4_hdrpayld)
512 nstate_r = `HDR_PAYLD_ST;
513 else
514 nstate_r = `START_ST;
515 default : begin
516 // 0in < fire -message "ERROR : sio_opcs state machine default case"
517 nstate_r = `START_ST;
518 end
519 endcase
520 end
521
522//--------------------------------------------------------------------------------------
523//************************************************************************
524// REGISTERS section
525//************************************************************************
526
527sio_opcs_ctl_msff_ctl_macro__width_8 reg_cstate // ASYNC reset active low
528 (
529 .scan_in(reg_cstate_scanin),
530 .scan_out(reg_cstate_scanout),
531 .dout(cstate_r[7:0]),
532 .l1clk(l1clk),
533 .din(nstate[7:0]),
534 .siclk(siclk),
535 .soclk(soclk)
536 );
537
538sio_opcs_ctl_msff_ctl_macro__width_1 reg_packet_req // ASYNC reset active low
539 (
540 .scan_in(reg_packet_req_scanin),
541 .scan_out(reg_packet_req_scanout),
542 .dout(sio_ext_hdr_vld_r),
543 .l1clk(l1clk),
544 .din(sio_ext_hdr_vld_l),
545 .siclk(siclk),
546 .soclk(soclk)
547 );
548
549sio_opcs_ctl_msff_ctl_macro__width_1 reg_packet_datareq // ASYNC reset active low
550 (
551 .scan_in(reg_packet_datareq_scanin),
552 .scan_out(reg_packet_datareq_scanout),
553 .dout(opcs_packet_datareq),
554 .l1clk(l1clk),
555 .din(sio_ext_datareq_l),
556 .siclk(siclk),
557 .soclk(soclk)
558 );
559
560sio_opcs_ctl_msff_ctl_macro__width_7 reg_opddqx0_rd_addr // ASYNC reset active low
561 (
562 .scan_in(reg_opddqx0_rd_addr_scanin),
563 .scan_out(reg_opddqx0_rd_addr_scanout),
564 .dout(opcs_opddqx0_rd_addr_r[6:0]),
565 .l1clk(l1clk),
566 .din(opcs_opddqx0_rd_addr_l[6:0]),
567 .siclk(siclk),
568 .soclk(soclk)
569 );
570
571sio_opcs_ctl_msff_ctl_macro__width_7 reg_opddqx1_rd_addr // ASYNC reset active low
572 (
573 .scan_in(reg_opddqx1_rd_addr_scanin),
574 .scan_out(reg_opddqx1_rd_addr_scanout),
575 .dout(opcs_opddqx1_rd_addr_r[6:0]),
576 .l1clk(l1clk),
577 .din(opcs_opddqx1_rd_addr_l[6:0]),
578 .siclk(siclk),
579 .soclk(soclk)
580 );
581
582sio_opcs_ctl_msff_ctl_macro__width_5 reg_opdhqx_rd_addr // ASYNC reset active low
583 (
584 .scan_in(reg_opdhqx_rd_addr_scanin),
585 .scan_out(reg_opdhqx_rd_addr_scanout),
586 .dout(opcs_opdhqx_rd_addr_r[4:0]),
587 .l1clk(l1clk),
588 .din(opcs_opdhqx_rd_addr_l[4:0]),
589 .siclk(siclk),
590 .soclk(soclk)
591 );
592
593sio_opcs_ctl_msff_ctl_macro__width_5 reg_opcs_opcc_opdhqx_rd_addr // ASYNC reset active low
594 (
595 .scan_in(reg_opcs_opcc_opdhqx_rd_addr_scanin),
596 .scan_out(reg_opcs_opcc_opdhqx_rd_addr_scanout),
597 .dout(opcs_opcc_opdhqx_rd_addr[4:0]),
598 .l1clk(l1clk),
599 .din(opcs_opcc_opdhqx_rd_addr_l[4:0]),
600 .siclk(siclk),
601 .soclk(soclk)
602 );
603
604//msff_ctl_macro reg_opddqx0_rd_en (width=1) // ASYNC reset active low
605// (
606// .scan_in(reg_opddqx0_rd_en_scanin),
607// .scan_out(reg_opddqx0_rd_en_scanout),
608// .dout(opcs_opddqx0_rd_en),
609// .l1clk(l1clk),
610// .din(opcs_opddqx0_rd_en_l),
611// );
612
613//msff_ctl_macro reg_opddqx1_rd_en (width=1) // ASYNC reset active low
614// (
615// .scan_in(reg_opddqx1_rd_en_scanin),
616// .scan_out(reg_opddqx1_rd_en_scanout),
617// .dout(opcs_opddqx1_rd_en),
618// .l1clk(l1clk),
619// .din(opcs_opddqx1_rd_en_l),
620// );
621
622//msff_ctl_macro reg_opdhqx_rd_en (width=1) // ASYNC reset active low
623// (
624// .scan_in(reg_opdhqx_rd_en_scanin),
625// .scan_out(reg_opdhqx_rd_en_scanout),
626// .dout(opcs_opdhqx_rd_en),
627// .l1clk(l1clk),
628// .din(opcs_opdhqx_rd_en_l),
629// );
630
631sio_opcs_ctl_msff_ctl_macro__width_3 reg_crd_cnt // ASYNC reset active low
632 (
633 .scan_in(reg_crd_cnt_scanin),
634 .scan_out(reg_crd_cnt_scanout),
635 .dout(crd_cnt_r[2:0]),
636 .l1clk(l1clk),
637 .din(crd_cnt_l[2:0]),
638 .siclk(siclk),
639 .soclk(soclk)
640 );
641
642sio_opcs_ctl_msff_ctl_macro__width_5 reg_opdhqx_wr_addr // ASYNC reset active low
643 (
644 .scan_in(reg_opdhqx_wr_addr_scanin),
645 .scan_out(reg_opdhqx_wr_addr_scanout),
646 .dout(opdhqx_wr_addr[4:0]),
647 .l1clk(l1clk),
648 .din(opcc_opcs_opdhqx_wr_addr[4:0]),
649 .siclk(siclk),
650 .soclk(soclk)
651 );
652
653sio_opcs_ctl_msff_ctl_macro__width_7 reg_opddqx0_wr_addr // ASYNC reset active low
654 (
655 .scan_in(reg_opddqx0_wr_addr_scanin),
656 .scan_out(reg_opddqx0_wr_addr_scanout),
657 .dout(opddqx0_wr_addr[6:0]),
658 .l1clk(l1clk),
659 .din(opcc_opcs_opddqx0_wr_addr[6:0]),
660 .siclk(siclk),
661 .soclk(soclk)
662 );
663
664sio_opcs_ctl_msff_ctl_macro__width_7 reg_opddqx1_wr_addr // ASYNC reset active low
665 (
666 .scan_in(reg_opddqx1_wr_addr_scanin),
667 .scan_out(reg_opddqx1_wr_addr_scanout),
668 .dout(opddqx1_wr_addr[6:0]),
669 .l1clk(l1clk),
670 .din(opcc_opcs_opddqx1_wr_addr[6:0]),
671 .siclk(siclk),
672 .soclk(soclk)
673 );
674
675sio_opcs_ctl_msff_ctl_macro__width_1 reg_valid // ASYNC reset active low
676 (
677 .scan_in(reg_valid_scanin),
678 .scan_out(reg_valid_scanout),
679 .dout(valid_r),
680 .l1clk(l1clk),
681 .din(valid),
682 .siclk(siclk),
683 .soclk(soclk)
684 );
685
686sio_opcs_ctl_msff_ctl_macro__width_1 reg_opdhqx_ue_bit // ASYNC reset active low
687 (
688 .scan_in(reg_opdhqx_ue_bit_scanin),
689 .scan_out(reg_opdhqx_ue_bit_scanout),
690 .dout(opdhqx_ue_bit_r),
691 .l1clk(l1clk),
692 .din(opdhqx_ue_bit),
693 .siclk(siclk),
694 .soclk(soclk)
695 );
696
697
698sio_opcs_ctl_msff_ctl_macro__width_1 reg_hq_almost_r // ASYNC reset active low
699 (
700 .scan_in(reg_hq_almost_r_scanin),
701 .scan_out(reg_hq_almost_r_scanout),
702 .dout(hq_almost_empty_r),
703 .l1clk(l1clk),
704 .din(hq_almost_empty),
705 .siclk(siclk),
706 .soclk(soclk)
707 );
708
709sio_opcs_ctl_msff_ctl_macro__width_1 reg_ncu_ctag_ue // ASYNC reset active low
710 (
711 .scan_in(reg_ncu_ctag_ue_scanin),
712 .scan_out(reg_ncu_ctag_ue_scanout),
713 .dout(opcs_ncu_ctag_ue),
714 .l1clk(l1clk),
715 .din(ncu_ctag_ue_l),
716 .siclk(siclk),
717 .soclk(soclk)
718 );
719
720sio_opcs_ctl_msff_ctl_macro__width_1 reg_ncu_ctag_ce // ASYNC reset active low
721 (
722 .scan_in(reg_ncu_ctag_ce_scanin),
723 .scan_out(reg_ncu_ctag_ce_scanout),
724 .dout(opcs_ncu_ctag_ce),
725 .l1clk(l1clk),
726 .din(ncu_ctag_ce_l),
727 .siclk(siclk),
728 .soclk(soclk)
729 );
730
731sio_opcs_ctl_msff_ctl_macro__width_1 reg_ncu_d_pe // ASYNC reset active low
732 (
733 .scan_in(reg_ncu_d_pe_scanin),
734 .scan_out(reg_ncu_d_pe_scanout),
735 .dout(opcs_ncu_d_pe),
736 .l1clk(l1clk),
737 .din(ncu_d_pe_l),
738 .siclk(siclk),
739 .soclk(soclk)
740 );
741
742
743
744// fixscan start:
745assign spares_scanin = scan_in ;
746assign reg_cstate_scanin = spares_scanout ;
747assign reg_packet_req_scanin = reg_cstate_scanout ;
748assign reg_packet_datareq_scanin = reg_packet_req_scanout ;
749assign reg_opddqx0_rd_addr_scanin = reg_packet_datareq_scanout;
750assign reg_opddqx1_rd_addr_scanin = reg_opddqx0_rd_addr_scanout;
751assign reg_opdhqx_rd_addr_scanin = reg_opddqx1_rd_addr_scanout;
752assign reg_opcs_opcc_opdhqx_rd_addr_scanin = reg_opdhqx_rd_addr_scanout;
753assign reg_crd_cnt_scanin = reg_opcs_opcc_opdhqx_rd_addr_scanout;
754assign reg_opdhqx_wr_addr_scanin = reg_crd_cnt_scanout ;
755assign reg_opddqx0_wr_addr_scanin = reg_opdhqx_wr_addr_scanout;
756assign reg_opddqx1_wr_addr_scanin = reg_opddqx0_wr_addr_scanout;
757assign reg_valid_scanin = reg_opddqx1_wr_addr_scanout;
758assign reg_opdhqx_ue_bit_scanin = reg_valid_scanout ;
759assign reg_hq_almost_r_scanin = reg_opdhqx_ue_bit_scanout;
760assign reg_ncu_ctag_ue_scanin = reg_hq_almost_r_scanout ;
761assign reg_ncu_ctag_ce_scanin = reg_ncu_ctag_ue_scanout ;
762assign reg_ncu_d_pe_scanin = reg_ncu_ctag_ce_scanout ;
763assign scan_out = reg_ncu_d_pe_scanout ;
764// fixscan end:
765endmodule // sio_opcs_ctl
766
767
768
769
770
771
772
773// any PARAMS parms go into naming of macro
774
775module sio_opcs_ctl_l1clkhdr_ctl_macro (
776 l2clk,
777 l1en,
778 pce_ov,
779 stop,
780 se,
781 l1clk);
782
783
784 input l2clk;
785 input l1en;
786 input pce_ov;
787 input stop;
788 input se;
789 output l1clk;
790
791
792
793
794
795cl_sc1_l1hdr_8x c_0 (
796
797
798 .l2clk(l2clk),
799 .pce(l1en),
800 .l1clk(l1clk),
801 .se(se),
802 .pce_ov(pce_ov),
803 .stop(stop)
804);
805
806
807
808endmodule
809
810
811
812
813
814
815
816
817
818// Description: Spare gate macro for control blocks
819//
820// Param num controls the number of times the macro is added
821// flops=0 can be used to use only combination spare logic
822
823
824module sio_opcs_ctl_spare_ctl_macro__num_2 (
825 l1clk,
826 scan_in,
827 siclk,
828 soclk,
829 scan_out);
830wire si_0;
831wire so_0;
832wire spare0_flop_unused;
833wire spare0_buf_32x_unused;
834wire spare0_nand3_8x_unused;
835wire spare0_inv_8x_unused;
836wire spare0_aoi22_4x_unused;
837wire spare0_buf_8x_unused;
838wire spare0_oai22_4x_unused;
839wire spare0_inv_16x_unused;
840wire spare0_nand2_16x_unused;
841wire spare0_nor3_4x_unused;
842wire spare0_nand2_8x_unused;
843wire spare0_buf_16x_unused;
844wire spare0_nor2_16x_unused;
845wire spare0_inv_32x_unused;
846wire si_1;
847wire so_1;
848wire spare1_flop_unused;
849wire spare1_buf_32x_unused;
850wire spare1_nand3_8x_unused;
851wire spare1_inv_8x_unused;
852wire spare1_aoi22_4x_unused;
853wire spare1_buf_8x_unused;
854wire spare1_oai22_4x_unused;
855wire spare1_inv_16x_unused;
856wire spare1_nand2_16x_unused;
857wire spare1_nor3_4x_unused;
858wire spare1_nand2_8x_unused;
859wire spare1_buf_16x_unused;
860wire spare1_nor2_16x_unused;
861wire spare1_inv_32x_unused;
862
863
864input l1clk;
865input scan_in;
866input siclk;
867input soclk;
868output scan_out;
869
870cl_sc1_msff_8x spare0_flop (.l1clk(l1clk),
871 .siclk(siclk),
872 .soclk(soclk),
873 .si(si_0),
874 .so(so_0),
875 .d(1'b0),
876 .q(spare0_flop_unused));
877assign si_0 = scan_in;
878
879cl_u1_buf_32x spare0_buf_32x (.in(1'b1),
880 .out(spare0_buf_32x_unused));
881cl_u1_nand3_8x spare0_nand3_8x (.in0(1'b1),
882 .in1(1'b1),
883 .in2(1'b1),
884 .out(spare0_nand3_8x_unused));
885cl_u1_inv_8x spare0_inv_8x (.in(1'b1),
886 .out(spare0_inv_8x_unused));
887cl_u1_aoi22_4x spare0_aoi22_4x (.in00(1'b1),
888 .in01(1'b1),
889 .in10(1'b1),
890 .in11(1'b1),
891 .out(spare0_aoi22_4x_unused));
892cl_u1_buf_8x spare0_buf_8x (.in(1'b1),
893 .out(spare0_buf_8x_unused));
894cl_u1_oai22_4x spare0_oai22_4x (.in00(1'b1),
895 .in01(1'b1),
896 .in10(1'b1),
897 .in11(1'b1),
898 .out(spare0_oai22_4x_unused));
899cl_u1_inv_16x spare0_inv_16x (.in(1'b1),
900 .out(spare0_inv_16x_unused));
901cl_u1_nand2_16x spare0_nand2_16x (.in0(1'b1),
902 .in1(1'b1),
903 .out(spare0_nand2_16x_unused));
904cl_u1_nor3_4x spare0_nor3_4x (.in0(1'b0),
905 .in1(1'b0),
906 .in2(1'b0),
907 .out(spare0_nor3_4x_unused));
908cl_u1_nand2_8x spare0_nand2_8x (.in0(1'b1),
909 .in1(1'b1),
910 .out(spare0_nand2_8x_unused));
911cl_u1_buf_16x spare0_buf_16x (.in(1'b1),
912 .out(spare0_buf_16x_unused));
913cl_u1_nor2_16x spare0_nor2_16x (.in0(1'b0),
914 .in1(1'b0),
915 .out(spare0_nor2_16x_unused));
916cl_u1_inv_32x spare0_inv_32x (.in(1'b1),
917 .out(spare0_inv_32x_unused));
918
919cl_sc1_msff_8x spare1_flop (.l1clk(l1clk),
920 .siclk(siclk),
921 .soclk(soclk),
922 .si(si_1),
923 .so(so_1),
924 .d(1'b0),
925 .q(spare1_flop_unused));
926assign si_1 = so_0;
927
928cl_u1_buf_32x spare1_buf_32x (.in(1'b1),
929 .out(spare1_buf_32x_unused));
930cl_u1_nand3_8x spare1_nand3_8x (.in0(1'b1),
931 .in1(1'b1),
932 .in2(1'b1),
933 .out(spare1_nand3_8x_unused));
934cl_u1_inv_8x spare1_inv_8x (.in(1'b1),
935 .out(spare1_inv_8x_unused));
936cl_u1_aoi22_4x spare1_aoi22_4x (.in00(1'b1),
937 .in01(1'b1),
938 .in10(1'b1),
939 .in11(1'b1),
940 .out(spare1_aoi22_4x_unused));
941cl_u1_buf_8x spare1_buf_8x (.in(1'b1),
942 .out(spare1_buf_8x_unused));
943cl_u1_oai22_4x spare1_oai22_4x (.in00(1'b1),
944 .in01(1'b1),
945 .in10(1'b1),
946 .in11(1'b1),
947 .out(spare1_oai22_4x_unused));
948cl_u1_inv_16x spare1_inv_16x (.in(1'b1),
949 .out(spare1_inv_16x_unused));
950cl_u1_nand2_16x spare1_nand2_16x (.in0(1'b1),
951 .in1(1'b1),
952 .out(spare1_nand2_16x_unused));
953cl_u1_nor3_4x spare1_nor3_4x (.in0(1'b0),
954 .in1(1'b0),
955 .in2(1'b0),
956 .out(spare1_nor3_4x_unused));
957cl_u1_nand2_8x spare1_nand2_8x (.in0(1'b1),
958 .in1(1'b1),
959 .out(spare1_nand2_8x_unused));
960cl_u1_buf_16x spare1_buf_16x (.in(1'b1),
961 .out(spare1_buf_16x_unused));
962cl_u1_nor2_16x spare1_nor2_16x (.in0(1'b0),
963 .in1(1'b0),
964 .out(spare1_nor2_16x_unused));
965cl_u1_inv_32x spare1_inv_32x (.in(1'b1),
966 .out(spare1_inv_32x_unused));
967assign scan_out = so_1;
968
969
970
971endmodule
972
973
974
975
976
977
978// any PARAMS parms go into naming of macro
979
980module sio_opcs_ctl_msff_ctl_macro__width_8 (
981 din,
982 l1clk,
983 scan_in,
984 siclk,
985 soclk,
986 dout,
987 scan_out);
988wire [7:0] fdin;
989wire [6:0] so;
990
991 input [7:0] din;
992 input l1clk;
993 input scan_in;
994
995
996 input siclk;
997 input soclk;
998
999 output [7:0] dout;
1000 output scan_out;
1001assign fdin[7:0] = din[7:0];
1002
1003
1004
1005
1006
1007
1008dff #(8) d0_0 (
1009.l1clk(l1clk),
1010.siclk(siclk),
1011.soclk(soclk),
1012.d(fdin[7:0]),
1013.si({scan_in,so[6:0]}),
1014.so({so[6:0],scan_out}),
1015.q(dout[7:0])
1016);
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029endmodule
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043// any PARAMS parms go into naming of macro
1044
1045module sio_opcs_ctl_msff_ctl_macro__width_1 (
1046 din,
1047 l1clk,
1048 scan_in,
1049 siclk,
1050 soclk,
1051 dout,
1052 scan_out);
1053wire [0:0] fdin;
1054
1055 input [0:0] din;
1056 input l1clk;
1057 input scan_in;
1058
1059
1060 input siclk;
1061 input soclk;
1062
1063 output [0:0] dout;
1064 output scan_out;
1065assign fdin[0:0] = din[0:0];
1066
1067
1068
1069
1070
1071
1072dff #(1) d0_0 (
1073.l1clk(l1clk),
1074.siclk(siclk),
1075.soclk(soclk),
1076.d(fdin[0:0]),
1077.si(scan_in),
1078.so(scan_out),
1079.q(dout[0:0])
1080);
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093endmodule
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107// any PARAMS parms go into naming of macro
1108
1109module sio_opcs_ctl_msff_ctl_macro__width_7 (
1110 din,
1111 l1clk,
1112 scan_in,
1113 siclk,
1114 soclk,
1115 dout,
1116 scan_out);
1117wire [6:0] fdin;
1118wire [5:0] so;
1119
1120 input [6:0] din;
1121 input l1clk;
1122 input scan_in;
1123
1124
1125 input siclk;
1126 input soclk;
1127
1128 output [6:0] dout;
1129 output scan_out;
1130assign fdin[6:0] = din[6:0];
1131
1132
1133
1134
1135
1136
1137dff #(7) d0_0 (
1138.l1clk(l1clk),
1139.siclk(siclk),
1140.soclk(soclk),
1141.d(fdin[6:0]),
1142.si({scan_in,so[5:0]}),
1143.so({so[5:0],scan_out}),
1144.q(dout[6:0])
1145);
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158endmodule
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172// any PARAMS parms go into naming of macro
1173
1174module sio_opcs_ctl_msff_ctl_macro__width_5 (
1175 din,
1176 l1clk,
1177 scan_in,
1178 siclk,
1179 soclk,
1180 dout,
1181 scan_out);
1182wire [4:0] fdin;
1183wire [3:0] so;
1184
1185 input [4:0] din;
1186 input l1clk;
1187 input scan_in;
1188
1189
1190 input siclk;
1191 input soclk;
1192
1193 output [4:0] dout;
1194 output scan_out;
1195assign fdin[4:0] = din[4:0];
1196
1197
1198
1199
1200
1201
1202dff #(5) d0_0 (
1203.l1clk(l1clk),
1204.siclk(siclk),
1205.soclk(soclk),
1206.d(fdin[4:0]),
1207.si({scan_in,so[3:0]}),
1208.so({so[3:0],scan_out}),
1209.q(dout[4:0])
1210);
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223endmodule
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237// any PARAMS parms go into naming of macro
1238
1239module sio_opcs_ctl_msff_ctl_macro__width_3 (
1240 din,
1241 l1clk,
1242 scan_in,
1243 siclk,
1244 soclk,
1245 dout,
1246 scan_out);
1247wire [2:0] fdin;
1248wire [1:0] so;
1249
1250 input [2:0] din;
1251 input l1clk;
1252 input scan_in;
1253
1254
1255 input siclk;
1256 input soclk;
1257
1258 output [2:0] dout;
1259 output scan_out;
1260assign fdin[2:0] = din[2:0];
1261
1262
1263
1264
1265
1266
1267dff #(3) d0_0 (
1268.l1clk(l1clk),
1269.siclk(siclk),
1270.soclk(soclk),
1271.d(fdin[2:0]),
1272.si({scan_in,so[1:0]}),
1273.so({so[1:0],scan_out}),
1274.q(dout[2:0])
1275);
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288endmodule
1289
1290
1291
1292
1293
1294
1295
1296