Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / ncu / rtl / ncu_c2ifc_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ncu_c2ifc_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_c2ifc_ctl (
229 l2clk,
230 cmp_io_sync_en,
231 io_cmp_sync_en,
232 tcu_scan_en,
233 scan_in,
234 scan_out,
235 tcu_pce_ov,
236 tcu_clk_stop,
237 tcu_aclk,
238 tcu_bclk,
239 pcx_ncu_data_rdy_px1,
240 ncu_pcx_stall_pq,
241 pcx_ncu_vld,
242 pcx_ncu_req,
243 pcx_ncu_addr,
244 pcx_ncu_cputhr,
245 io_mondo_data_wr,
246 mondo_data_bypass_d2,
247 mondo_addr_creg_mdata0_dec_d2,
248 mondo_addr_creg_mdata1_dec_d2,
249 mondo_addr_creg_mbusy_dec_d2,
250 tap_mondo_rd_d2,
251 cpu_mondo_addr_invld_d2,
252 cpubuf_head_s,
253 cpubuf_tail_f,
254 intbuf_wr,
255 intbuf_wr2i2c,
256 cpu_mondo_rd_d2,
257 intbuf_hit_hwm,
258 io_mondo_data_wr_s,
259 io_mondo_data_wr_addr_s,
260 tap_mondo_acc_addr_s,
261 tap_mondo_acc_seq_s,
262 tap_mondo_wr_s,
263 tap_mondo_acc_addr_invld_d2_f,
264 tap_mondo_acc_seq_d2_f,
265 mondo_data_addr_p0,
266 mondo_busy_addr_p0,
267 mondo_data_addr_p1,
268 mondo_busy_addr_p1,
269 mondo_busy_wr_p1,
270 mondo_busy_addr_p2,
271 mondo_busy_wr_p2,
272 mondo_data0_wr,
273 mondo_data1_wr,
274 cpubuf_wr,
275 cpubuf_tail_ptr,
276 mb0_mondo_wr_en,
277 mb0_waddr,
278 mb0_raddr,
279 mb0_run,
280 mb1_run,
281 mb1_waddr,
282 mb1_cpubuf_wr_en,
283 mb0_intbuf_wr_en) ;
284wire pcx_ncu_data_rdy_px2_ff_scanin;
285wire pcx_ncu_data_rdy_px2_ff_scanout;
286wire pcx_ncu_data_rdy_px2;
287wire l1clk;
288wire pcx_ncu_data_rdy_ff_scanin;
289wire pcx_ncu_data_rdy_ff_scanout;
290wire pcx_ncu_data_rdy;
291wire cpu_mondo_acc;
292wire cpu_mondo_rd;
293wire cpu_mondo_wr;
294wire cpu_mondo_rd_d1_ff_scanin;
295wire cpu_mondo_rd_d1_ff_scanout;
296wire cpu_mondo_rd_d1;
297wire cpu_mondo_rd_d2_ff_scanin;
298wire cpu_mondo_rd_d2_ff_scanout;
299wire cpu_mondo_wr_d1_ff_scanin;
300wire cpu_mondo_wr_d1_ff_scanout;
301wire cpu_mondo_wr_d1;
302wire cpu_mondo_wr_d2_ff_scanin;
303wire cpu_mondo_wr_d2_ff_scanout;
304wire cpu_mondo_wr_d2;
305wire cpu_mondo_rd_wr;
306wire cpu_mondo_rd_wr_d2;
307wire cpu_mondo_rd_wr_ff_scanin;
308wire cpu_mondo_rd_wr_ff_scanout;
309wire intbuf_wr2i2c_ff_scanin;
310wire intbuf_wr2i2c_ff_scanout;
311wire c_creg_mdata0_alias_dec;
312wire c_creg_mdata1_alias_dec;
313wire c_creg_mbusy_alias_dec;
314wire c_creg_mdata0_proper_dec;
315wire c_creg_mdata1_proper_dec;
316wire c_creg_mbusy_proper_dec;
317wire c_use_thr_addr;
318wire [5:0] cpu_mondo_data_addr;
319wire cpu_mondo_addr_creg_mdata0_dec;
320wire cpu_mondo_addr_creg_mdata1_dec;
321wire cpu_mondo_addr_creg_mbusy_dec;
322wire cpu_mondo_addr_invld;
323wire cpu_mondo_addr_creg_mdata0_dec_d1_ff_scanin;
324wire cpu_mondo_addr_creg_mdata0_dec_d1_ff_scanout;
325wire cpu_mondo_addr_creg_mdata0_dec_d1;
326wire cpu_mondo_addr_creg_mdata1_dec_d1_ff_scanin;
327wire cpu_mondo_addr_creg_mdata1_dec_d1_ff_scanout;
328wire cpu_mondo_addr_creg_mdata1_dec_d1;
329wire cpu_mondo_addr_creg_mbusy_dec_d1_ff_scanin;
330wire cpu_mondo_addr_creg_mbusy_dec_d1_ff_scanout;
331wire cpu_mondo_addr_creg_mbusy_dec_d1;
332wire cpu_mondo_addr_invld_d1_ff_scanin;
333wire cpu_mondo_addr_invld_d1_ff_scanout;
334wire cpu_mondo_addr_invld_d1;
335wire cpu_mondo_addr_invld_d2_ff_scanin;
336wire cpu_mondo_addr_invld_d2_ff_scanout;
337wire io_mondo_data_wr_ff_scanin;
338wire io_mondo_data_wr_ff_scanout;
339wire io_mondo_data_addr_ff_scanin;
340wire io_mondo_data_addr_ff_scanout;
341wire [5:0] io_mondo_data_addr;
342wire tap_mondo_acc_addr_ff_scanin;
343wire tap_mondo_acc_addr_ff_scanout;
344wire [21:0] tap_mondo_acc_addr;
345wire t_creg_mdata0_alias_dec;
346wire t_creg_mdata1_alias_dec;
347wire t_creg_mbusy_alias_dec;
348wire t_creg_mdata0_proper_dec;
349wire t_creg_mdata1_proper_dec;
350wire t_creg_mbusy_proper_dec;
351wire t_use_thr_addr;
352wire [5:0] tap_mondo_data_addr;
353wire tap_mondo_addr_creg_mdata0_dec;
354wire tap_mondo_addr_creg_mdata1_dec;
355wire tap_mondo_addr_creg_mbusy_dec;
356wire tap_mondo_addr_invld;
357wire tap_mondo_addr_creg_mdata0_dec_d1_ff_scanin;
358wire tap_mondo_addr_creg_mdata0_dec_d1_ff_scanout;
359wire tap_mondo_addr_creg_mdata0_dec_d1;
360wire tap_mondo_acc;
361wire tap_mondo_addr_creg_mdata1_dec_d1_ff_scanin;
362wire tap_mondo_addr_creg_mdata1_dec_d1_ff_scanout;
363wire tap_mondo_addr_creg_mdata1_dec_d1;
364wire tap_mondo_addr_creg_mbusy_dec_d1_ff_scanin;
365wire tap_mondo_addr_creg_mbusy_dec_d1_ff_scanout;
366wire tap_mondo_addr_creg_mbusy_dec_d1;
367wire tap_mondo_addr_invld_d1_ff_scanin;
368wire tap_mondo_addr_invld_d1_ff_scanout;
369wire tap_mondo_addr_invld_d1;
370wire tap_mondo_addr_invld_d2_ff_scanin;
371wire tap_mondo_addr_invld_d2_ff_scanout;
372wire tap_mondo_addr_invld_d2;
373wire tap_mondo_acc_addr_invld_d2_f_ff_scanin;
374wire tap_mondo_acc_addr_invld_d2_f_ff_scanout;
375wire tap_mondo_acc_seq_ff_scanin;
376wire tap_mondo_acc_seq_ff_scanout;
377wire tap_mondo_acc_seq;
378wire tap_mondo_acc_seq_d1_ff_scanin;
379wire tap_mondo_acc_seq_d1_ff_scanout;
380wire tap_mondo_acc_seq_d1;
381wire tap_mondo_acc_seq_d2_ff_scanin;
382wire tap_mondo_acc_seq_d2_ff_scanout;
383wire tap_mondo_acc_seq_d2;
384wire tap_mondo_acc_seq_d2_f_ff_scanin;
385wire tap_mondo_acc_seq_d2_f_ff_scanout;
386wire tap_mondo_wr_ff_scanin;
387wire tap_mondo_wr_ff_scanout;
388wire tap_mondo_wr;
389wire tap_mondo_rd;
390wire tap_mondo_rd_d1_ff_scanin;
391wire tap_mondo_rd_d1_ff_scanout;
392wire tap_mondo_rd_d1;
393wire tap_mondo_rd_d2_ff_scanin;
394wire tap_mondo_rd_d2_ff_scanout;
395wire mondo_addr_creg_mdata0_dec_d1;
396wire mondo_addr_creg_mdata0_dec_d2_ff_scanin;
397wire mondo_addr_creg_mdata0_dec_d2_ff_scanout;
398wire mondo_addr_creg_mdata1_dec_d1;
399wire mondo_addr_creg_mdata1_dec_d2_ff_scanin;
400wire mondo_addr_creg_mdata1_dec_d2_ff_scanout;
401wire mondo_addr_creg_mbusy_dec_d1;
402wire mondo_addr_creg_mbusy_dec_d2_ff_scanin;
403wire mondo_addr_creg_mbusy_dec_d2_ff_scanout;
404wire mondo_data0_wr_f;
405wire mondo_data1_wr_f;
406wire mondo_data_wr_d1_ff_scanin;
407wire mondo_data_wr_d1_ff_scanout;
408wire mondo_data_wr_d1;
409wire mondo_data_addr_p0_d1_ff_scanin;
410wire mondo_data_addr_p0_d1_ff_scanout;
411wire [5:0] mondo_data_addr_p0_d1;
412wire mondo_data_addr_p1_d1_ff_scanin;
413wire mondo_data_addr_p1_d1_ff_scanout;
414wire [5:0] mondo_data_addr_p1_d1;
415wire mondo_data_bypass_d1;
416wire mondo_data_bypass_d2_ff_scanin;
417wire mondo_data_bypass_d2_ff_scanout;
418wire cpubuf_tail_ff_scanin;
419wire cpubuf_tail_ff_scanout;
420wire [5:0] cpubuf_tail;
421wire [5:0] cpubuf_tail_plus;
422wire cpubuf_tail_f_ff_scanin;
423wire cpubuf_tail_f_ff_scanout;
424wire cpubuf_head_ff_scanin;
425wire cpubuf_head_ff_scanout;
426wire [5:0] cpubuf_head;
427wire [5:0] cpubuf_tail_plus6;
428wire cpubuf_hit_hwm;
429wire ncu_pcx_stall_pq_ff_scanin;
430wire ncu_pcx_stall_pq_ff_scanout;
431wire siclk;
432wire soclk;
433wire se;
434wire pce_ov;
435wire stop;
436
437
438////////////////////////////////////////////////////////////////////////
439// Signal declarations
440////////////////////////////////////////////////////////////////////////
441 // Global interface
442input l2clk;
443input cmp_io_sync_en;
444input io_cmp_sync_en;
445
446input tcu_scan_en;
447input scan_in;
448output scan_out;
449input tcu_pce_ov;
450input tcu_clk_stop;
451input tcu_aclk;
452input tcu_bclk;
453
454// Crossbar interface
455input pcx_ncu_data_rdy_px1;
456output ncu_pcx_stall_pq;
457
458// c2i fast datapath interface
459input pcx_ncu_vld;
460input [4:0] pcx_ncu_req;
461input [39:0] pcx_ncu_addr;
462input [5:0] pcx_ncu_cputhr;
463
464output io_mondo_data_wr;
465output mondo_data_bypass_d2;
466output mondo_addr_creg_mdata0_dec_d2;
467output mondo_addr_creg_mdata1_dec_d2;
468output mondo_addr_creg_mbusy_dec_d2;
469output tap_mondo_rd_d2;
470output cpu_mondo_addr_invld_d2;
471
472// c2i slow control interface
473input [5:0] cpubuf_head_s;
474output [5:0] cpubuf_tail_f;
475
476// i2c fast control interface
477output intbuf_wr;
478output intbuf_wr2i2c;
479output cpu_mondo_rd_d2;
480
481input intbuf_hit_hwm;
482
483// i2c slow control interface
484input io_mondo_data_wr_s;
485
486// i2c slow datapath interface
487input [5:0] io_mondo_data_wr_addr_s;
488
489// IOB control interface
490input [21:0] tap_mondo_acc_addr_s;
491input tap_mondo_acc_seq_s;
492input tap_mondo_wr_s;
493output tap_mondo_acc_addr_invld_d2_f;
494output tap_mondo_acc_seq_d2_f;
495
496// Mondo data table interface
497output [5:0] mondo_data_addr_p0;
498output [5:0] mondo_busy_addr_p0;
499
500output [5:0] mondo_data_addr_p1;
501output [5:0] mondo_busy_addr_p1;
502output mondo_busy_wr_p1;
503
504output [5:0] mondo_busy_addr_p2;
505output mondo_busy_wr_p2;
506
507output mondo_data0_wr;
508output mondo_data1_wr;
509
510// Cpu buffer interface
511output cpubuf_wr;
512output [4:0] cpubuf_tail_ptr;
513
514// mb0 signals //
515input mb0_mondo_wr_en;
516input [5:0] mb0_waddr;
517input [5:0] mb0_raddr;
518input mb0_run;
519input mb1_run;
520input[5:0] mb1_waddr;
521input mb1_cpubuf_wr_en;
522input mb0_intbuf_wr_en;
523
524
525
526// Internal signals
527
528
529
530
531
532
533
534
535
536/*****************************************************************
537 * Read/Write request to the interrupt status table, mondo data tables,
538 * and mondo busy table from CPU.
539 * Write will not update the tables (only generates ack) except the
540 * mondo busy bit because the entries are read-only by software.
541 *****************************************************************/
542ncu_c2ifc_ctl_msff_ctl_macro__width_1 pcx_ncu_data_rdy_px2_ff
543 (
544 .scan_in(pcx_ncu_data_rdy_px2_ff_scanin),
545 .scan_out(pcx_ncu_data_rdy_px2_ff_scanout),
546 .dout (pcx_ncu_data_rdy_px2),
547 .l1clk (l1clk),
548 .din (pcx_ncu_data_rdy_px1),
549 .siclk(siclk),
550 .soclk(soclk)
551 );
552
553ncu_c2ifc_ctl_msff_ctl_macro__width_1 pcx_ncu_data_rdy_ff
554 (
555 .scan_in(pcx_ncu_data_rdy_ff_scanin),
556 .scan_out(pcx_ncu_data_rdy_ff_scanout),
557 .dout (pcx_ncu_data_rdy),
558 .l1clk (l1clk),
559 .din (pcx_ncu_data_rdy_px2),
560 .siclk(siclk),
561 .soclk(soclk)
562 );
563
564 // Check address to see if request is mondo data, or mondo busy.
565 // They are all in the NCU_MONDO CSR space.
566assign cpu_mondo_acc = pcx_ncu_data_rdy & pcx_ncu_vld &
567 (pcx_ncu_addr[39:16] == {`NCU_CSR,`NCU_CSR_MONDO});
568
569assign cpu_mondo_rd = cpu_mondo_acc & (pcx_ncu_req[4:0] == `PCX_LOAD_RQ);
570
571//jimmy : this will only cause a wr ack back to source cputhr //
572assign cpu_mondo_wr = cpu_mondo_acc & (pcx_ncu_req[4:0] == `PCX_STORE_RQ);
573
574ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_rd_d1_ff
575 (
576 .scan_in(cpu_mondo_rd_d1_ff_scanin),
577 .scan_out(cpu_mondo_rd_d1_ff_scanout),
578 .dout (cpu_mondo_rd_d1),
579 .l1clk (l1clk),
580 .din (cpu_mondo_rd),
581 .siclk(siclk),
582 .soclk(soclk)
583 );
584
585ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_rd_d2_ff
586 (
587 .scan_in(cpu_mondo_rd_d2_ff_scanin),
588 .scan_out(cpu_mondo_rd_d2_ff_scanout),
589 .dout (cpu_mondo_rd_d2),
590 .l1clk (l1clk),
591 .din (cpu_mondo_rd_d1),
592 .siclk(siclk),
593 .soclk(soclk)
594 );
595
596ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_wr_d1_ff
597 (
598 .scan_in(cpu_mondo_wr_d1_ff_scanin),
599 .scan_out(cpu_mondo_wr_d1_ff_scanout),
600 .dout (cpu_mondo_wr_d1),
601 .l1clk (l1clk),
602 .din (cpu_mondo_wr),
603 .siclk(siclk),
604 .soclk(soclk)
605 );
606
607ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_wr_d2_ff
608 (
609 .scan_in(cpu_mondo_wr_d2_ff_scanin),
610 .scan_out(cpu_mondo_wr_d2_ff_scanout),
611 .dout (cpu_mondo_wr_d2),
612 .l1clk (l1clk),
613 .din (cpu_mondo_wr_d1),
614 .siclk(siclk),
615 .soclk(soclk)
616 );
617
618assign intbuf_wr = mb0_run ? mb0_intbuf_wr_en : cpu_mondo_rd_wr ;
619assign cpu_mondo_rd_wr_d2 = (cpu_mondo_rd_d2 | cpu_mondo_wr_d2) ;
620//assign intbuf_wr_n = mb0_run ? mb0_intbuf_wr_en : (cpu_mondo_rd_d2 | cpu_mondo_wr_d2) ;
621
622/*
623msff_ctl_macro intbuf_wr_ff (width=1)
624 (
625 .scan_in(intbuf_wr_ff_scanin),
626 .scan_out(intbuf_wr_ff_scanout),
627 .dout (intbuf_wr),
628 .l1clk (l1clk),
629 .din (intbuf_wr_n)
630 );
631*/
632
633ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_rd_wr_ff
634 (
635 .scan_in(cpu_mondo_rd_wr_ff_scanin),
636 .scan_out(cpu_mondo_rd_wr_ff_scanout),
637 .dout (cpu_mondo_rd_wr),
638 .l1clk (l1clk),
639 .din (cpu_mondo_rd_wr_d2),
640 .siclk(siclk),
641 .soclk(soclk)
642 );
643
644
645ncu_c2ifc_ctl_msff_ctl_macro__width_1 intbuf_wr2i2c_ff
646 (
647 .scan_in(intbuf_wr2i2c_ff_scanin),
648 .scan_out(intbuf_wr2i2c_ff_scanout),
649 .dout (intbuf_wr2i2c),
650 .l1clk (l1clk),
651 //.din (intbuf_wr_n)
652 .din (cpu_mondo_rd_wr_d2),
653 .siclk(siclk),
654 .soclk(soclk)
655 );
656
657/*******************************************************
658 * Decode cpu side address to access interrupt table
659 *******************************************************/
660
661///*iobdg_int_mondo_addr_dec cpu_mondo_addr_dec (.addr_in(pcx_ncu_addr[39:0]),
662// .thr_id_in(pcx_ncu_cputhr[5:0]),
663// .creg_mdata0_dec(cpu_mondo_addr_creg_mdata0_dec),
664// .creg_mdata1_dec(cpu_mondo_addr_creg_mdata1_dec),
665// .creg_mbusy_dec(cpu_mondo_addr_creg_mbusy_dec),
666// .mondo_data_addr(cpu_mondo_data_addr[5:0]),
667// .addr_invld(cpu_mondo_addr_invld)); */
668assign c_creg_mdata0_alias_dec = (pcx_ncu_addr[15:0] == `NCU_CREG_MDATA0_ALIAS );
669assign c_creg_mdata1_alias_dec = (pcx_ncu_addr[15:0] == `NCU_CREG_MDATA1_ALIAS );
670assign c_creg_mbusy_alias_dec = (pcx_ncu_addr[15:0] == `NCU_CREG_MBUSY_ALIAS );
671
672// 16'hff07
673assign c_creg_mdata0_proper_dec = ((pcx_ncu_addr[15:0]&16'hfe07) == `NCU_CREG_MDATA0 );
674assign c_creg_mdata1_proper_dec = ((pcx_ncu_addr[15:0]&16'hfe07) == `NCU_CREG_MDATA1 );
675assign c_creg_mbusy_proper_dec = ((pcx_ncu_addr[15:0]&16'hfe07) == `NCU_CREG_MBUSY );
676
677assign c_use_thr_addr = c_creg_mdata0_alias_dec |
678 c_creg_mdata1_alias_dec |
679 c_creg_mbusy_alias_dec;
680
681assign cpu_mondo_data_addr[5:0] = c_use_thr_addr ? pcx_ncu_cputhr[5:0] : pcx_ncu_addr[8:3];
682
683assign cpu_mondo_addr_creg_mdata0_dec = c_creg_mdata0_proper_dec | c_creg_mdata0_alias_dec;
684assign cpu_mondo_addr_creg_mdata1_dec = c_creg_mdata1_proper_dec | c_creg_mdata1_alias_dec;
685assign cpu_mondo_addr_creg_mbusy_dec = c_creg_mbusy_proper_dec | c_creg_mbusy_alias_dec;
686
687assign cpu_mondo_addr_invld = ~cpu_mondo_addr_creg_mdata0_dec &
688 ~cpu_mondo_addr_creg_mdata1_dec &
689 ~cpu_mondo_addr_creg_mbusy_dec ;
690
691
692ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_addr_creg_mdata0_dec_d1_ff
693 (
694 .scan_in(cpu_mondo_addr_creg_mdata0_dec_d1_ff_scanin),
695 .scan_out(cpu_mondo_addr_creg_mdata0_dec_d1_ff_scanout),
696 .dout (cpu_mondo_addr_creg_mdata0_dec_d1),
697 .l1clk (l1clk),
698 .din (cpu_mondo_addr_creg_mdata0_dec),
699 .siclk(siclk),
700 .soclk(soclk)
701 );
702
703ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_addr_creg_mdata1_dec_d1_ff
704 (
705 .scan_in(cpu_mondo_addr_creg_mdata1_dec_d1_ff_scanin),
706 .scan_out(cpu_mondo_addr_creg_mdata1_dec_d1_ff_scanout),
707 .dout (cpu_mondo_addr_creg_mdata1_dec_d1),
708 .l1clk (l1clk),
709 .din (cpu_mondo_addr_creg_mdata1_dec),
710 .siclk(siclk),
711 .soclk(soclk)
712 );
713
714ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_addr_creg_mbusy_dec_d1_ff
715 (
716 .scan_in(cpu_mondo_addr_creg_mbusy_dec_d1_ff_scanin),
717 .scan_out(cpu_mondo_addr_creg_mbusy_dec_d1_ff_scanout),
718 .dout (cpu_mondo_addr_creg_mbusy_dec_d1),
719 .l1clk (l1clk),
720 .din (cpu_mondo_addr_creg_mbusy_dec),
721 .siclk(siclk),
722 .soclk(soclk)
723 );
724
725ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_addr_invld_d1_ff
726 (
727 .scan_in(cpu_mondo_addr_invld_d1_ff_scanin),
728 .scan_out(cpu_mondo_addr_invld_d1_ff_scanout),
729 .dout (cpu_mondo_addr_invld_d1),
730 .l1clk (l1clk),
731 .din (cpu_mondo_addr_invld),
732 .siclk(siclk),
733 .soclk(soclk)
734 );
735
736ncu_c2ifc_ctl_msff_ctl_macro__width_1 cpu_mondo_addr_invld_d2_ff
737 (
738 .scan_in(cpu_mondo_addr_invld_d2_ff_scanin),
739 .scan_out(cpu_mondo_addr_invld_d2_ff_scanout),
740 .dout (cpu_mondo_addr_invld_d2),
741 .l1clk (l1clk),
742 .din (cpu_mondo_addr_invld_d1),
743 .siclk(siclk),
744 .soclk(soclk)
745 );
746
747/*****************************************************************
748 * Write request to the mondo data0, mondo data1, mondo busy table
749 * from JBI
750 *****************************************************************/
751 // Write will be asserted for multiple cycles. That's okay. The
752 // same entry in the array will be written several times.
753ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 io_mondo_data_wr_ff
754 (
755 .scan_in(io_mondo_data_wr_ff_scanin),
756 .scan_out(io_mondo_data_wr_ff_scanout),
757 .dout (io_mondo_data_wr),
758 .l1clk (l1clk),
759 .en (io_cmp_sync_en),
760 .din (io_mondo_data_wr_s),
761 .siclk(siclk),
762 .soclk(soclk)
763 );
764
765ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_6 io_mondo_data_addr_ff
766 (
767 .scan_in(io_mondo_data_addr_ff_scanin),
768 .scan_out(io_mondo_data_addr_ff_scanout),
769 .dout (io_mondo_data_addr[5:0]),
770 .l1clk (l1clk),
771 .en (io_cmp_sync_en),
772 .din (io_mondo_data_wr_addr_s[5:0]),
773 .siclk(siclk),
774 .soclk(soclk)
775 );
776
777/*****************************************************************
778 * Read/Write request to the mondo data, mondo busy table from TAP
779 *****************************************************************/
780// Flop address to convert to cpu clock domain
781ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_22 tap_mondo_acc_addr_ff
782 (
783 .scan_in(tap_mondo_acc_addr_ff_scanin),
784 .scan_out(tap_mondo_acc_addr_ff_scanout),
785 .dout (tap_mondo_acc_addr[21:0]),
786 .l1clk (l1clk),
787 .en (io_cmp_sync_en),
788 .din (tap_mondo_acc_addr_s[21:0]),
789 .siclk(siclk),
790 .soclk(soclk)
791 );
792
793// Decode address to access interrupt table, mondo data, mondo busy
794// Thread ID is hardwired to zero. TAP should use alias address to access
795// mondo data table. If it tries to use the software address, only
796// thread 0's entry is accessible.
797/*iobdg_int_mondo_addr_dec tap_mondo_addr_dec (.addr_in(tap_mondo_acc_addr),
798 .thr_id_in(5'b0),
799 .creg_mdata0_dec(tap_mondo_addr_creg_mdata0_dec),
800 .creg_mdata1_dec(tap_mondo_addr_creg_mdata1_dec),
801 .creg_mbusy_dec(tap_mondo_addr_creg_mbusy_dec),
802 .mondo_data_addr(tap_mondo_data_addr),
803 .addr_invld(tap_mondo_addr_invld));*/
804assign t_creg_mdata0_alias_dec = (tap_mondo_acc_addr[15:0] == `NCU_CREG_MDATA0_ALIAS );
805assign t_creg_mdata1_alias_dec = (tap_mondo_acc_addr[15:0] == `NCU_CREG_MDATA1_ALIAS );
806assign t_creg_mbusy_alias_dec = (tap_mondo_acc_addr[15:0] == `NCU_CREG_MBUSY_ALIAS );
807
808// 16'hff07
809assign t_creg_mdata0_proper_dec = ((tap_mondo_acc_addr[15:0]&16'hfe07) == `NCU_CREG_MDATA0 );
810assign t_creg_mdata1_proper_dec = ((tap_mondo_acc_addr[15:0]&16'hfe07) == `NCU_CREG_MDATA1 );
811assign t_creg_mbusy_proper_dec = ((tap_mondo_acc_addr[15:0]&16'hfe07) == `NCU_CREG_MBUSY );
812
813assign t_use_thr_addr = t_creg_mdata0_alias_dec |
814 t_creg_mdata1_alias_dec |
815 t_creg_mbusy_alias_dec;
816
817assign tap_mondo_data_addr[5:0] = t_use_thr_addr ? tap_mondo_acc_addr[21:16] : tap_mondo_acc_addr[8:3];
818
819assign tap_mondo_addr_creg_mdata0_dec = t_creg_mdata0_proper_dec | t_creg_mdata0_alias_dec;
820assign tap_mondo_addr_creg_mdata1_dec = t_creg_mdata1_proper_dec | t_creg_mdata1_alias_dec;
821assign tap_mondo_addr_creg_mbusy_dec = t_creg_mbusy_proper_dec | t_creg_mbusy_alias_dec;
822
823assign tap_mondo_addr_invld = ~tap_mondo_addr_creg_mdata0_dec &
824 ~tap_mondo_addr_creg_mdata1_dec &
825 ~tap_mondo_addr_creg_mbusy_dec ;
826
827
828ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_addr_creg_mdata0_dec_d1_ff
829 (
830 .scan_in(tap_mondo_addr_creg_mdata0_dec_d1_ff_scanin),
831 .scan_out(tap_mondo_addr_creg_mdata0_dec_d1_ff_scanout),
832 .dout (tap_mondo_addr_creg_mdata0_dec_d1),
833 .l1clk (l1clk),
834 .en (tap_mondo_acc),
835 .din (tap_mondo_addr_creg_mdata0_dec),
836 .siclk(siclk),
837 .soclk(soclk)
838 );
839
840ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_addr_creg_mdata1_dec_d1_ff
841 (
842 .scan_in(tap_mondo_addr_creg_mdata1_dec_d1_ff_scanin),
843 .scan_out(tap_mondo_addr_creg_mdata1_dec_d1_ff_scanout),
844 .dout (tap_mondo_addr_creg_mdata1_dec_d1),
845 .l1clk (l1clk),
846 .en (tap_mondo_acc),
847 .din (tap_mondo_addr_creg_mdata1_dec),
848 .siclk(siclk),
849 .soclk(soclk)
850 );
851
852ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_addr_creg_mbusy_dec_d1_ff
853 (
854 .scan_in(tap_mondo_addr_creg_mbusy_dec_d1_ff_scanin),
855 .scan_out(tap_mondo_addr_creg_mbusy_dec_d1_ff_scanout),
856 .dout (tap_mondo_addr_creg_mbusy_dec_d1),
857 .l1clk (l1clk),
858 .en (tap_mondo_acc),
859 .din (tap_mondo_addr_creg_mbusy_dec),
860 .siclk(siclk),
861 .soclk(soclk)
862 );
863
864ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_addr_invld_d1_ff
865 (
866 .scan_in(tap_mondo_addr_invld_d1_ff_scanin),
867 .scan_out(tap_mondo_addr_invld_d1_ff_scanout),
868 .dout (tap_mondo_addr_invld_d1),
869 .l1clk (l1clk),
870 .en (tap_mondo_acc),
871 .din (tap_mondo_addr_invld),
872 .siclk(siclk),
873 .soclk(soclk)
874 );
875
876ncu_c2ifc_ctl_msff_ctl_macro__width_1 tap_mondo_addr_invld_d2_ff
877 (
878 .scan_in(tap_mondo_addr_invld_d2_ff_scanin),
879 .scan_out(tap_mondo_addr_invld_d2_ff_scanout),
880 .dout (tap_mondo_addr_invld_d2),
881 .l1clk (l1clk),
882 .din (tap_mondo_addr_invld_d1),
883 .siclk(siclk),
884 .soclk(soclk)
885 );
886
887 // Send result back to BSC clock domain
888ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_acc_addr_invld_d2_f_ff
889 (
890 .scan_in(tap_mondo_acc_addr_invld_d2_f_ff_scanin),
891 .scan_out(tap_mondo_acc_addr_invld_d2_f_ff_scanout),
892 .dout (tap_mondo_acc_addr_invld_d2_f),
893 .l1clk (l1clk),
894 .en (cmp_io_sync_en),
895 .din (tap_mondo_addr_invld_d2),
896 .siclk(siclk),
897 .soclk(soclk)
898 );
899
900 // Flop sequence number to convert to cpu clock domain
901ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_acc_seq_ff
902 (
903 .scan_in(tap_mondo_acc_seq_ff_scanin),
904 .scan_out(tap_mondo_acc_seq_ff_scanout),
905 .dout (tap_mondo_acc_seq),
906 .l1clk (l1clk),
907 .en (io_cmp_sync_en),
908 .din (tap_mondo_acc_seq_s),
909 .siclk(siclk),
910 .soclk(soclk)
911 );
912
913// Keep track of which sequence number has been serviced
914ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_acc_seq_d1_ff
915 (
916 .scan_in(tap_mondo_acc_seq_d1_ff_scanin),
917 .scan_out(tap_mondo_acc_seq_d1_ff_scanout),
918 .dout (tap_mondo_acc_seq_d1),
919 .l1clk (l1clk),
920 .en (tap_mondo_acc),
921 .din (tap_mondo_acc_seq),
922 .siclk(siclk),
923 .soclk(soclk)
924 );
925
926ncu_c2ifc_ctl_msff_ctl_macro__width_1 tap_mondo_acc_seq_d2_ff
927 (
928 .scan_in(tap_mondo_acc_seq_d2_ff_scanin),
929 .scan_out(tap_mondo_acc_seq_d2_ff_scanout),
930 .dout (tap_mondo_acc_seq_d2),
931 .l1clk (l1clk),
932 .din (tap_mondo_acc_seq_d1),
933 .siclk(siclk),
934 .soclk(soclk)
935 );
936
937 // Send result back to JBUS clock domain
938ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_acc_seq_d2_f_ff
939 (
940 .scan_in(tap_mondo_acc_seq_d2_f_ff_scanin),
941 .scan_out(tap_mondo_acc_seq_d2_f_ff_scanout),
942 .dout (tap_mondo_acc_seq_d2_f),
943 .l1clk (l1clk),
944 .en (cmp_io_sync_en),
945 .din (tap_mondo_acc_seq_d2),
946 .siclk(siclk),
947 .soclk(soclk)
948 );
949
950
951 // Flop write signal to convert to cpu clock domain
952ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 tap_mondo_wr_ff
953 (
954 .scan_in(tap_mondo_wr_ff_scanin),
955 .scan_out(tap_mondo_wr_ff_scanout),
956 .dout (tap_mondo_wr),
957 .l1clk (l1clk),
958 .en (io_cmp_sync_en),
959 .din (tap_mondo_wr_s),
960 .siclk(siclk),
961 .soclk(soclk)
962 );
963
964
965 // CPU read and IO write has higher priority than TAP read/write
966assign tap_mondo_acc = ~cpu_mondo_acc &
967 ~io_mondo_data_wr &
968 (tap_mondo_acc_seq != tap_mondo_acc_seq_d1);
969
970assign tap_mondo_rd = tap_mondo_acc & ~tap_mondo_wr;
971
972ncu_c2ifc_ctl_msff_ctl_macro__width_1 tap_mondo_rd_d1_ff
973 (
974 .scan_in(tap_mondo_rd_d1_ff_scanin),
975 .scan_out(tap_mondo_rd_d1_ff_scanout),
976 .dout (tap_mondo_rd_d1),
977 .l1clk (l1clk),
978 .din (tap_mondo_rd),
979 .siclk(siclk),
980 .soclk(soclk)
981 );
982
983ncu_c2ifc_ctl_msff_ctl_macro__width_1 tap_mondo_rd_d2_ff
984 (
985 .scan_in(tap_mondo_rd_d2_ff_scanin),
986 .scan_out(tap_mondo_rd_d2_ff_scanout),
987 .dout (tap_mondo_rd_d2),
988 .l1clk (l1clk),
989 .din (tap_mondo_rd_d1),
990 .siclk(siclk),
991 .soclk(soclk)
992 );
993
994
995 /*****************************************************************
996 * Mux out decoded signals depending on CPU or TAP access
997 *****************************************************************/
998assign mondo_addr_creg_mdata0_dec_d1 =
999 cpu_mondo_rd_d1 ? cpu_mondo_addr_creg_mdata0_dec_d1 :
1000 tap_mondo_addr_creg_mdata0_dec_d1;
1001
1002ncu_c2ifc_ctl_msff_ctl_macro__width_1 mondo_addr_creg_mdata0_dec_d2_ff
1003 (
1004 .scan_in(mondo_addr_creg_mdata0_dec_d2_ff_scanin),
1005 .scan_out(mondo_addr_creg_mdata0_dec_d2_ff_scanout),
1006 .dout (mondo_addr_creg_mdata0_dec_d2),
1007 .l1clk (l1clk),
1008 .din (mondo_addr_creg_mdata0_dec_d1),
1009 .siclk(siclk),
1010 .soclk(soclk)
1011 );
1012
1013
1014assign mondo_addr_creg_mdata1_dec_d1 =
1015 cpu_mondo_rd_d1 ? cpu_mondo_addr_creg_mdata1_dec_d1 :
1016 tap_mondo_addr_creg_mdata1_dec_d1;
1017
1018ncu_c2ifc_ctl_msff_ctl_macro__width_1 mondo_addr_creg_mdata1_dec_d2_ff
1019 (
1020 .scan_in(mondo_addr_creg_mdata1_dec_d2_ff_scanin),
1021 .scan_out(mondo_addr_creg_mdata1_dec_d2_ff_scanout),
1022 .dout (mondo_addr_creg_mdata1_dec_d2),
1023 .l1clk (l1clk),
1024 .din (mondo_addr_creg_mdata1_dec_d1),
1025 .siclk(siclk),
1026 .soclk(soclk)
1027 );
1028
1029
1030assign mondo_addr_creg_mbusy_dec_d1 =
1031 cpu_mondo_rd_d1 ? cpu_mondo_addr_creg_mbusy_dec_d1 :
1032 tap_mondo_addr_creg_mbusy_dec_d1;
1033
1034ncu_c2ifc_ctl_msff_ctl_macro__width_1 mondo_addr_creg_mbusy_dec_d2_ff
1035 (
1036 .scan_in(mondo_addr_creg_mbusy_dec_d2_ff_scanin),
1037 .scan_out(mondo_addr_creg_mbusy_dec_d2_ff_scanout),
1038 .dout (mondo_addr_creg_mbusy_dec_d2),
1039 .l1clk (l1clk),
1040 .din (mondo_addr_creg_mbusy_dec_d1),
1041 .siclk(siclk),
1042 .soclk(soclk)
1043 );
1044
1045
1046
1047/*****************************************************************
1048 * Setup read/write access to mondo data table
1049 *****************************************************************/
1050//assign mb0_mondo_sel = mb0_run * mb0_mondo_rd_en;
1051assign mondo_data_addr_p0[5:0] = mb0_run ? mb0_raddr[5:0] :
1052 cpu_mondo_acc ? cpu_mondo_data_addr[5:0] : tap_mondo_data_addr[5:0];
1053
1054assign mondo_data_addr_p1[5:0] = mb0_run ? mb0_waddr[5:0] :
1055 io_mondo_data_wr ? io_mondo_data_addr[5:0] : tap_mondo_data_addr[5:0];
1056
1057assign mondo_data0_wr = mb0_run ? mb0_mondo_wr_en : mondo_data0_wr_f;
1058assign mondo_data0_wr_f = io_mondo_data_wr |
1059 (tap_mondo_acc & tap_mondo_wr & tap_mondo_addr_creg_mdata0_dec);
1060
1061assign mondo_data1_wr = mb0_run ? mb0_mondo_wr_en : mondo_data1_wr_f;
1062assign mondo_data1_wr_f = io_mondo_data_wr |
1063 (tap_mondo_acc & tap_mondo_wr & tap_mondo_addr_creg_mdata1_dec);
1064
1065// Bypass detection - Only bypass if io_mondo_data_wr. This bypass
1066// is for the case when Jbus interrupt updates the
1067// tables and CPU tries to read the exact same
1068// entry.
1069// No need to bypass if TAP is writing because
1070// TAP access is allowed only if CPU is not
1071// accessing the tables.
1072ncu_c2ifc_ctl_msff_ctl_macro__width_1 mondo_data_wr_d1_ff
1073 (
1074 .scan_in(mondo_data_wr_d1_ff_scanin),
1075 .scan_out(mondo_data_wr_d1_ff_scanout),
1076 .dout (mondo_data_wr_d1),
1077 .l1clk (l1clk),
1078 .din (io_mondo_data_wr),
1079 .siclk(siclk),
1080 .soclk(soclk)
1081 );
1082
1083ncu_c2ifc_ctl_msff_ctl_macro__width_6 mondo_data_addr_p0_d1_ff
1084 (
1085 .scan_in(mondo_data_addr_p0_d1_ff_scanin),
1086 .scan_out(mondo_data_addr_p0_d1_ff_scanout),
1087 .dout (mondo_data_addr_p0_d1[5:0]),
1088 .l1clk (l1clk),
1089 .din (mondo_data_addr_p0[5:0]),
1090 .siclk(siclk),
1091 .soclk(soclk)
1092 );
1093
1094ncu_c2ifc_ctl_msff_ctl_macro__width_6 mondo_data_addr_p1_d1_ff
1095 (
1096 .scan_in(mondo_data_addr_p1_d1_ff_scanin),
1097 .scan_out(mondo_data_addr_p1_d1_ff_scanout),
1098 .dout (mondo_data_addr_p1_d1[5:0]),
1099 .l1clk (l1clk),
1100 .din (mondo_data_addr_p1[5:0]),
1101 .siclk(siclk),
1102 .soclk(soclk)
1103 );
1104
1105assign mondo_data_bypass_d1 = mondo_data_wr_d1 &
1106 (mondo_data_addr_p0_d1[5:0] == mondo_data_addr_p1_d1[5:0]);
1107
1108ncu_c2ifc_ctl_msff_ctl_macro__width_1 mondo_data_bypass_d2_ff
1109 (
1110 .scan_in(mondo_data_bypass_d2_ff_scanin),
1111 .scan_out(mondo_data_bypass_d2_ff_scanout),
1112 .dout (mondo_data_bypass_d2),
1113 .l1clk (l1clk),
1114 .din (mondo_data_bypass_d1),
1115 .siclk(siclk),
1116 .soclk(soclk)
1117 );
1118
1119
1120/*****************************************************************
1121 * Setup read/write access to mondo busy
1122 *****************************************************************/
1123// Need two write ports because JBUS and CPU may write the Busy bit
1124// at the same time. If they try to write the same entry at the same
1125// time (which is probably a software bug), JBUS wins.
1126// Port 0 - CPU or TAP read
1127// Port 1 - JBUS or TAP write
1128// Port 2 - CPU write
1129assign mondo_busy_addr_p0 = mondo_data_addr_p0;
1130
1131assign mondo_busy_addr_p1 = mondo_data_addr_p1;
1132
1133assign mondo_busy_addr_p2 = cpu_mondo_data_addr;
1134
1135
1136assign mondo_busy_wr_p1 = io_mondo_data_wr |
1137 (tap_mondo_acc & tap_mondo_wr & tap_mondo_addr_creg_mbusy_dec);
1138
1139assign mondo_busy_wr_p2 = cpu_mondo_acc & cpu_mondo_wr & cpu_mondo_addr_creg_mbusy_dec;
1140
1141
1142/*****************************************************************
1143 * Cpu Buffer Control
1144 *****************************************************************/
1145assign cpubuf_wr = mb1_run ? mb1_cpubuf_wr_en : (pcx_ncu_data_rdy & pcx_ncu_vld & ~(cpu_mondo_rd | cpu_mondo_wr));
1146//assign cpubuf_wr_l = ~cpubuf_wr;
1147
1148
1149// Tail pointer to cpu buffer
1150ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_6 cpubuf_tail_ff
1151 (
1152 .scan_in(cpubuf_tail_ff_scanin),
1153 .scan_out(cpubuf_tail_ff_scanout),
1154 .dout (cpubuf_tail[5:0]),
1155 .l1clk (l1clk),
1156 .en (cpubuf_wr),
1157 .din (cpubuf_tail_plus[5:0]),
1158 .siclk(siclk),
1159 .soclk(soclk)
1160 );
1161
1162assign cpubuf_tail_plus[5:0] = cpubuf_tail[5:0] + 6'd1;
1163
1164assign cpubuf_tail_ptr[4:0] = mb1_run ? mb1_waddr[4:0] : cpubuf_tail[4:0];
1165//assign cpubuf_tail_ptr[4:0] = cpubuf_tail[4:0]; // cpubuf no longer goes to mb0;
1166
1167// Send tail pointer to BSC clock domain
1168ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_6 cpubuf_tail_f_ff
1169 (
1170 .scan_in(cpubuf_tail_f_ff_scanin),
1171 .scan_out(cpubuf_tail_f_ff_scanout),
1172 .dout (cpubuf_tail_f[5:0]),
1173 .l1clk (l1clk),
1174 .en (cmp_io_sync_en),
1175 .din (cpubuf_tail[5:0]),
1176 .siclk(siclk),
1177 .soclk(soclk)
1178 );
1179
1180
1181// Flop head pointer to convert to CPU clock domain
1182ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_6 cpubuf_head_ff
1183 (
1184 .scan_in(cpubuf_head_ff_scanin),
1185 .scan_out(cpubuf_head_ff_scanout),
1186 .dout (cpubuf_head[5:0]),
1187 .l1clk (l1clk),
1188 .en (io_cmp_sync_en),
1189 .din (cpubuf_head_s[5:0]),
1190 .siclk(siclk),
1191 .soclk(soclk)
1192 );
1193
1194
1195//// this is the original n1 scheme, n2 is similar but different//
1196/************************************************************************
1197 * __tail incremented here
1198 * flop req | for packet in PX2
1199 * | |
1200 * | | compute __stall sent here
1201 * | | hwm |
1202 * | | | |
1203 * V V V V
1204 * PQ PA PX1 rptr PX2 C1 C2 C3 rtpr
1205 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1206 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1207 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1208 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1209 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1210 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1211 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1212 * PQ PA PX1 rptr PX2 C1 C2 C3 rptr
1213 * --> PQ PA
1214 * |
1215 * |
1216 * packet in this PQ is stalled
1217 *
1218 * When the stall is signalled, there can potentially be 8 packets in
1219 * C2, C1, PX2, rptr, PX1, PA, PQ, and PQ-1 that need to be queued in
1220 * the CPU shared buffer.
1221 * Hence, the high water mark is 16 - 8 = 8.
1222 ************************************************************************/
1223// Assert stall to crossbar if we are 7 or less entries away from filling
1224// up cpu buffer.
1225assign cpubuf_tail_plus6[5:0] = cpubuf_tail[5:0] + 6'd6;
1226
1227assign cpubuf_hit_hwm = ((cpubuf_tail_plus6[5] != cpubuf_head[5]) &
1228 (cpubuf_tail_plus6[4:0] >= cpubuf_head[4:0])) |
1229 ((cpubuf_tail_plus6[5] == cpubuf_head[5]) &
1230 (cpubuf_tail_plus6[4:0] <= cpubuf_head[4:0]));
1231
1232ncu_c2ifc_ctl_msff_ctl_macro__width_1 ncu_pcx_stall_pq_ff
1233 (
1234 .scan_in(ncu_pcx_stall_pq_ff_scanin),
1235 .scan_out(ncu_pcx_stall_pq_ff_scanout),
1236 .dout (ncu_pcx_stall_pq),
1237 .l1clk (l1clk),
1238 .din (cpubuf_hit_hwm | intbuf_hit_hwm),
1239 .siclk(siclk),
1240 .soclk(soclk)
1241 );
1242
1243
1244/**** adding clock header ****/
1245ncu_c2ifc_ctl_l1clkhdr_ctl_macro clkgen (
1246 .l2clk (l2clk),
1247 .l1en (1'b1),
1248 .l1clk (l1clk),
1249 .pce_ov(pce_ov),
1250 .stop(stop),
1251 .se(se)
1252 );
1253
1254/*** building tcu port ***/
1255assign siclk = tcu_aclk;
1256assign soclk = tcu_bclk;
1257assign se = tcu_scan_en;
1258assign pce_ov = tcu_pce_ov;
1259assign stop = tcu_clk_stop;
1260
1261// fixscan start:
1262assign pcx_ncu_data_rdy_px2_ff_scanin = scan_in ;
1263assign pcx_ncu_data_rdy_ff_scanin = pcx_ncu_data_rdy_px2_ff_scanout;
1264assign cpu_mondo_rd_d1_ff_scanin = pcx_ncu_data_rdy_ff_scanout;
1265assign cpu_mondo_rd_d2_ff_scanin = cpu_mondo_rd_d1_ff_scanout;
1266assign cpu_mondo_wr_d1_ff_scanin = cpu_mondo_rd_d2_ff_scanout;
1267assign cpu_mondo_wr_d2_ff_scanin = cpu_mondo_wr_d1_ff_scanout;
1268assign cpu_mondo_rd_wr_ff_scanin = cpu_mondo_wr_d2_ff_scanout;
1269assign intbuf_wr2i2c_ff_scanin = cpu_mondo_rd_wr_ff_scanout ;
1270assign cpu_mondo_addr_creg_mdata0_dec_d1_ff_scanin = intbuf_wr2i2c_ff_scanout ;
1271assign cpu_mondo_addr_creg_mdata1_dec_d1_ff_scanin = cpu_mondo_addr_creg_mdata0_dec_d1_ff_scanout;
1272assign cpu_mondo_addr_creg_mbusy_dec_d1_ff_scanin = cpu_mondo_addr_creg_mdata1_dec_d1_ff_scanout;
1273assign cpu_mondo_addr_invld_d1_ff_scanin = cpu_mondo_addr_creg_mbusy_dec_d1_ff_scanout;
1274assign cpu_mondo_addr_invld_d2_ff_scanin = cpu_mondo_addr_invld_d1_ff_scanout;
1275assign io_mondo_data_wr_ff_scanin = cpu_mondo_addr_invld_d2_ff_scanout;
1276assign io_mondo_data_addr_ff_scanin = io_mondo_data_wr_ff_scanout;
1277assign tap_mondo_acc_addr_ff_scanin = io_mondo_data_addr_ff_scanout;
1278assign tap_mondo_addr_creg_mdata0_dec_d1_ff_scanin = tap_mondo_acc_addr_ff_scanout;
1279assign tap_mondo_addr_creg_mdata1_dec_d1_ff_scanin = tap_mondo_addr_creg_mdata0_dec_d1_ff_scanout;
1280assign tap_mondo_addr_creg_mbusy_dec_d1_ff_scanin = tap_mondo_addr_creg_mdata1_dec_d1_ff_scanout;
1281assign tap_mondo_addr_invld_d1_ff_scanin = tap_mondo_addr_creg_mbusy_dec_d1_ff_scanout;
1282assign tap_mondo_addr_invld_d2_ff_scanin = tap_mondo_addr_invld_d1_ff_scanout;
1283assign tap_mondo_acc_addr_invld_d2_f_ff_scanin = tap_mondo_addr_invld_d2_ff_scanout;
1284assign tap_mondo_acc_seq_ff_scanin = tap_mondo_acc_addr_invld_d2_f_ff_scanout;
1285assign tap_mondo_acc_seq_d1_ff_scanin = tap_mondo_acc_seq_ff_scanout;
1286assign tap_mondo_acc_seq_d2_ff_scanin = tap_mondo_acc_seq_d1_ff_scanout;
1287assign tap_mondo_acc_seq_d2_f_ff_scanin = tap_mondo_acc_seq_d2_ff_scanout;
1288assign tap_mondo_wr_ff_scanin = tap_mondo_acc_seq_d2_f_ff_scanout;
1289assign tap_mondo_rd_d1_ff_scanin = tap_mondo_wr_ff_scanout ;
1290assign tap_mondo_rd_d2_ff_scanin = tap_mondo_rd_d1_ff_scanout;
1291assign mondo_addr_creg_mdata0_dec_d2_ff_scanin = tap_mondo_rd_d2_ff_scanout;
1292assign mondo_addr_creg_mdata1_dec_d2_ff_scanin = mondo_addr_creg_mdata0_dec_d2_ff_scanout;
1293assign mondo_addr_creg_mbusy_dec_d2_ff_scanin = mondo_addr_creg_mdata1_dec_d2_ff_scanout;
1294assign mondo_data_wr_d1_ff_scanin = mondo_addr_creg_mbusy_dec_d2_ff_scanout;
1295assign mondo_data_addr_p0_d1_ff_scanin = mondo_data_wr_d1_ff_scanout;
1296assign mondo_data_addr_p1_d1_ff_scanin = mondo_data_addr_p0_d1_ff_scanout;
1297assign mondo_data_bypass_d2_ff_scanin = mondo_data_addr_p1_d1_ff_scanout;
1298assign cpubuf_tail_ff_scanin = mondo_data_bypass_d2_ff_scanout;
1299assign cpubuf_tail_f_ff_scanin = cpubuf_tail_ff_scanout ;
1300assign cpubuf_head_ff_scanin = cpubuf_tail_f_ff_scanout ;
1301assign ncu_pcx_stall_pq_ff_scanin = cpubuf_head_ff_scanout ;
1302assign scan_out = ncu_pcx_stall_pq_ff_scanout;
1303// fixscan end:
1304endmodule // c2i_fctrl
1305
1306
1307
1308
1309
1310
1311
1312// any PARAMS parms go into naming of macro
1313
1314module ncu_c2ifc_ctl_msff_ctl_macro__width_1 (
1315 din,
1316 l1clk,
1317 scan_in,
1318 siclk,
1319 soclk,
1320 dout,
1321 scan_out);
1322wire [0:0] fdin;
1323
1324 input [0:0] din;
1325 input l1clk;
1326 input scan_in;
1327
1328
1329 input siclk;
1330 input soclk;
1331
1332 output [0:0] dout;
1333 output scan_out;
1334assign fdin[0:0] = din[0:0];
1335
1336
1337
1338
1339
1340
1341dff #(1) d0_0 (
1342.l1clk(l1clk),
1343.siclk(siclk),
1344.soclk(soclk),
1345.d(fdin[0:0]),
1346.si(scan_in),
1347.so(scan_out),
1348.q(dout[0:0])
1349);
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362endmodule
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376// any PARAMS parms go into naming of macro
1377
1378module ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_1 (
1379 din,
1380 en,
1381 l1clk,
1382 scan_in,
1383 siclk,
1384 soclk,
1385 dout,
1386 scan_out);
1387wire [0:0] fdin;
1388
1389 input [0:0] din;
1390 input en;
1391 input l1clk;
1392 input scan_in;
1393
1394
1395 input siclk;
1396 input soclk;
1397
1398 output [0:0] dout;
1399 output scan_out;
1400assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
1401
1402
1403
1404
1405
1406
1407dff #(1) d0_0 (
1408.l1clk(l1clk),
1409.siclk(siclk),
1410.soclk(soclk),
1411.d(fdin[0:0]),
1412.si(scan_in),
1413.so(scan_out),
1414.q(dout[0:0])
1415);
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428endmodule
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442// any PARAMS parms go into naming of macro
1443
1444module ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_6 (
1445 din,
1446 en,
1447 l1clk,
1448 scan_in,
1449 siclk,
1450 soclk,
1451 dout,
1452 scan_out);
1453wire [5:0] fdin;
1454wire [4:0] so;
1455
1456 input [5:0] din;
1457 input en;
1458 input l1clk;
1459 input scan_in;
1460
1461
1462 input siclk;
1463 input soclk;
1464
1465 output [5:0] dout;
1466 output scan_out;
1467assign fdin[5:0] = (din[5:0] & {6{en}}) | (dout[5:0] & ~{6{en}});
1468
1469
1470
1471
1472
1473
1474dff #(6) d0_0 (
1475.l1clk(l1clk),
1476.siclk(siclk),
1477.soclk(soclk),
1478.d(fdin[5:0]),
1479.si({scan_in,so[4:0]}),
1480.so({so[4:0],scan_out}),
1481.q(dout[5:0])
1482);
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495endmodule
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509// any PARAMS parms go into naming of macro
1510
1511module ncu_c2ifc_ctl_msff_ctl_macro__en_1__width_22 (
1512 din,
1513 en,
1514 l1clk,
1515 scan_in,
1516 siclk,
1517 soclk,
1518 dout,
1519 scan_out);
1520wire [21:0] fdin;
1521wire [20:0] so;
1522
1523 input [21:0] din;
1524 input en;
1525 input l1clk;
1526 input scan_in;
1527
1528
1529 input siclk;
1530 input soclk;
1531
1532 output [21:0] dout;
1533 output scan_out;
1534assign fdin[21:0] = (din[21:0] & {22{en}}) | (dout[21:0] & ~{22{en}});
1535
1536
1537
1538
1539
1540
1541dff #(22) d0_0 (
1542.l1clk(l1clk),
1543.siclk(siclk),
1544.soclk(soclk),
1545.d(fdin[21:0]),
1546.si({scan_in,so[20:0]}),
1547.so({so[20:0],scan_out}),
1548.q(dout[21:0])
1549);
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562endmodule
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576// any PARAMS parms go into naming of macro
1577
1578module ncu_c2ifc_ctl_msff_ctl_macro__width_6 (
1579 din,
1580 l1clk,
1581 scan_in,
1582 siclk,
1583 soclk,
1584 dout,
1585 scan_out);
1586wire [5:0] fdin;
1587wire [4:0] so;
1588
1589 input [5:0] din;
1590 input l1clk;
1591 input scan_in;
1592
1593
1594 input siclk;
1595 input soclk;
1596
1597 output [5:0] dout;
1598 output scan_out;
1599assign fdin[5:0] = din[5:0];
1600
1601
1602
1603
1604
1605
1606dff #(6) d0_0 (
1607.l1clk(l1clk),
1608.siclk(siclk),
1609.soclk(soclk),
1610.d(fdin[5:0]),
1611.si({scan_in,so[4:0]}),
1612.so({so[4:0],scan_out}),
1613.q(dout[5:0])
1614);
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627endmodule
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641// any PARAMS parms go into naming of macro
1642
1643module ncu_c2ifc_ctl_l1clkhdr_ctl_macro (
1644 l2clk,
1645 l1en,
1646 pce_ov,
1647 stop,
1648 se,
1649 l1clk);
1650
1651
1652 input l2clk;
1653 input l1en;
1654 input pce_ov;
1655 input stop;
1656 input se;
1657 output l1clk;
1658
1659
1660
1661
1662
1663cl_sc1_l1hdr_8x c_0 (
1664
1665
1666 .l2clk(l2clk),
1667 .pce(l1en),
1668 .l1clk(l1clk),
1669 .se(se),
1670 .pce_ov(pce_ov),
1671 .stop(stop)
1672);
1673
1674
1675
1676endmodule
1677
1678
1679
1680
1681
1682
1683
1684