Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / ncu / rtl / ncu_i2cfc_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ncu_i2cfc_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_i2cfc_ctl (
229 l2clk,
230 cmp_io_sync_en,
231 io_cmp_sync_en,
232 scan_in,
233 scan_out,
234 tcu_pce_ov,
235 tcu_clk_stop,
236 tcu_scan_en,
237 tcu_aclk,
238 tcu_bclk,
239 cpx_ncu_grant_cx,
240 intbuf_cpx_req,
241 iobuf_cpx_req,
242 ncu_cpx_req_next,
243 intbuf_sel_next,
244 iobuf_sel_next,
245 intbuf_rd,
246 iobuf_rd,
247 iobuf_vld,
248 io_pa_ld,
249 io_pas,
250 intbuf_vld,
251 int_pa_ld,
252 int_pas,
253 iobuf_dout_d1_ue,
254 intbuf_dout_d1_ue,
255 intbuf_hit_hwm,
256 iobuf_tail_s,
257 iobuf_head_f,
258 intbuf_wr2i2c,
259 intbuf_tail_ptr,
260 intbuf_head_ptr,
261 mb0_raddr,
262 mb0_waddr,
263 mb0_intbuf_rd_en,
264 mb0_iobuf_rd_en,
265 mb0_run,
266 iobuf_head_ptr,
267 iobuf_rden,
268 intbuf_rden) ;
269wire [7:0] cpx_buf_full;
270wire [7:0] cpx_ncu_grant;
271wire cpx_ncu_grant_ff_scanin;
272wire cpx_ncu_grant_ff_scanout;
273wire l1clk;
274wire cpx_cnt0_plus1_sel;
275wire cpx_cnt0_minus1_sel;
276wire [1:0] cpx_cnt0_plus1;
277wire [1:0] cpx_cnt0;
278wire [1:0] cpx_cnt0_minus1;
279wire cpx_cnt0_ff_scanin;
280wire cpx_cnt0_ff_scanout;
281wire cpx_cnt1_plus1_sel;
282wire cpx_cnt1_minus1_sel;
283wire [1:0] cpx_cnt1_plus1;
284wire [1:0] cpx_cnt1;
285wire [1:0] cpx_cnt1_minus1;
286wire cpx_cnt1_ff_scanin;
287wire cpx_cnt1_ff_scanout;
288wire cpx_cnt2_plus1_sel;
289wire cpx_cnt2_minus1_sel;
290wire [1:0] cpx_cnt2_plus1;
291wire [1:0] cpx_cnt2;
292wire [1:0] cpx_cnt2_minus1;
293wire cpx_cnt2_ff_scanin;
294wire cpx_cnt2_ff_scanout;
295wire cpx_cnt3_plus1_sel;
296wire cpx_cnt3_minus1_sel;
297wire [1:0] cpx_cnt3_plus1;
298wire [1:0] cpx_cnt3;
299wire [1:0] cpx_cnt3_minus1;
300wire cpx_cnt3_ff_scanin;
301wire cpx_cnt3_ff_scanout;
302wire cpx_cnt4_plus1_sel;
303wire cpx_cnt4_minus1_sel;
304wire [1:0] cpx_cnt4_plus1;
305wire [1:0] cpx_cnt4;
306wire [1:0] cpx_cnt4_minus1;
307wire cpx_cnt4_ff_scanin;
308wire cpx_cnt4_ff_scanout;
309wire cpx_cnt5_plus1_sel;
310wire cpx_cnt5_minus1_sel;
311wire [1:0] cpx_cnt5_plus1;
312wire [1:0] cpx_cnt5;
313wire [1:0] cpx_cnt5_minus1;
314wire cpx_cnt5_ff_scanin;
315wire cpx_cnt5_ff_scanout;
316wire cpx_cnt6_plus1_sel;
317wire cpx_cnt6_minus1_sel;
318wire [1:0] cpx_cnt6_plus1;
319wire [1:0] cpx_cnt6;
320wire [1:0] cpx_cnt6_minus1;
321wire cpx_cnt6_ff_scanin;
322wire cpx_cnt6_ff_scanout;
323wire cpx_cnt7_plus1_sel;
324wire cpx_cnt7_minus1_sel;
325wire [1:0] cpx_cnt7_plus1;
326wire [1:0] cpx_cnt7;
327wire [1:0] cpx_cnt7_minus1;
328wire cpx_cnt7_ff_scanin;
329wire cpx_cnt7_ff_scanout;
330wire [5:0] intbuf_tail_plus;
331wire [5:0] intbuf_tail;
332wire intbuf_tail_ff_scanin;
333wire intbuf_tail_ff_scanout;
334wire [5:0] intbuf_tail_plus10;
335wire [5:0] intbuf_head;
336wire intbuf_head_d1_ff_scanin;
337wire intbuf_head_d1_ff_scanout;
338wire [5:0] intbuf_head_d1;
339wire int_pipe_full;
340wire int_aov;
341wire int_pav;
342wire int_pbv;
343wire intbuf_head_inc;
344wire int_aog;
345wire intrd;
346wire int_aog_ff_scanin;
347wire int_aog_ff_scanout;
348wire int_aov_next;
349wire int_aov_ff_scanin;
350wire int_aov_ff_scanout;
351wire int_pav_ff_scanin;
352wire int_pav_ff_scanout;
353wire int_pb_ld;
354wire int_pbv_ff_scanin;
355wire int_pbv_ff_scanout;
356wire int_pbs_next;
357wire int_pbs_ff_scanin;
358wire int_pbs_ff_scanout;
359wire int_pbs;
360wire int_mov;
361wire intbuf_vld_next;
362wire intbuf_vld_ff_scanin;
363wire intbuf_vld_ff_scanout;
364wire iobuf_tail_ff_scanin;
365wire iobuf_tail_ff_scanout;
366wire [5:0] iobuf_tail;
367wire iobuf_head_d1_ff_scanin;
368wire iobuf_head_d1_ff_scanout;
369wire [5:0] iobuf_head_d1;
370wire [5:0] iobuf_head;
371wire iobuf_head_f_ff_scanin;
372wire iobuf_head_f_ff_scanout;
373wire io_pipe_full;
374wire io_aov;
375wire io_pav;
376wire io_pbv;
377wire iobuf_head_inc;
378wire io_aog;
379wire iord;
380wire io_aog_ff_scanin;
381wire io_aog_ff_scanout;
382wire io_aov_next;
383wire io_aov_ff_scanin;
384wire io_aov_ff_scanout;
385wire io_pav_ff_scanin;
386wire io_pav_ff_scanout;
387wire io_pb_ld;
388wire io_pbv_ff_scanin;
389wire io_pbv_ff_scanout;
390wire io_pbs_next;
391wire io_pbs_ff_scanin;
392wire io_pbs_ff_scanout;
393wire io_pbs;
394wire io_mov;
395wire iobuf_vld_next;
396wire iobuf_vld_ff_scanin;
397wire iobuf_vld_ff_scanout;
398wire siclk;
399wire soclk;
400wire se;
401wire pce_ov;
402wire stop;
403
404
405////////////////////////////////////////////////////////////////////////
406// Signal declarations
407////////////////////////////////////////////////////////////////////////
408// Global interface
409input l2clk;
410input cmp_io_sync_en;
411input io_cmp_sync_en;
412input scan_in;
413output scan_out;
414input tcu_pce_ov;
415input tcu_clk_stop;
416input tcu_scan_en;
417input tcu_aclk;
418input tcu_bclk;
419
420// Crossbar interface
421input [7:0] cpx_ncu_grant_cx;
422
423
424// i2c fast datapath interface
425input [7:0] intbuf_cpx_req;
426input [7:0] iobuf_cpx_req;
427input [7:0] ncu_cpx_req_next;
428
429output intbuf_sel_next;
430output iobuf_sel_next;
431
432output intbuf_rd;
433output iobuf_rd;
434
435output iobuf_vld;
436output io_pa_ld;
437output io_pas;
438output intbuf_vld;
439output int_pa_ld;
440output int_pas;
441
442input iobuf_dout_d1_ue;
443input intbuf_dout_d1_ue;
444
445
446// c2i fast control interface
447//input cpu_mondo_rd_d2;
448//input cpu_mondo_wr_d2;
449
450output intbuf_hit_hwm;
451
452
453// i2c slow control interface
454input [5:0] iobuf_tail_s;
455output [5:0] iobuf_head_f;
456
457
458// interrupt table read result buffer interface
459input intbuf_wr2i2c;
460output [4:0] intbuf_tail_ptr;
461output [4:0] intbuf_head_ptr;
462
463// mb0 signals //
464input [4:0] mb0_raddr;
465input [4:0] mb0_waddr;
466//input mb0_intbuf_sel;
467//input mb0_intbuf_wr_en;
468input mb0_intbuf_rd_en;
469//input mb0_iobuf_sel;
470input mb0_iobuf_rd_en;
471input mb0_run;
472
473// IO buffer interface
474output [4:0] iobuf_head_ptr;
475output iobuf_rden;
476output intbuf_rden;
477
478// Internal signals
479// interrupt buffer head and tail ////
480////
481////
482
483
484////////////////////////////////////////////////////////////////////////
485// Code starts here
486////////////////////////////////////////////////////////////////////////
487 /************************************************************
488 * IO-to-CPX Mux Control
489 ************************************************************/
490 // Generate mux selects
491assign intbuf_sel_next = ~|(cpx_buf_full[7:0] & ~cpx_ncu_grant[7:0] & intbuf_cpx_req[7:0]) &
492 intbuf_vld &
493 ~intbuf_dout_d1_ue ;
494
495assign iobuf_sel_next = ~|(cpx_buf_full[7:0] & ~cpx_ncu_grant[7:0] & iobuf_cpx_req[7:0]) &
496 ~intbuf_sel_next & iobuf_vld &
497 ~iobuf_dout_d1_ue ;
498
499
500 /************************************************************
501 * Flop grant from CPX
502 ************************************************************/
503ncu_i2cfc_ctl_msff_ctl_macro__width_8 cpx_ncu_grant_ff
504 (
505 .scan_in(cpx_ncu_grant_ff_scanin),
506 .scan_out(cpx_ncu_grant_ff_scanout),
507 .dout (cpx_ncu_grant[7:0]),
508 .l1clk (l1clk),
509 .din (cpx_ncu_grant_cx[7:0]),
510 .siclk(siclk),
511 .soclk(soclk)
512 );
513
514
515/************************************************************
516 * Counters to keep track of each CPX's buffer level
517 ************************************************************/
518
519/***********************/
520/***** CPX0 Count ******/
521/***********************/
522//i2c_cpx_cnt count0 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[0]),
523// .cpx_ncu_grant(cpx_ncu_grant[0]), .cpx_buf_full(cpx_buf_full[0]));
524reg [1:0] cpx_cnt0_next;
525// Assertion: request cannot be asserted if count is 2
526// grant cannot be asserted if count is 0
527assign cpx_cnt0_plus1_sel = ncu_cpx_req_next[0] & ~cpx_ncu_grant[0];
528assign cpx_cnt0_minus1_sel = cpx_ncu_grant[0] & ~ncu_cpx_req_next[0];
529assign cpx_cnt0_plus1[1:0] = cpx_cnt0[1:0] + 2'b01;
530assign cpx_cnt0_minus1[1:0] = cpx_cnt0[1:0] - 2'b01;
531always @(cpx_cnt0 or cpx_cnt0_minus1 or cpx_cnt0_minus1_sel or
532 cpx_cnt0_plus1 or cpx_cnt0_plus1_sel)
533 case ({cpx_cnt0_minus1_sel,cpx_cnt0_plus1_sel}) // 0in case -parallel -full
534 2'b01 : cpx_cnt0_next[1:0] = cpx_cnt0_plus1[1:0];
535 2'b10 : cpx_cnt0_next[1:0] = cpx_cnt0_minus1[1:0];
536 default : cpx_cnt0_next[1:0] = cpx_cnt0[1:0];
537 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
538
539ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt0_ff
540 (
541 .scan_in(cpx_cnt0_ff_scanin),
542 .scan_out(cpx_cnt0_ff_scanout),
543 .dout (cpx_cnt0[1:0]),
544 .l1clk (l1clk),
545 .din (cpx_cnt0_next[1:0]),
546 .siclk(siclk),
547 .soclk(soclk)
548 );
549
550assign cpx_buf_full[0] = cpx_cnt0[1];
551
552
553/***********************/
554/***** CPX1 Count ******/
555/***********************/
556//i2c_cpx_cnt count1 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[1]),
557// .cpx_ncu_grant(cpx_ncu_grant[1]), .cpx_buf_full(cpx_buf_full[1]));
558reg [1:0] cpx_cnt1_next;
559// Assertion: request cannot be asserted if count is 2
560// grant cannot be asserted if count is 0
561assign cpx_cnt1_plus1_sel = ncu_cpx_req_next[1] & ~cpx_ncu_grant[1];
562assign cpx_cnt1_minus1_sel = cpx_ncu_grant[1] & ~ncu_cpx_req_next[1];
563assign cpx_cnt1_plus1[1:0] = cpx_cnt1[1:0] + 2'b01;
564assign cpx_cnt1_minus1[1:0] = cpx_cnt1[1:0] - 2'b01;
565always @(cpx_cnt1 or cpx_cnt1_minus1 or cpx_cnt1_minus1_sel or
566 cpx_cnt1_plus1 or cpx_cnt1_plus1_sel)
567 case ({cpx_cnt1_minus1_sel,cpx_cnt1_plus1_sel}) // 0in case -parallel -full
568 2'b01 : cpx_cnt1_next[1:0] = cpx_cnt1_plus1[1:0];
569 2'b10 : cpx_cnt1_next[1:0] = cpx_cnt1_minus1[1:0];
570 default : cpx_cnt1_next[1:0] = cpx_cnt1[1:0];
571 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
572
573ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt1_ff
574 (
575 .scan_in(cpx_cnt1_ff_scanin),
576 .scan_out(cpx_cnt1_ff_scanout),
577 .dout (cpx_cnt1[1:0]),
578 .l1clk (l1clk),
579 .din (cpx_cnt1_next[1:0]),
580 .siclk(siclk),
581 .soclk(soclk)
582 );
583
584assign cpx_buf_full[1] = cpx_cnt1[1];
585
586
587/***********************/
588/***** CPX2 Count ******/
589/***********************/
590//i2c_cpx_cnt count2 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[2]),
591// .cpx_ncu_grant(cpx_ncu_grant[2]), .cpx_buf_full(cpx_buf_full[2]));
592reg [1:0] cpx_cnt2_next;
593// Assertion: request cannot be asserted if count is 2
594// grant cannot be asserted if count is 0
595assign cpx_cnt2_plus1_sel = ncu_cpx_req_next[2] & ~cpx_ncu_grant[2];
596assign cpx_cnt2_minus1_sel = cpx_ncu_grant[2] & ~ncu_cpx_req_next[2];
597assign cpx_cnt2_plus1[1:0] = cpx_cnt2[1:0] + 2'b01;
598assign cpx_cnt2_minus1[1:0] = cpx_cnt2[1:0] - 2'b01;
599always @(cpx_cnt2 or cpx_cnt2_minus1 or cpx_cnt2_minus1_sel or
600 cpx_cnt2_plus1 or cpx_cnt2_plus1_sel)
601 case ({cpx_cnt2_minus1_sel,cpx_cnt2_plus1_sel}) // 0in case -parallel -full
602 2'b01 : cpx_cnt2_next[1:0] = cpx_cnt2_plus1[1:0];
603 2'b10 : cpx_cnt2_next[1:0] = cpx_cnt2_minus1[1:0];
604 default : cpx_cnt2_next[1:0] = cpx_cnt2[1:0];
605 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
606
607ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt2_ff
608 (
609 .scan_in(cpx_cnt2_ff_scanin),
610 .scan_out(cpx_cnt2_ff_scanout),
611 .dout (cpx_cnt2[1:0]),
612 .l1clk (l1clk),
613 .din (cpx_cnt2_next[1:0]),
614 .siclk(siclk),
615 .soclk(soclk)
616 );
617
618assign cpx_buf_full[2] = cpx_cnt2[1];
619
620
621/***********************/
622//***** CPX3 Count *****/
623/***********************/
624//i2c_cpx_cnt count3 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[3]),
625// .cpx_ncu_grant(cpx_ncu_grant[3]), .cpx_buf_full(cpx_buf_full[3]));
626reg [1:0] cpx_cnt3_next;
627// Assertion: request cannot be asserted if count is 2
628// grant cannot be asserted if count is 0
629assign cpx_cnt3_plus1_sel = ncu_cpx_req_next[3] & ~cpx_ncu_grant[3];
630assign cpx_cnt3_minus1_sel = cpx_ncu_grant[3] & ~ncu_cpx_req_next[3];
631assign cpx_cnt3_plus1[1:0] = cpx_cnt3[1:0] + 2'b01;
632assign cpx_cnt3_minus1[1:0] = cpx_cnt3[1:0] - 2'b01;
633always @(cpx_cnt3 or cpx_cnt3_minus1 or cpx_cnt3_minus1_sel or
634 cpx_cnt3_plus1 or cpx_cnt3_plus1_sel)
635 case ({cpx_cnt3_minus1_sel,cpx_cnt3_plus1_sel}) // 0in case -parallel -full
636 2'b01 : cpx_cnt3_next[1:0] = cpx_cnt3_plus1[1:0];
637 2'b10 : cpx_cnt3_next[1:0] = cpx_cnt3_minus1[1:0];
638 default : cpx_cnt3_next[1:0] = cpx_cnt3[1:0];
639 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
640
641ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt3_ff
642 (
643 .scan_in(cpx_cnt3_ff_scanin),
644 .scan_out(cpx_cnt3_ff_scanout),
645 .dout (cpx_cnt3[1:0]),
646 .l1clk (l1clk),
647 .din (cpx_cnt3_next[1:0]),
648 .siclk(siclk),
649 .soclk(soclk)
650 );
651
652assign cpx_buf_full[3] = cpx_cnt3[1];
653
654
655/***********************/
656/***** CPX4 Count ******/
657/***********************/
658//i2c_cpx_cnt count4 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[4]),
659// .cpx_ncu_grant(cpx_ncu_grant[4]), .cpx_buf_full(cpx_buf_full[4]));
660reg [1:0] cpx_cnt4_next;
661// Assertion: request cannot be asserted if count is 2
662// grant cannot be asserted if count is 0
663assign cpx_cnt4_plus1_sel = ncu_cpx_req_next[4] & ~cpx_ncu_grant[4];
664assign cpx_cnt4_minus1_sel = cpx_ncu_grant[4] & ~ncu_cpx_req_next[4];
665assign cpx_cnt4_plus1[1:0] = cpx_cnt4[1:0] + 2'b01;
666assign cpx_cnt4_minus1[1:0] = cpx_cnt4[1:0] - 2'b01;
667always @(cpx_cnt4 or cpx_cnt4_minus1 or cpx_cnt4_minus1_sel or
668 cpx_cnt4_plus1 or cpx_cnt4_plus1_sel)
669 case ({cpx_cnt4_minus1_sel,cpx_cnt4_plus1_sel}) // 0in case -parallel -full
670 2'b01 : cpx_cnt4_next[1:0] = cpx_cnt4_plus1[1:0];
671 2'b10 : cpx_cnt4_next[1:0] = cpx_cnt4_minus1[1:0];
672 default : cpx_cnt4_next[1:0] = cpx_cnt4[1:0];
673 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
674
675ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt4_ff
676 (
677 .scan_in(cpx_cnt4_ff_scanin),
678 .scan_out(cpx_cnt4_ff_scanout),
679 .dout (cpx_cnt4[1:0]),
680 .l1clk (l1clk),
681 .din (cpx_cnt4_next[1:0]),
682 .siclk(siclk),
683 .soclk(soclk)
684 );
685
686assign cpx_buf_full[4] = cpx_cnt4[1];
687
688
689
690/***********************/
691/***** CPX5 Count ******/
692/***********************/
693//i2c_cpx_cnt count5 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[5]),
694// .cpx_ncu_grant(cpx_ncu_grant[5]), .cpx_buf_full(cpx_buf_full[5]));
695reg [1:0] cpx_cnt5_next;
696// Assertion: request cannot be asserted if count is 2
697// grant cannot be asserted if count is 0
698assign cpx_cnt5_plus1_sel = ncu_cpx_req_next[5] & ~cpx_ncu_grant[5];
699assign cpx_cnt5_minus1_sel = cpx_ncu_grant[5] & ~ncu_cpx_req_next[5];
700assign cpx_cnt5_plus1[1:0] = cpx_cnt5[1:0] + 2'b01;
701assign cpx_cnt5_minus1[1:0] = cpx_cnt5[1:0] - 2'b01;
702always @(cpx_cnt5 or cpx_cnt5_minus1 or cpx_cnt5_minus1_sel or
703 cpx_cnt5_plus1 or cpx_cnt5_plus1_sel)
704 case ({cpx_cnt5_minus1_sel,cpx_cnt5_plus1_sel}) // 0in case -parallel -full
705 2'b01 : cpx_cnt5_next[1:0] = cpx_cnt5_plus1[1:0];
706 2'b10 : cpx_cnt5_next[1:0] = cpx_cnt5_minus1[1:0];
707 default : cpx_cnt5_next[1:0] = cpx_cnt5[1:0];
708 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
709
710ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt5_ff
711 (
712 .scan_in(cpx_cnt5_ff_scanin),
713 .scan_out(cpx_cnt5_ff_scanout),
714 .dout (cpx_cnt5[1:0]),
715 .l1clk (l1clk),
716 .din (cpx_cnt5_next[1:0]),
717 .siclk(siclk),
718 .soclk(soclk)
719 );
720
721assign cpx_buf_full[5] = cpx_cnt5[1];
722
723
724
725/***********************/
726/***** CPX6 Count ******/
727/***********************/
728//i2c_cpx_cnt count6 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[6]),
729// .cpx_ncu_grant(cpx_ncu_grant[6]), .cpx_buf_full(cpx_buf_full[6]));
730reg [1:0] cpx_cnt6_next;
731// Assertion: request cannot be asserted if count is 2
732// grant cannot be asserted if count is 0
733assign cpx_cnt6_plus1_sel = ncu_cpx_req_next[6] & ~cpx_ncu_grant[6];
734assign cpx_cnt6_minus1_sel = cpx_ncu_grant[6] & ~ncu_cpx_req_next[6];
735assign cpx_cnt6_plus1[1:0] = cpx_cnt6[1:0] + 2'b01;
736assign cpx_cnt6_minus1[1:0] = cpx_cnt6[1:0] - 2'b01;
737always @(cpx_cnt6 or cpx_cnt6_minus1 or cpx_cnt6_minus1_sel or
738 cpx_cnt6_plus1 or cpx_cnt6_plus1_sel)
739 case ({cpx_cnt6_minus1_sel,cpx_cnt6_plus1_sel}) // 0in case -parallel -full
740 2'b01 : cpx_cnt6_next[1:0] = cpx_cnt6_plus1[1:0];
741 2'b10 : cpx_cnt6_next[1:0] = cpx_cnt6_minus1[1:0];
742 default : cpx_cnt6_next[1:0] = cpx_cnt6[1:0];
743 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
744
745ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt6_ff
746 (
747 .scan_in(cpx_cnt6_ff_scanin),
748 .scan_out(cpx_cnt6_ff_scanout),
749 .dout (cpx_cnt6[1:0]),
750 .l1clk (l1clk),
751 .din (cpx_cnt6_next[1:0]),
752 .siclk(siclk),
753 .soclk(soclk)
754 );
755
756assign cpx_buf_full[6] = cpx_cnt6[1];
757
758
759
760/***********************/
761/***** CPX7 Count ******/
762/***********************/
763//i2c_cpx_cnt count7 ( .clk(l2clk), .ncu_cpx_req_next(ncu_cpx_req_next[7]),
764// .cpx_ncu_grant(cpx_ncu_grant[7]), .cpx_buf_full(cpx_buf_full[7]));
765reg [1:0] cpx_cnt7_next;
766// Assertion: request cannot be asserted if count is 2
767// grant cannot be asserted if count is 0
768assign cpx_cnt7_plus1_sel = ncu_cpx_req_next[7] & ~cpx_ncu_grant[7];
769assign cpx_cnt7_minus1_sel = cpx_ncu_grant[7] & ~ncu_cpx_req_next[7];
770assign cpx_cnt7_plus1[1:0] = cpx_cnt7[1:0] + 2'b01;
771assign cpx_cnt7_minus1[1:0] = cpx_cnt7[1:0] - 2'b01;
772always @(cpx_cnt7 or cpx_cnt7_minus1 or cpx_cnt7_minus1_sel or
773 cpx_cnt7_plus1 or cpx_cnt7_plus1_sel)
774 case ({cpx_cnt7_minus1_sel,cpx_cnt7_plus1_sel}) // 0in case -parallel -full
775 2'b01 : cpx_cnt7_next[1:0] = cpx_cnt7_plus1[1:0];
776 2'b10 : cpx_cnt7_next[1:0] = cpx_cnt7_minus1[1:0];
777 default : cpx_cnt7_next[1:0] = cpx_cnt7[1:0];
778 endcase //case(cpx_cnt_plus1_sel,cpx_cnt_minus1_sel)
779
780ncu_i2cfc_ctl_msff_ctl_macro__width_2 cpx_cnt7_ff
781 (
782 .scan_in(cpx_cnt7_ff_scanin),
783 .scan_out(cpx_cnt7_ff_scanout),
784 .dout (cpx_cnt7[1:0]),
785 .l1clk (l1clk),
786 .din (cpx_cnt7_next[1:0]),
787 .siclk(siclk),
788 .soclk(soclk)
789 );
790
791assign cpx_buf_full[7] = cpx_cnt7[1];
792
793
794
795/************************************************************
796 * Interrupt Status Table Read Result Buffer Control
797 * An 16 deep buffer to store interrupt table read results.
798 *
799 * __decode int stat table read
800 * flop req |
801 * | | __read int stat table here
802 * | | |
803 * | | | __flop read result
804 * | | | |
805 * | | | | __tail pointer increment
806 * | | | | |
807 * | | | | | compute hwm __stall sent here
808 * | | | | | | |
809 * V V V V d2 V V V
810 * PQ PA PX1 rptr PX2 C1 C2 C3 C4 C5 rptr
811 * PQ PA PX1 rptr PX2 C1 C2 C3 C4 C5 rptr
812 * PQ PA PX1 rptr PX2 C1 C2 C3 C4
813 * PQ PA PX1 rptr PX2 C1 C2 C3
814 * PQ PA PX1 rptr PX2 C1 C2
815 * PQ PA PX1 rptr PX2 C1
816 * PQ PA PX1 rptr PX2
817 * PQ PA PX1 rptr
818 * PQ PA PX1 rptr
819 * PQ PA PX1 rptr
820 * PQ PA PX1
821 * --> PQ
822 * |
823 * |
824 * packet in this PQ is stalled
825 *
826 * When stall is signalled, there can potentially be 10 packets in C4, C3,
827 * C2, C1, PX2, rptr, PX1, PA, PQ, and PQ-1 that need to be queued in the CPU shared buffer.
828 ************************************************************/
829//assign cpu_mondo_rdwr_d2 = cpu_mondo_rd_d2 | cpu_mondo_wr_d2;
830//assign intbuf_wr = cpu_mondo_rdwr_d2;
831
832 // Tail pointer to interrupt table read result buffer
833assign intbuf_tail_plus[5:0] = intbuf_tail[5:0] + 6'd1;
834assign intbuf_tail_ptr[4:0] = mb0_run ? mb0_waddr[4:0] : intbuf_tail[4:0];
835ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_6 intbuf_tail_ff
836 (
837 .scan_in(intbuf_tail_ff_scanin),
838 .scan_out(intbuf_tail_ff_scanout),
839 .dout (intbuf_tail[5:0]),
840 .l1clk (l1clk),
841 .en (intbuf_wr2i2c),
842 .din (intbuf_tail_plus[5:0]),
843 .siclk(siclk),
844 .soclk(soclk)
845 );
846
847assign intbuf_tail_plus10[5:0] = intbuf_tail[5:0] + 6'd8;
848assign intbuf_hit_hwm = ((intbuf_tail_plus10[5] != intbuf_head[5]) &
849 (intbuf_tail_plus10[4:0] >= intbuf_head[4:0])) |
850 ((intbuf_tail_plus10[5] == intbuf_head[5]) &
851 (intbuf_tail_plus10[4:0] <= intbuf_head[4:0]));
852
853
854/************************************************************
855 * INT Buffer Control
856 ************************************************************/
857ncu_i2cfc_ctl_msff_ctl_macro__width_6 intbuf_head_d1_ff
858 (
859 .scan_in(intbuf_head_d1_ff_scanin),
860 .scan_out(intbuf_head_d1_ff_scanout),
861 .dout (intbuf_head_d1[5:0]),
862 .l1clk (l1clk),
863 .din (intbuf_head[5:0]),
864 .siclk(siclk),
865 .soclk(soclk)
866 );
867
868//assign mb0_intbuf_sel = mb0_run & mb0_intbuf_rd_en;
869assign intbuf_head_ptr[4:0] = mb0_run ? mb0_raddr[4:0] : intbuf_head[4:0];
870
871assign int_pipe_full = ~int_aov ? (int_pav & int_pbv & intbuf_vld) :
872 ~int_pav ? (int_pbv & intbuf_vld) :
873 ~int_pbv ? (intbuf_vld) : 1'b1 ;
874
875assign intbuf_head_inc = int_aog & (intrd | ~int_pipe_full) ;
876assign intbuf_head[5:0] = intbuf_head_inc ? intbuf_head_d1[5:0]+6'h01 : intbuf_head_d1[5:0] ;
877
878assign intbuf_rden = mb0_run ? mb0_intbuf_rd_en : (intbuf_tail[4:0] != intbuf_head[4:0]) ;
879ncu_i2cfc_ctl_msff_ctl_macro__width_1 int_aog_ff
880 (
881 .scan_in(int_aog_ff_scanin),
882 .scan_out(int_aog_ff_scanout),
883 .dout (int_aog),
884 .l1clk (l1clk),
885 .din (intbuf_rden),
886 .siclk(siclk),
887 .soclk(soclk)
888 );
889
890assign int_aov_next = intbuf_rden & (intbuf_head_inc | ~int_aog);
891ncu_i2cfc_ctl_msff_ctl_macro__width_1 int_aov_ff
892 (
893 .scan_in(int_aov_ff_scanin),
894 .scan_out(int_aov_ff_scanout),
895 .dout (int_aov),
896 .l1clk (l1clk),
897 .din (int_aov_next),
898 .siclk(siclk),
899 .soclk(soclk)
900 );
901
902assign int_pa_ld = (int_pav==intbuf_rd) ;
903ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_1 int_pav_ff
904 (
905 .scan_in(int_pav_ff_scanin),
906 .scan_out(int_pav_ff_scanout),
907 .dout (int_pav),
908 .l1clk (l1clk),
909 .en (int_pa_ld),
910 .din (int_pbv),
911 .siclk(siclk),
912 .soclk(soclk)
913 );
914
915assign int_pb_ld = (~int_pav | intbuf_rd | ~int_pbv) ;
916ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_1 int_pbv_ff
917 (
918 .scan_in(int_pbv_ff_scanin),
919 .scan_out(int_pbv_ff_scanout),
920 .dout (int_pbv),
921 .l1clk (l1clk),
922 .en (int_pb_ld),
923 .din (int_aov),
924 .siclk(siclk),
925 .soclk(soclk)
926 );
927
928assign int_pbs_next = int_pas ? (int_aov & !int_pbv & int_pav)&intrd : intbuf_rd ;
929ncu_i2cfc_ctl_msff_ctl_macro__width_1 int_pbs_ff
930 (
931 .scan_in(int_pbs_ff_scanin),
932 .scan_out(int_pbs_ff_scanout),
933 .dout (int_pbs),
934 .l1clk (l1clk),
935 .din (int_pbs_next),
936 .siclk(siclk),
937 .soclk(soclk)
938 );
939
940assign int_pas = ~int_pbs;
941assign int_mov = int_pas ? int_pav : int_pbv ;
942assign intbuf_rd = int_mov & (~intbuf_vld | intrd) ;
943
944assign intbuf_vld_next = intbuf_rd | (intbuf_vld & ~intbuf_sel_next & ~intbuf_dout_d1_ue);
945
946assign intrd = intbuf_vld & (intbuf_sel_next|intbuf_dout_d1_ue) ;
947
948ncu_i2cfc_ctl_msff_ctl_macro__width_1 intbuf_vld_ff
949 (
950 .scan_in(intbuf_vld_ff_scanin),
951 .scan_out(intbuf_vld_ff_scanout),
952 .dout (intbuf_vld),
953 .l1clk (l1clk),
954 .din (intbuf_vld_next),
955 .siclk(siclk),
956 .soclk(soclk)
957 );
958
959
960
961/************************************************************
962 * IO Buffer Control
963 ************************************************************/
964// Flop tail pointer once to convert to cpu clock domain
965ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_6 iobuf_tail_ff
966 (
967 .scan_in(iobuf_tail_ff_scanin),
968 .scan_out(iobuf_tail_ff_scanout),
969 .dout (iobuf_tail[5:0]),
970 .l1clk (l1clk),
971 .en (io_cmp_sync_en),
972 .din (iobuf_tail_s[5:0]),
973 .siclk(siclk),
974 .soclk(soclk)
975 );
976
977ncu_i2cfc_ctl_msff_ctl_macro__width_6 iobuf_head_d1_ff
978 (
979 .scan_in(iobuf_head_d1_ff_scanin),
980 .scan_out(iobuf_head_d1_ff_scanout),
981 .dout (iobuf_head_d1[5:0]),
982 .l1clk (l1clk),
983 .din (iobuf_head[5:0]),
984 .siclk(siclk),
985 .soclk(soclk)
986 );
987//assign mb0_iobuf_sel = mb0_run & mb0_iobuf_rd_en;
988assign iobuf_head_ptr[4:0] = mb0_run ? mb0_raddr[4:0] : iobuf_head[4:0];
989ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_6 iobuf_head_f_ff
990 (
991 .scan_in(iobuf_head_f_ff_scanin),
992 .scan_out(iobuf_head_f_ff_scanout),
993 .dout (iobuf_head_f[5:0]),
994 .l1clk (l1clk),
995 .en (cmp_io_sync_en),
996 .din (iobuf_head[5:0]),
997 .siclk(siclk),
998 .soclk(soclk)
999 );
1000
1001assign io_pipe_full = ~io_aov ? (io_pav & io_pbv & iobuf_vld) :
1002 ~io_pav ? (io_pbv & iobuf_vld) :
1003 ~io_pbv ? (iobuf_vld) : 1'b1 ;
1004
1005assign iobuf_head_inc = io_aog & (iord | ~io_pipe_full) ;
1006assign iobuf_head[5:0] = iobuf_head_inc ? iobuf_head_d1[5:0]+6'h01 : iobuf_head_d1[5:0] ;
1007
1008assign iobuf_rden = mb0_run ? mb0_iobuf_rd_en : (iobuf_tail[5:0] != iobuf_head[5:0]) ;
1009ncu_i2cfc_ctl_msff_ctl_macro__width_1 io_aog_ff
1010 (
1011 .scan_in(io_aog_ff_scanin),
1012 .scan_out(io_aog_ff_scanout),
1013 .dout (io_aog),
1014 .l1clk (l1clk),
1015 .din (iobuf_rden),
1016 .siclk(siclk),
1017 .soclk(soclk)
1018 );
1019
1020assign io_aov_next = iobuf_rden & (iobuf_head_inc | ~io_aog);
1021ncu_i2cfc_ctl_msff_ctl_macro__width_1 io_aov_ff
1022 (
1023 .scan_in(io_aov_ff_scanin),
1024 .scan_out(io_aov_ff_scanout),
1025 .dout (io_aov),
1026 .l1clk (l1clk),
1027 .din (io_aov_next),
1028 .siclk(siclk),
1029 .soclk(soclk)
1030 );
1031
1032assign io_pa_ld = (io_pav==iobuf_rd) ;
1033ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_1 io_pav_ff
1034 (
1035 .scan_in(io_pav_ff_scanin),
1036 .scan_out(io_pav_ff_scanout),
1037 .dout (io_pav),
1038 .l1clk (l1clk),
1039 .en (io_pa_ld),
1040 .din (io_pbv),
1041 .siclk(siclk),
1042 .soclk(soclk)
1043 );
1044
1045assign io_pb_ld = (~io_pav | iobuf_rd | ~io_pbv) ;
1046ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_1 io_pbv_ff
1047 (
1048 .scan_in(io_pbv_ff_scanin),
1049 .scan_out(io_pbv_ff_scanout),
1050 .dout (io_pbv),
1051 .l1clk (l1clk),
1052 .en (io_pb_ld),
1053 .din (io_aov),
1054 .siclk(siclk),
1055 .soclk(soclk)
1056 );
1057
1058assign io_pbs_next = io_pas ? (io_aov & !io_pbv & io_pav)&iord : iobuf_rd ;
1059ncu_i2cfc_ctl_msff_ctl_macro__width_1 io_pbs_ff
1060 (
1061 .scan_in(io_pbs_ff_scanin),
1062 .scan_out(io_pbs_ff_scanout),
1063 .dout (io_pbs),
1064 .l1clk (l1clk),
1065 .din (io_pbs_next),
1066 .siclk(siclk),
1067 .soclk(soclk)
1068 );
1069
1070assign io_pas = ~io_pbs;
1071assign io_mov = io_pas ? io_pav : io_pbv ;
1072assign iobuf_rd = io_mov & (~iobuf_vld | iord) ;
1073
1074assign iobuf_vld_next = iobuf_rd | (iobuf_vld & ~iobuf_sel_next & ~iobuf_dout_d1_ue);
1075
1076assign iord = iobuf_vld & (iobuf_sel_next|iobuf_dout_d1_ue) ;
1077
1078ncu_i2cfc_ctl_msff_ctl_macro__width_1 iobuf_vld_ff
1079 (
1080 .scan_in(iobuf_vld_ff_scanin),
1081 .scan_out(iobuf_vld_ff_scanout),
1082 .dout (iobuf_vld),
1083 .l1clk (l1clk),
1084 .din (iobuf_vld_next),
1085 .siclk(siclk),
1086 .soclk(soclk)
1087 );
1088
1089
1090/**** adding clock header ****/
1091ncu_i2cfc_ctl_l1clkhdr_ctl_macro clkgen (
1092 .l2clk (l2clk),
1093 .l1en (1'b1),
1094 .l1clk (l1clk),
1095 .pce_ov(pce_ov),
1096 .stop(stop),
1097 .se(se)
1098 );
1099
1100/*** building tcu port ***/
1101assign siclk = tcu_aclk;
1102assign soclk = tcu_bclk;
1103assign se = tcu_scan_en;
1104assign pce_ov = tcu_pce_ov;
1105assign stop = tcu_clk_stop;
1106
1107// fixscan start:
1108assign cpx_ncu_grant_ff_scanin = scan_in ;
1109assign cpx_cnt0_ff_scanin = cpx_ncu_grant_ff_scanout ;
1110assign cpx_cnt1_ff_scanin = cpx_cnt0_ff_scanout ;
1111assign cpx_cnt2_ff_scanin = cpx_cnt1_ff_scanout ;
1112assign cpx_cnt3_ff_scanin = cpx_cnt2_ff_scanout ;
1113assign cpx_cnt4_ff_scanin = cpx_cnt3_ff_scanout ;
1114assign cpx_cnt5_ff_scanin = cpx_cnt4_ff_scanout ;
1115assign cpx_cnt6_ff_scanin = cpx_cnt5_ff_scanout ;
1116assign cpx_cnt7_ff_scanin = cpx_cnt6_ff_scanout ;
1117assign intbuf_tail_ff_scanin = cpx_cnt7_ff_scanout ;
1118assign intbuf_head_d1_ff_scanin = intbuf_tail_ff_scanout ;
1119assign int_aog_ff_scanin = intbuf_head_d1_ff_scanout;
1120assign int_aov_ff_scanin = int_aog_ff_scanout ;
1121assign int_pav_ff_scanin = int_aov_ff_scanout ;
1122assign int_pbv_ff_scanin = int_pav_ff_scanout ;
1123assign int_pbs_ff_scanin = int_pbv_ff_scanout ;
1124assign intbuf_vld_ff_scanin = int_pbs_ff_scanout ;
1125assign iobuf_tail_ff_scanin = intbuf_vld_ff_scanout ;
1126assign iobuf_head_d1_ff_scanin = iobuf_tail_ff_scanout ;
1127assign iobuf_head_f_ff_scanin = iobuf_head_d1_ff_scanout ;
1128assign io_aog_ff_scanin = iobuf_head_f_ff_scanout ;
1129assign io_aov_ff_scanin = io_aog_ff_scanout ;
1130assign io_pav_ff_scanin = io_aov_ff_scanout ;
1131assign io_pbv_ff_scanin = io_pav_ff_scanout ;
1132assign io_pbs_ff_scanin = io_pbv_ff_scanout ;
1133assign iobuf_vld_ff_scanin = io_pbs_ff_scanout ;
1134assign scan_out = iobuf_vld_ff_scanout ;
1135// fixscan end:
1136endmodule // i2c_fctrl
1137
1138
1139
1140
1141
1142
1143
1144
1145// any PARAMS parms go into naming of macro
1146
1147module ncu_i2cfc_ctl_msff_ctl_macro__width_8 (
1148 din,
1149 l1clk,
1150 scan_in,
1151 siclk,
1152 soclk,
1153 dout,
1154 scan_out);
1155wire [7:0] fdin;
1156wire [6:0] so;
1157
1158 input [7:0] din;
1159 input l1clk;
1160 input scan_in;
1161
1162
1163 input siclk;
1164 input soclk;
1165
1166 output [7:0] dout;
1167 output scan_out;
1168assign fdin[7:0] = din[7:0];
1169
1170
1171
1172
1173
1174
1175dff #(8) d0_0 (
1176.l1clk(l1clk),
1177.siclk(siclk),
1178.soclk(soclk),
1179.d(fdin[7:0]),
1180.si({scan_in,so[6:0]}),
1181.so({so[6:0],scan_out}),
1182.q(dout[7:0])
1183);
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196endmodule
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210// any PARAMS parms go into naming of macro
1211
1212module ncu_i2cfc_ctl_msff_ctl_macro__width_2 (
1213 din,
1214 l1clk,
1215 scan_in,
1216 siclk,
1217 soclk,
1218 dout,
1219 scan_out);
1220wire [1:0] fdin;
1221wire [0:0] so;
1222
1223 input [1:0] din;
1224 input l1clk;
1225 input scan_in;
1226
1227
1228 input siclk;
1229 input soclk;
1230
1231 output [1:0] dout;
1232 output scan_out;
1233assign fdin[1:0] = din[1:0];
1234
1235
1236
1237
1238
1239
1240dff #(2) d0_0 (
1241.l1clk(l1clk),
1242.siclk(siclk),
1243.soclk(soclk),
1244.d(fdin[1:0]),
1245.si({scan_in,so[0:0]}),
1246.so({so[0:0],scan_out}),
1247.q(dout[1:0])
1248);
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261endmodule
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275// any PARAMS parms go into naming of macro
1276
1277module ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_6 (
1278 din,
1279 en,
1280 l1clk,
1281 scan_in,
1282 siclk,
1283 soclk,
1284 dout,
1285 scan_out);
1286wire [5:0] fdin;
1287wire [4:0] so;
1288
1289 input [5:0] din;
1290 input en;
1291 input l1clk;
1292 input scan_in;
1293
1294
1295 input siclk;
1296 input soclk;
1297
1298 output [5:0] dout;
1299 output scan_out;
1300assign fdin[5:0] = (din[5:0] & {6{en}}) | (dout[5:0] & ~{6{en}});
1301
1302
1303
1304
1305
1306
1307dff #(6) d0_0 (
1308.l1clk(l1clk),
1309.siclk(siclk),
1310.soclk(soclk),
1311.d(fdin[5:0]),
1312.si({scan_in,so[4:0]}),
1313.so({so[4:0],scan_out}),
1314.q(dout[5:0])
1315);
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328endmodule
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342// any PARAMS parms go into naming of macro
1343
1344module ncu_i2cfc_ctl_msff_ctl_macro__width_6 (
1345 din,
1346 l1clk,
1347 scan_in,
1348 siclk,
1349 soclk,
1350 dout,
1351 scan_out);
1352wire [5:0] fdin;
1353wire [4:0] so;
1354
1355 input [5:0] din;
1356 input l1clk;
1357 input scan_in;
1358
1359
1360 input siclk;
1361 input soclk;
1362
1363 output [5:0] dout;
1364 output scan_out;
1365assign fdin[5:0] = din[5:0];
1366
1367
1368
1369
1370
1371
1372dff #(6) d0_0 (
1373.l1clk(l1clk),
1374.siclk(siclk),
1375.soclk(soclk),
1376.d(fdin[5:0]),
1377.si({scan_in,so[4:0]}),
1378.so({so[4:0],scan_out}),
1379.q(dout[5:0])
1380);
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393endmodule
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407// any PARAMS parms go into naming of macro
1408
1409module ncu_i2cfc_ctl_msff_ctl_macro__width_1 (
1410 din,
1411 l1clk,
1412 scan_in,
1413 siclk,
1414 soclk,
1415 dout,
1416 scan_out);
1417wire [0:0] fdin;
1418
1419 input [0:0] din;
1420 input l1clk;
1421 input scan_in;
1422
1423
1424 input siclk;
1425 input soclk;
1426
1427 output [0:0] dout;
1428 output scan_out;
1429assign fdin[0:0] = din[0:0];
1430
1431
1432
1433
1434
1435
1436dff #(1) d0_0 (
1437.l1clk(l1clk),
1438.siclk(siclk),
1439.soclk(soclk),
1440.d(fdin[0:0]),
1441.si(scan_in),
1442.so(scan_out),
1443.q(dout[0:0])
1444);
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457endmodule
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471// any PARAMS parms go into naming of macro
1472
1473module ncu_i2cfc_ctl_msff_ctl_macro__en_1__width_1 (
1474 din,
1475 en,
1476 l1clk,
1477 scan_in,
1478 siclk,
1479 soclk,
1480 dout,
1481 scan_out);
1482wire [0:0] fdin;
1483
1484 input [0:0] din;
1485 input en;
1486 input l1clk;
1487 input scan_in;
1488
1489
1490 input siclk;
1491 input soclk;
1492
1493 output [0:0] dout;
1494 output scan_out;
1495assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
1496
1497
1498
1499
1500
1501
1502dff #(1) d0_0 (
1503.l1clk(l1clk),
1504.siclk(siclk),
1505.soclk(soclk),
1506.d(fdin[0:0]),
1507.si(scan_in),
1508.so(scan_out),
1509.q(dout[0:0])
1510);
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523endmodule
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537// any PARAMS parms go into naming of macro
1538
1539module ncu_i2cfc_ctl_l1clkhdr_ctl_macro (
1540 l2clk,
1541 l1en,
1542 pce_ov,
1543 stop,
1544 se,
1545 l1clk);
1546
1547
1548 input l2clk;
1549 input l1en;
1550 input pce_ov;
1551 input stop;
1552 input se;
1553 output l1clk;
1554
1555
1556
1557
1558
1559cl_sc1_l1hdr_8x c_0 (
1560
1561
1562 .l2clk(l2clk),
1563 .pce(l1en),
1564 .l1clk(l1clk),
1565 .se(se),
1566 .pce_ov(pce_ov),
1567 .stop(stop)
1568);
1569
1570
1571
1572endmodule
1573
1574
1575
1576
1577
1578
1579
1580