Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / ncu / rtl / ncu_i2cbuf32_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ncu_i2cbuf32_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 RF_RDEN_OFFSTATE 1'b1
36
37//====================================
38`define NCU_INTMANRF_DEPTH 128
39`define NCU_INTMANRF_DATAWIDTH 16
40`define NCU_INTMANRF_ADDRWIDTH 7
41//====================================
42
43//====================================
44`define NCU_MONDORF_DEPTH 64
45`define NCU_MONDORF_DATAWIDTH 72
46`define NCU_MONDORF_ADDRWIDTH 6
47//====================================
48
49//====================================
50`define NCU_CPUBUFRF_DEPTH 32
51`define NCU_CPUBUFRF_DATAWIDTH 144
52`define NCU_CPUBUFRF_ADDRWIDTH 5
53//====================================
54
55//====================================
56`define NCU_IOBUFRF_DEPTH 32
57`define NCU_IOBUFRF_DATAWIDTH 144
58`define NCU_IOBUFRF_ADDRWIDTH 5
59//====================================
60
61//====================================
62`define NCU_IOBUF1RF_DEPTH 32
63`define NCU_IOBUF1RF_DATAWIDTH 32
64`define NCU_IOBUF1RF_ADDRWIDTH 5
65//====================================
66
67//====================================
68`define NCU_INTBUFRF_DEPTH 32
69`define NCU_INTBUFRF_DATAWIDTH 144
70`define NCU_INTBUFRF_ADDRWIDTH 5
71//====================================
72
73//== fix me : need to remove when warm //
74//== becomes available //
75`define WMR_LENGTH 10'd999
76`define WMR_LENGTH_P1 10'd1000
77
78//// NCU CSR_MAN address 80_0000_xxxx ////
79`define NCU_CSR_MAN 16'h0000
80`define NCU_CREG_INTMAN 16'h0000
81//`define NCU_CREG_INTVECDISP 16'h0800
82`define NCU_CREG_MONDOINVEC 16'h0a00
83`define NCU_CREG_SERNUM 16'h1000
84`define NCU_CREG_FUSESTAT 16'h1008
85`define NCU_CREG_COREAVAIL 16'h1010
86`define NCU_CREG_BANKAVAIL 16'h1018
87`define NCU_CREG_BANK_ENABLE 16'h1020
88`define NCU_CREG_BANK_ENABLE_STATUS 16'h1028
89`define NCU_CREG_L2_HASH_ENABLE 16'h1030
90`define NCU_CREG_L2_HASH_ENABLE_STATUS 16'h1038
91
92
93`define NCU_CREG_MEM32_BASE 16'h2000
94`define NCU_CREG_MEM32_MASK 16'h2008
95`define NCU_CREG_MEM64_BASE 16'h2010
96`define NCU_CREG_MEM64_MASK 16'h2018
97`define NCU_CREG_IOCON_BASE 16'h2020
98`define NCU_CREG_IOCON_MASK 16'h2028
99`define NCU_CREG_MMUFSH 16'h2030
100
101`define NCU_CREG_ESR 16'h3000
102`define NCU_CREG_ELE 16'h3008
103`define NCU_CREG_EIE 16'h3010
104`define NCU_CREG_EJR 16'h3018
105`define NCU_CREG_FEE 16'h3020
106`define NCU_CREG_PER 16'h3028
107`define NCU_CREG_SIISYN 16'h3030
108`define NCU_CREG_NCUSYN 16'h3038
109`define NCU_CREG_SCKSEL 16'h3040
110`define NCU_CREG_DBGTRIG_EN 16'h4000
111
112//// NUC CSR_MONDO address 80_0004_xxxx ////
113`define NCU_CSR_MONDO 16'h0004
114`define NCU_CREG_MDATA0 16'h0000
115`define NCU_CREG_MDATA1 16'h0200
116`define NCU_CREG_MDATA0_ALIAS 16'h0400
117`define NCU_CREG_MDATA1_ALIAS 16'h0600
118`define NCU_CREG_MBUSY 16'h0800
119`define NCU_CREG_MBUSY_ALIAS 16'h0a00
120
121
122
123// ASI shared reg 90_xxxx_xxxx//
124`define NCU_ASI_A_HIT 10'h104 // 6-bits cpuid and thread id are "x"
125`define NCU_ASI_B_HIT 10'h1CC // 6-bits cpuid and thread id are "x"
126`define NCU_ASI_C_HIT 10'h114 // 6-bits cpuid and thread id are "x"
127`define NCU_ASI_COREAVAIL 16'h0000
128`define NCU_ASI_CORE_ENABLE_STATUS 16'h0010
129`define NCU_ASI_CORE_ENABLE 16'h0020
130`define NCU_ASI_XIR_STEERING 16'h0030
131`define NCU_ASI_CORE_RUNNINGRW 16'h0050
132`define NCU_ASI_CORE_RUNNING_STATUS 16'h0058
133`define NCU_ASI_CORE_RUNNING_W1S 16'h0060
134`define NCU_ASI_CORE_RUNNING_W1C 16'h0068
135`define NCU_ASI_INTVECDISP 16'h0000
136`define NCU_ASI_ERR_STR 16'h1000
137`define NCU_ASI_WMR_VEC_MASK 16'h0018
138`define NCU_ASI_CMP_TICK_ENABLE 16'h0038
139
140
141//// UCB packet type ////
142`define UCB_READ_NACK 4'b0000 // ack/nack types
143`define UCB_READ_ACK 4'b0001
144`define UCB_WRITE_ACK 4'b0010
145`define UCB_IFILL_ACK 4'b0011
146`define UCB_IFILL_NACK 4'b0111
147
148`define UCB_READ_REQ 4'b0100 // req types
149`define UCB_WRITE_REQ 4'b0101
150`define UCB_IFILL_REQ 4'b0110
151
152`define UCB_INT 4'b1000 // plain interrupt
153`define UCB_INT_VEC 4'b1100 // interrupt with vector
154`define UCB_INT_SOC_UE 4'b1001 // soc interrup ue
155`define UCB_INT_SOC_CE 4'b1010 // soc interrup ce
156`define UCB_RESET_VEC 4'b0101 // reset with vector
157`define UCB_IDLE_VEC 4'b1110 // idle with vector
158`define UCB_RESUME_VEC 4'b1111 // resume with vector
159
160`define UCB_INT_SOC 4'b1101 // soc interrup ce
161
162
163//// PCX packet type ////
164`define PCX_LOAD_RQ 5'b00000
165`define PCX_IMISS_RQ 5'b10000
166`define PCX_STORE_RQ 5'b00001
167`define PCX_FWD_RQs 5'b01101
168`define PCX_FWD_RPYs 5'b01110
169
170//// CPX packet type ////
171//`define CPX_LOAD_RET 4'b0000
172`define CPX_LOAD_RET 4'b1000
173`define CPX_ST_ACK 4'b0100
174//`define CPX_IFILL_RET 4'b0001
175`define CPX_IFILL_RET 4'b1001
176`define CPX_INT_RET 4'b0111
177`define CPX_INT_SOC 4'b1101
178//`define CPX_FWD_RQ_RET 4'b1010
179//`define CPX_FWD_RPY_RET 4'b1011
180
181
182
183
184//// Global CSR decode ////
185`define NCU_CSR 8'h80
186`define NIU_CSR 8'h81
187//`define RNG_CSR 8'h82
188`define DBG1_CSR 8'h86
189`define CCU_CSR 8'h83
190`define MCU_CSR 8'h84
191`define TCU_CSR 8'h85
192`define DMU_CSR 8'h88
193`define RCU_CSR 8'h89
194`define NCU_ASI 8'h90
195 /////8'h91 ~ 9F reserved
196 /////8'hA0 ~ BF L2 CSR////
197`define DMU_PIO 4'hC // C0 ~ CF
198 /////8'hB0 ~ FE reserved
199`define SSI_CSR 8'hFF
200
201
202//// NCU_SSI ////
203`define SSI_ADDR 12'hFF_F
204`define SSI_ADDR_TIMEOUT_REG 40'hFF_0001_0088
205`define SSI_ADDR_LOG_REG 40'hFF_0000_0018
206
207`define IF_IDLE 2'b00
208`define IF_ACPT 2'b01
209`define IF_DROP 2'b10
210
211`define SSI_IDLE 3'b000
212`define SSI_REQ 3'b001
213`define SSI_WDATA 3'b011
214`define SSI_REQ_PAR 3'b101
215`define SSI_ACK 3'b111
216`define SSI_RDATA 3'b110
217`define SSI_ACK_PAR 3'b010
218
219
220
221
222
223
224
225
226
227
228module ncu_i2cbuf32_ctl (
229 iol2clk,
230 scan_in,
231 scan_out,
232 tcu_pce_ov,
233 tcu_clk_stop,
234 tcu_scan_en,
235 tcu_aclk,
236 tcu_bclk,
237 tcu_dbr_gateoff,
238 ucb_iob_vld,
239 ucb_iob_data,
240 iob_ucb_stall,
241 req_ack_obj,
242 req_ack_vld,
243 rd_req_ack_dbl_buf,
244 int_obj,
245 int_vld,
246 rd_int_dbl_buf) ;
247wire stall_d1_n;
248wire stall_d1;
249wire vld_d1_ff_scanin;
250wire vld_d1_ff_scanout;
251wire vld_d1;
252wire l1clk;
253wire rdy1;
254wire data_d1_ff_scanin;
255wire data_d1_ff_scanout;
256wire [31:0] data_d1;
257wire iob_ucb_stall_f;
258wire stall_ff_scanin;
259wire stall_ff_scanout;
260wire iob_ucb_stall_a1;
261wire stall_d1_ff_scanin;
262wire stall_d1_ff_scanout;
263wire rdy0_ff_scanin;
264wire rdy0_ff_scanout;
265wire rdy0;
266wire rdy1_ff_scanin;
267wire rdy1_ff_scanout;
268wire skid_buf0_en;
269wire vld_buf0_ff_scanin;
270wire vld_buf0_ff_scanout;
271wire vld_buf0;
272wire data_buf0_ff_scanin;
273wire data_buf0_ff_scanout;
274wire [31:0] data_buf0;
275wire skid_buf1_en_ff_scanin;
276wire skid_buf1_en_ff_scanout;
277wire skid_buf1_en;
278wire vld_buf1_ff_scanin;
279wire vld_buf1_ff_scanout;
280wire vld_buf1;
281wire data_buf1_ff_scanin;
282wire data_buf1_ff_scanout;
283wire [31:0] data_buf1;
284wire skid_buf0_sel;
285wire skid_buf1_sel_ff_scanin;
286wire skid_buf1_sel_ff_scanout;
287wire skid_buf1_sel;
288wire vld_mux;
289wire [31:0] data_mux;
290wire [3:0] indata_vec_next;
291wire [3:0] indata_vec;
292wire iob_ucb_stall_a1_n;
293wire indata_vec_ff_scanin;
294wire indata_vec_ff_scanout;
295wire [127:0] indata_buf_next;
296wire [127:0] indata_buf;
297wire indata_buf_ff_scanin;
298wire indata_buf_ff_scanout;
299wire indata_vec0_d1_ff_scanin;
300wire indata_vec0_d1_ff_scanout;
301wire indata_vec0_d1;
302wire indata_buf_vld;
303wire req_ack_pending;
304wire int_type;
305wire int_pending;
306wire req_ack_dbl_buf_full;
307wire int_dbl_buf_full;
308wire wr_req_ack_dbl_buf;
309wire a_wr_buf0;
310wire a_buf1_vld;
311wire a_buf0_vld;
312wire a_buf1_older;
313wire a_wr_buf1;
314wire a_rd_buf0;
315wire a_rd_buf1;
316wire a_rd_buf;
317wire a_buf1_older_n;
318wire a_buf1_older_ff_scanin;
319wire a_buf1_older_ff_scanout;
320wire a_en_vld0;
321wire a_en_vld1;
322wire a_buf0_vld_ff_scanin;
323wire a_buf0_vld_ff_scanout;
324wire a_buf1_vld_ff_scanin;
325wire a_buf1_vld_ff_scanout;
326wire a_buf0_obj_ff_scanin;
327wire a_buf0_obj_ff_scanout;
328wire [127:0] a_buf0_obj;
329wire a_buf1_obj_ff_scanin;
330wire a_buf1_obj_ff_scanout;
331wire [127:0] a_buf1_obj;
332wire wr_int_dbl_buf;
333wire i_wr_buf0;
334wire i_buf1_vld;
335wire i_buf0_vld;
336wire i_buf1_older;
337wire i_wr_buf1;
338wire i_rd_buf0;
339wire i_rd_buf1;
340wire i_rd_buf;
341wire i_buf1_older_n;
342wire i_buf1_older_ff_scanin;
343wire i_buf1_older_ff_scanout;
344wire i_en_vld0;
345wire i_en_vld1;
346wire i_buf0_vld_ff_scanin;
347wire i_buf0_vld_ff_scanout;
348wire i_buf1_vld_ff_scanin;
349wire i_buf1_vld_ff_scanout;
350wire i_buf0_obj_ff_scanin;
351wire i_buf0_obj_ff_scanout;
352wire [24:0] i_buf0_obj;
353wire i_buf1_obj_ff_scanin;
354wire i_buf1_obj_ff_scanout;
355wire [24:0] i_buf1_obj;
356wire siclk;
357wire soclk;
358wire se;
359wire pce_ov;
360wire stop;
361
362
363 // Global interface
364input iol2clk;
365input scan_in;
366output scan_out;
367input tcu_pce_ov;
368input tcu_clk_stop;
369input tcu_scan_en;
370input tcu_aclk;
371input tcu_bclk;
372input tcu_dbr_gateoff;
373
374 // UCB interface
375input ucb_iob_vld;
376input [31:0] ucb_iob_data;
377output iob_ucb_stall;
378
379 // i2c slow control/datapath interface
380output [127:0] req_ack_obj;
381output req_ack_vld;
382input rd_req_ack_dbl_buf;
383
384output [24:0] int_obj;
385output int_vld;
386input rd_int_dbl_buf;
387
388 // Internal signals
389
390
391/************************************************************
392 * Assemble inbound packet
393 ************************************************************/
394//ucb_bus_in #(UCB_BUS_WIDTH) ucb_bus_in (
395// .clk(iol2clk),
396// .vld(ucb_iob_vld),
397// .data(ucb_iob_data[UCB_BUS_WIDTH-1:0]),
398// .stall(iob_ucb_stall),
399// .indata_buf_vld(indata_buf_vld),
400// .indata_buf(indata_buf[127:0]),
401// .stall_a1(iob_ucb_stall_a1));
402//=============================================================
403//=============================================================
404//======================================== ucb_bus_in =========
405/************************************************************
406 * UCB bus interface flops
407 * This is to make signals going between IOB and UCB flop-to-flop
408 * to improve timing.
409 ************************************************************/
410assign stall_d1_n = ~stall_d1 ;
411ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 vld_d1_ff
412 (
413 .scan_in(vld_d1_ff_scanin),
414 .scan_out(vld_d1_ff_scanout),
415 .dout (vld_d1),
416 .l1clk (l1clk),
417 .en (stall_d1_n &rdy1),
418 .din (ucb_iob_vld),
419 .siclk(siclk),
420 .soclk(soclk)
421 );
422
423ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_32 data_d1_ff
424 (
425 .scan_in(data_d1_ff_scanin),
426 .scan_out(data_d1_ff_scanout),
427 .dout (data_d1[31:0]),
428 .l1clk (l1clk),
429 .en (stall_d1_n),
430 .din (ucb_iob_data[31:0]),
431 .siclk(siclk),
432 .soclk(soclk)
433 );
434
435assign iob_ucb_stall = iob_ucb_stall_f & tcu_dbr_gateoff;
436ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 stall_ff
437 (
438 .scan_in(stall_ff_scanin),
439 .scan_out(stall_ff_scanout),
440 .dout (iob_ucb_stall_f),
441 .l1clk (l1clk),
442 .din (iob_ucb_stall_a1),
443 .siclk(siclk),
444 .soclk(soclk)
445 );
446
447ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 stall_d1_ff
448 (
449 .scan_in(stall_d1_ff_scanin),
450 .scan_out(stall_d1_ff_scanout),
451 .dout (stall_d1),
452 .l1clk (l1clk),
453 .din (iob_ucb_stall),
454 .siclk(siclk),
455 .soclk(soclk)
456 );
457
458
459ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 rdy0_ff
460 (
461 .scan_in(rdy0_ff_scanin),
462 .scan_out(rdy0_ff_scanout),
463 .dout (rdy0),
464 .l1clk (l1clk),
465 .din (1'b1),
466 .siclk(siclk),
467 .soclk(soclk)
468 );
469
470ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 rdy1_ff
471 (
472 .scan_in(rdy1_ff_scanin),
473 .scan_out(rdy1_ff_scanout),
474 .dout (rdy1),
475 .l1clk (l1clk),
476 .din (rdy0),
477 .siclk(siclk),
478 .soclk(soclk)
479 );
480
481/************************************************************
482 * Skid buffer
483 * We need a two deep skid buffer to handle stalling.
484 ************************************************************/
485// Assertion: stall has to be deasserted for more than 1 cycle
486// ie time between two separate stalls has to be
487// at least two cycles. Otherwise, contents from
488// skid buffer will be lost.
489
490// Buffer 0
491assign skid_buf0_en = iob_ucb_stall_a1 & ~iob_ucb_stall;
492
493ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 vld_buf0_ff
494 (
495 .scan_in(vld_buf0_ff_scanin),
496 .scan_out(vld_buf0_ff_scanout),
497 .dout (vld_buf0),
498 .l1clk (l1clk),
499 .en (skid_buf0_en),
500 .din (vld_d1),
501 .siclk(siclk),
502 .soclk(soclk)
503 );
504
505ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_32 data_buf0_ff
506 (
507 .scan_in(data_buf0_ff_scanin),
508 .scan_out(data_buf0_ff_scanout),
509 .dout (data_buf0[31:0]),
510 .l1clk (l1clk),
511 .en (skid_buf0_en),
512 .din (data_d1[31:0]),
513 .siclk(siclk),
514 .soclk(soclk)
515 );
516
517// Buffer 1
518ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 skid_buf1_en_ff
519 (
520 .scan_in(skid_buf1_en_ff_scanin),
521 .scan_out(skid_buf1_en_ff_scanout),
522 .dout (skid_buf1_en),
523 .l1clk (l1clk),
524 .din (skid_buf0_en),
525 .siclk(siclk),
526 .soclk(soclk)
527 );
528
529ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 vld_buf1_ff
530 (
531 .scan_in(vld_buf1_ff_scanin),
532 .scan_out(vld_buf1_ff_scanout),
533 .dout (vld_buf1),
534 .l1clk (l1clk),
535 .en (skid_buf1_en),
536 .din (vld_d1),
537 .siclk(siclk),
538 .soclk(soclk)
539 );
540
541ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_32 data_buf1_ff
542 (
543 .scan_in(data_buf1_ff_scanin),
544 .scan_out(data_buf1_ff_scanout),
545 .dout (data_buf1[31:0]),
546 .l1clk (l1clk),
547 .en (skid_buf1_en),
548 .din (data_d1[31:0]),
549 .siclk(siclk),
550 .soclk(soclk)
551 );
552/************************************************************
553 * Mux between skid buffer and interface flop
554 ************************************************************/
555// Assertion: stall has to be deasserted for more than 1 cycle
556// ie time between two separate stalls has to be
557// at least two cycles. Otherwise, contents from
558// skid buffer will be lost.
559
560assign skid_buf0_sel = ~iob_ucb_stall_a1 & iob_ucb_stall;
561
562ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 skid_buf1_sel_ff
563 (
564 .scan_in(skid_buf1_sel_ff_scanin),
565 .scan_out(skid_buf1_sel_ff_scanout),
566 .dout (skid_buf1_sel),
567 .l1clk (l1clk),
568 .din (skid_buf0_sel),
569 .siclk(siclk),
570 .soclk(soclk)
571 );
572
573assign vld_mux = skid_buf0_sel ? vld_buf0 :
574 skid_buf1_sel ? vld_buf1 : vld_d1;
575
576assign data_mux[31:0] = skid_buf0_sel ? data_buf0[31:0] :
577 skid_buf1_sel ? data_buf1[31:0] : data_d1[31:0];
578
579/************************************************************
580 * Assemble inbound data
581 ************************************************************/
582// valid vector
583assign indata_vec_next[3:0] = {vld_mux,indata_vec[3:1]};
584
585assign iob_ucb_stall_a1_n = ~iob_ucb_stall_a1;
586ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_4 indata_vec_ff
587 (
588 .scan_in(indata_vec_ff_scanin),
589 .scan_out(indata_vec_ff_scanout),
590 .dout (indata_vec[3:0]),
591 .l1clk (l1clk),
592 .en (iob_ucb_stall_a1_n),
593 .din (indata_vec_next[3:0]),
594 .siclk(siclk),
595 .soclk(soclk)
596 );
597
598// data buffer
599assign indata_buf_next[127:0] = {data_mux[31:0], indata_buf[127:32]};
600ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_128 indata_buf_ff
601 (
602 .scan_in(indata_buf_ff_scanin),
603 .scan_out(indata_buf_ff_scanout),
604 .dout (indata_buf[127:0]),
605 .l1clk (l1clk),
606 .en (iob_ucb_stall_a1_n),
607 .din (indata_buf_next[127:0]),
608 .siclk(siclk),
609 .soclk(soclk)
610 );
611
612// detect a new packet
613ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 indata_vec0_d1_ff
614 (
615 .scan_in(indata_vec0_d1_ff_scanin),
616 .scan_out(indata_vec0_d1_ff_scanout),
617 .dout (indata_vec0_d1),
618 .l1clk (l1clk),
619 .en (iob_ucb_stall_a1_n),
620 .din (indata_vec[0]),
621 .siclk(siclk),
622 .soclk(soclk)
623 );
624
625assign indata_buf_vld = indata_vec[0] & ~indata_vec0_d1;
626//======================================== ucb_bus_in =========
627//=============================================================
628//=============================================================
629
630
631
632/************************************************************
633 * Decode inbound packet type
634 ************************************************************/
635 // non-interrupt packet
636assign req_ack_pending = ~int_type & indata_buf_vld;
637
638 // interrupt packet
639assign int_type = ((indata_buf[3:0] == `UCB_INT) |
640 (indata_buf[3:0] == `UCB_INT_VEC) |
641 (indata_buf[3:0] == `UCB_RESET_VEC) |
642 (indata_buf[3:0] == `UCB_IDLE_VEC) |
643 (indata_buf[3:0] == `UCB_RESUME_VEC) );
644
645assign int_pending = int_type & indata_buf_vld;
646
647assign iob_ucb_stall_a1 = (req_ack_pending & req_ack_dbl_buf_full) |
648 (int_pending & int_dbl_buf_full);
649
650
651/************************************************************
652 * Double buffer to store non-interrupt packets
653 ************************************************************/
654assign wr_req_ack_dbl_buf = req_ack_pending & ~req_ack_dbl_buf_full;
655
656//dbl_buf #(128) req_ack_dbl_buf (
657// .clk(iol2clk),
658// .wr(wr_req_ack_dbl_buf),
659// .din(indata_buf[127:0]),
660// .rd(rd_req_ack_dbl_buf),
661// .dout(req_ack_obj[127:0]),
662// .vld(req_ack_vld),
663// .full(req_ack_dbl_buf_full));
664//=============================================================
665//=============================================================
666//========================================== dbl_buf ==========
667
668// if both entries are empty, write to entry pointed to by the older pointer
669assign a_wr_buf0 = wr_req_ack_dbl_buf & (a_buf1_vld | (~a_buf0_vld & ~a_buf1_older));
670assign a_wr_buf1 = wr_req_ack_dbl_buf & (a_buf0_vld | (~a_buf1_vld & a_buf1_older));
671
672// read from the older entry
673assign a_rd_buf0 = rd_req_ack_dbl_buf & ~a_buf1_older;
674assign a_rd_buf1 = rd_req_ack_dbl_buf & a_buf1_older;
675
676// flip older pointer when an entry is read
677assign a_rd_buf = rd_req_ack_dbl_buf & (a_buf0_vld | a_buf1_vld);
678assign a_buf1_older_n = ~a_buf1_older;
679ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 a_buf1_older_ff
680 (
681 .scan_in(a_buf1_older_ff_scanin),
682 .scan_out(a_buf1_older_ff_scanout),
683 .dout (a_buf1_older),
684 .l1clk (l1clk),
685 .en (a_rd_buf),
686 .din (a_buf1_older_n),
687 .siclk(siclk),
688 .soclk(soclk)
689 );
690
691// set valid bit for writes and reset for reads
692assign a_en_vld0 = a_wr_buf0 | a_rd_buf0;
693assign a_en_vld1 = a_wr_buf1 | a_rd_buf1;
694
695// the actual buffers
696ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 a_buf0_vld_ff
697 (
698 .scan_in(a_buf0_vld_ff_scanin),
699 .scan_out(a_buf0_vld_ff_scanout),
700 .dout (a_buf0_vld),
701 .l1clk (l1clk),
702 .en (a_en_vld0),
703 .din (a_wr_buf0),
704 .siclk(siclk),
705 .soclk(soclk)
706 );
707
708ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 a_buf1_vld_ff
709 (
710 .scan_in(a_buf1_vld_ff_scanin),
711 .scan_out(a_buf1_vld_ff_scanout),
712 .dout (a_buf1_vld),
713 .l1clk (l1clk),
714 .en (a_en_vld1),
715 .din (a_wr_buf1),
716 .siclk(siclk),
717 .soclk(soclk)
718 );
719
720ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_128 a_buf0_obj_ff
721 (
722 .scan_in(a_buf0_obj_ff_scanin),
723 .scan_out(a_buf0_obj_ff_scanout),
724 .dout (a_buf0_obj[127:0]),
725 .l1clk (l1clk),
726 .en (a_wr_buf0),
727 .din (indata_buf[127:0]),
728 .siclk(siclk),
729 .soclk(soclk)
730 );
731
732ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_128 a_buf1_obj_ff
733 (
734 .scan_in(a_buf1_obj_ff_scanin),
735 .scan_out(a_buf1_obj_ff_scanout),
736 .dout (a_buf1_obj[127:0]),
737 .l1clk (l1clk),
738 .en (a_wr_buf1),
739 .din (indata_buf[127:0]),
740 .siclk(siclk),
741 .soclk(soclk)
742 );
743
744// mux out the older entry
745assign req_ack_obj[127:0] = (a_buf1_older) ? a_buf1_obj[127:0] : a_buf0_obj[127:0] ;
746
747assign req_ack_vld = a_buf0_vld | a_buf1_vld;
748assign req_ack_dbl_buf_full = a_buf0_vld & a_buf1_vld;
749//========================================== dbl_buf ==========
750//=============================================================
751//=============================================================
752
753
754
755
756/************************************************************
757 * Double buffer to store interrupt packets
758 ************************************************************/
759assign wr_int_dbl_buf = int_pending & ~int_dbl_buf_full;
760
761//dbl_buf #(64) int_dbl_buf (
762// .clk(iol2clk),
763// .wr(wr_int_dbl_buf),
764// .din(indata_buf[63:0]),
765// .rd(rd_int_dbl_buf),
766// .dout(int_obj[63:0]),
767// .vld(int_vld),
768// .full(int_dbl_buf_full));
769
770//=============================================================
771//=============================================================
772//======================================= dbl_buf =============
773
774// if both entries are empty, write to entry pointed to by the older pointer
775assign i_wr_buf0 = wr_int_dbl_buf & (i_buf1_vld | (~i_buf0_vld & ~i_buf1_older));
776assign i_wr_buf1 = wr_int_dbl_buf & (i_buf0_vld | (~i_buf1_vld & i_buf1_older));
777
778// read from the older entry
779assign i_rd_buf0 = rd_int_dbl_buf & ~i_buf1_older;
780assign i_rd_buf1 = rd_int_dbl_buf & i_buf1_older;
781
782// flip older pointer when an entry is read
783assign i_rd_buf = rd_int_dbl_buf & (i_buf0_vld | i_buf1_vld);
784assign i_buf1_older_n = ~i_buf1_older;
785ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 i_buf1_older_ff
786 (
787 .scan_in(i_buf1_older_ff_scanin),
788 .scan_out(i_buf1_older_ff_scanout),
789 .dout (i_buf1_older),
790 .l1clk (l1clk),
791 .en (i_rd_buf),
792 .din (i_buf1_older_n),
793 .siclk(siclk),
794 .soclk(soclk)
795 );
796
797// set valid bit for writes and reset for reads
798assign i_en_vld0 = i_wr_buf0 | i_rd_buf0;
799assign i_en_vld1 = i_wr_buf1 | i_rd_buf1;
800
801// the actual buffers
802ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 i_buf0_vld_ff
803 (
804 .scan_in(i_buf0_vld_ff_scanin),
805 .scan_out(i_buf0_vld_ff_scanout),
806 .dout (i_buf0_vld),
807 .l1clk (l1clk),
808 .en (i_en_vld0),
809 .din (i_wr_buf0),
810 .siclk(siclk),
811 .soclk(soclk)
812 );
813
814ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 i_buf1_vld_ff
815 (
816 .scan_in(i_buf1_vld_ff_scanin),
817 .scan_out(i_buf1_vld_ff_scanout),
818 .dout (i_buf1_vld),
819 .l1clk (l1clk),
820 .en (i_en_vld1),
821 .din (i_wr_buf1),
822 .siclk(siclk),
823 .soclk(soclk)
824 );
825
826ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_25 i_buf0_obj_ff
827 (
828 .scan_in(i_buf0_obj_ff_scanin),
829 .scan_out(i_buf0_obj_ff_scanout),
830 .dout (i_buf0_obj[24:0]),
831 .l1clk (l1clk),
832 .en (i_wr_buf0),
833 .din ({indata_buf[56:51],indata_buf[18:0]}),
834 .siclk(siclk),
835 .soclk(soclk)
836 );
837
838ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_25 i_buf1_obj_ff
839 (
840 .scan_in(i_buf1_obj_ff_scanin),
841 .scan_out(i_buf1_obj_ff_scanout),
842 .dout (i_buf1_obj[24:0]),
843 .l1clk (l1clk),
844 .en (i_wr_buf1),
845 .din ({indata_buf[56:51],indata_buf[18:0]}),
846 .siclk(siclk),
847 .soclk(soclk)
848 );
849
850// mux out the older entry
851assign int_obj[24:0] = (i_buf1_older) ? i_buf1_obj[24:0] : i_buf0_obj[24:0] ;
852
853assign int_vld = i_buf0_vld | i_buf1_vld;
854assign int_dbl_buf_full = i_buf0_vld & i_buf1_vld;
855//=========================================== dbl_buf =========
856//=============================================================
857//=============================================================
858
859
860
861
862
863
864/**** adding clock header ****/
865ncu_i2cbuf32_ctl_l1clkhdr_ctl_macro clkgen (
866 .l2clk (iol2clk),
867 .l1en (1'b1),
868 .l1clk (l1clk),
869 .pce_ov(pce_ov),
870 .stop(stop),
871 .se(se)
872 );
873
874/*** building tcu port ***/
875assign siclk = tcu_aclk;
876assign soclk = tcu_bclk;
877assign se = tcu_scan_en;
878assign pce_ov = tcu_pce_ov;
879assign stop = tcu_clk_stop;
880
881// fixscan start:
882assign vld_d1_ff_scanin = scan_in ;
883assign data_d1_ff_scanin = vld_d1_ff_scanout ;
884assign stall_ff_scanin = data_d1_ff_scanout ;
885assign stall_d1_ff_scanin = stall_ff_scanout ;
886assign rdy0_ff_scanin = stall_d1_ff_scanout ;
887assign rdy1_ff_scanin = rdy0_ff_scanout ;
888assign vld_buf0_ff_scanin = rdy1_ff_scanout ;
889assign data_buf0_ff_scanin = vld_buf0_ff_scanout ;
890assign skid_buf1_en_ff_scanin = data_buf0_ff_scanout ;
891assign vld_buf1_ff_scanin = skid_buf1_en_ff_scanout ;
892assign data_buf1_ff_scanin = vld_buf1_ff_scanout ;
893assign skid_buf1_sel_ff_scanin = data_buf1_ff_scanout ;
894assign indata_vec_ff_scanin = skid_buf1_sel_ff_scanout ;
895assign indata_buf_ff_scanin = indata_vec_ff_scanout ;
896assign indata_vec0_d1_ff_scanin = indata_buf_ff_scanout ;
897assign a_buf1_older_ff_scanin = indata_vec0_d1_ff_scanout;
898assign a_buf0_vld_ff_scanin = a_buf1_older_ff_scanout ;
899assign a_buf1_vld_ff_scanin = a_buf0_vld_ff_scanout ;
900assign a_buf0_obj_ff_scanin = a_buf1_vld_ff_scanout ;
901assign a_buf1_obj_ff_scanin = a_buf0_obj_ff_scanout ;
902assign i_buf1_older_ff_scanin = a_buf1_obj_ff_scanout ;
903assign i_buf0_vld_ff_scanin = i_buf1_older_ff_scanout ;
904assign i_buf1_vld_ff_scanin = i_buf0_vld_ff_scanout ;
905assign i_buf0_obj_ff_scanin = i_buf1_vld_ff_scanout ;
906assign i_buf1_obj_ff_scanin = i_buf0_obj_ff_scanout ;
907assign scan_out = i_buf1_obj_ff_scanout ;
908// fixscan end:
909endmodule // i2c_buf
910
911
912
913
914
915
916
917
918// any PARAMS parms go into naming of macro
919
920module ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_1 (
921 din,
922 en,
923 l1clk,
924 scan_in,
925 siclk,
926 soclk,
927 dout,
928 scan_out);
929wire [0:0] fdin;
930
931 input [0:0] din;
932 input en;
933 input l1clk;
934 input scan_in;
935
936
937 input siclk;
938 input soclk;
939
940 output [0:0] dout;
941 output scan_out;
942assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
943
944
945
946
947
948
949dff #(1) d0_0 (
950.l1clk(l1clk),
951.siclk(siclk),
952.soclk(soclk),
953.d(fdin[0:0]),
954.si(scan_in),
955.so(scan_out),
956.q(dout[0:0])
957);
958
959
960
961
962
963
964
965
966
967
968
969
970endmodule
971
972
973
974
975
976
977
978
979
980
981
982
983
984// any PARAMS parms go into naming of macro
985
986module ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_32 (
987 din,
988 en,
989 l1clk,
990 scan_in,
991 siclk,
992 soclk,
993 dout,
994 scan_out);
995wire [31:0] fdin;
996wire [30:0] so;
997
998 input [31:0] din;
999 input en;
1000 input l1clk;
1001 input scan_in;
1002
1003
1004 input siclk;
1005 input soclk;
1006
1007 output [31:0] dout;
1008 output scan_out;
1009assign fdin[31:0] = (din[31:0] & {32{en}}) | (dout[31:0] & ~{32{en}});
1010
1011
1012
1013
1014
1015
1016dff #(32) d0_0 (
1017.l1clk(l1clk),
1018.siclk(siclk),
1019.soclk(soclk),
1020.d(fdin[31:0]),
1021.si({scan_in,so[30:0]}),
1022.so({so[30:0],scan_out}),
1023.q(dout[31:0])
1024);
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037endmodule
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051// any PARAMS parms go into naming of macro
1052
1053module ncu_i2cbuf32_ctl_msff_ctl_macro__width_1 (
1054 din,
1055 l1clk,
1056 scan_in,
1057 siclk,
1058 soclk,
1059 dout,
1060 scan_out);
1061wire [0:0] fdin;
1062
1063 input [0:0] din;
1064 input l1clk;
1065 input scan_in;
1066
1067
1068 input siclk;
1069 input soclk;
1070
1071 output [0:0] dout;
1072 output scan_out;
1073assign fdin[0:0] = din[0:0];
1074
1075
1076
1077
1078
1079
1080dff #(1) d0_0 (
1081.l1clk(l1clk),
1082.siclk(siclk),
1083.soclk(soclk),
1084.d(fdin[0:0]),
1085.si(scan_in),
1086.so(scan_out),
1087.q(dout[0:0])
1088);
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101endmodule
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115// any PARAMS parms go into naming of macro
1116
1117module ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_4 (
1118 din,
1119 en,
1120 l1clk,
1121 scan_in,
1122 siclk,
1123 soclk,
1124 dout,
1125 scan_out);
1126wire [3:0] fdin;
1127wire [2:0] so;
1128
1129 input [3:0] din;
1130 input en;
1131 input l1clk;
1132 input scan_in;
1133
1134
1135 input siclk;
1136 input soclk;
1137
1138 output [3:0] dout;
1139 output scan_out;
1140assign fdin[3:0] = (din[3:0] & {4{en}}) | (dout[3:0] & ~{4{en}});
1141
1142
1143
1144
1145
1146
1147dff #(4) d0_0 (
1148.l1clk(l1clk),
1149.siclk(siclk),
1150.soclk(soclk),
1151.d(fdin[3:0]),
1152.si({scan_in,so[2:0]}),
1153.so({so[2:0],scan_out}),
1154.q(dout[3:0])
1155);
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168endmodule
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182// any PARAMS parms go into naming of macro
1183
1184module ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_128 (
1185 din,
1186 en,
1187 l1clk,
1188 scan_in,
1189 siclk,
1190 soclk,
1191 dout,
1192 scan_out);
1193wire [127:0] fdin;
1194wire [126:0] so;
1195
1196 input [127:0] din;
1197 input en;
1198 input l1clk;
1199 input scan_in;
1200
1201
1202 input siclk;
1203 input soclk;
1204
1205 output [127:0] dout;
1206 output scan_out;
1207assign fdin[127:0] = (din[127:0] & {128{en}}) | (dout[127:0] & ~{128{en}});
1208
1209
1210
1211
1212
1213
1214dff #(128) d0_0 (
1215.l1clk(l1clk),
1216.siclk(siclk),
1217.soclk(soclk),
1218.d(fdin[127:0]),
1219.si({scan_in,so[126:0]}),
1220.so({so[126:0],scan_out}),
1221.q(dout[127:0])
1222);
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235endmodule
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249// any PARAMS parms go into naming of macro
1250
1251module ncu_i2cbuf32_ctl_msff_ctl_macro__en_1__width_25 (
1252 din,
1253 en,
1254 l1clk,
1255 scan_in,
1256 siclk,
1257 soclk,
1258 dout,
1259 scan_out);
1260wire [24:0] fdin;
1261wire [23:0] so;
1262
1263 input [24:0] din;
1264 input en;
1265 input l1clk;
1266 input scan_in;
1267
1268
1269 input siclk;
1270 input soclk;
1271
1272 output [24:0] dout;
1273 output scan_out;
1274assign fdin[24:0] = (din[24:0] & {25{en}}) | (dout[24:0] & ~{25{en}});
1275
1276
1277
1278
1279
1280
1281dff #(25) d0_0 (
1282.l1clk(l1clk),
1283.siclk(siclk),
1284.soclk(soclk),
1285.d(fdin[24:0]),
1286.si({scan_in,so[23:0]}),
1287.so({so[23:0],scan_out}),
1288.q(dout[24:0])
1289);
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302endmodule
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316// any PARAMS parms go into naming of macro
1317
1318module ncu_i2cbuf32_ctl_l1clkhdr_ctl_macro (
1319 l2clk,
1320 l1en,
1321 pce_ov,
1322 stop,
1323 se,
1324 l1clk);
1325
1326
1327 input l2clk;
1328 input l1en;
1329 input pce_ov;
1330 input stop;
1331 input se;
1332 output l1clk;
1333
1334
1335
1336
1337
1338cl_sc1_l1hdr_8x c_0 (
1339
1340
1341 .l2clk(l2clk),
1342 .pce(l1en),
1343 .l1clk(l1clk),
1344 .se(se),
1345 .pce_ov(pce_ov),
1346 .stop(stop)
1347);
1348
1349
1350
1351endmodule
1352
1353
1354
1355
1356
1357
1358
1359