Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / ncu / rtl / ncu_c2isc_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ncu_c2isc_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_c2isc_ctl (
229 iol2clk,
230 tcu_scan_en,
231 scan_in,
232 scan_out,
233 tcu_pce_ov,
234 tcu_clk_stop,
235 tcu_aclk,
236 tcu_bclk,
237 pcx_packet,
238 pcx_packet_ue,
239 pcx_packet_pe,
240 pas,
241 pa_ld,
242 cpubuf_rd,
243 cpu_packet_type,
244 cpu_packet_size,
245 c2i_packet_addr,
246 cpubuf_tail_f,
247 cpubuf_head_s,
248 cpubuf_head_ptr,
249 cpubuf_rden,
250 mem32_base,
251 mem32_mask,
252 mem32_en,
253 mem64_base,
254 mem64_mask,
255 mem64_en,
256 iocon_base,
257 iocon_mask,
258 iocon_en,
259 cpubuf_pe,
260 cpubuf_ue,
261 mb0_raddr,
262 mb1_run,
263 mb1_addr,
264 mb1_cpubuf_rd_en,
265 c2i_packet_vld,
266 c2i_packet_is_rd_req,
267 c2i_packet_is_wr_req,
268 dmupio_ucb_sel,
269 com_map,
270 dmupio_addr35to24,
271 dmupio_ucb_buf_acpt,
272 dmucsr_ucb_sel,
273 dmucsr_ucb_buf_acpt,
274 ssi_ucb_sel,
275 ssi_ucb_buf_acpt,
276 mcu0_ucb_sel,
277 mcu0_ucb_buf_acpt,
278 mcu1_ucb_sel,
279 mcu1_ucb_buf_acpt,
280 mcu2_ucb_sel,
281 mcu2_ucb_buf_acpt,
282 mcu3_ucb_sel,
283 mcu3_ucb_buf_acpt,
284 ccu_ucb_sel,
285 ccu_ucb_buf_acpt,
286 rcu_ucb_sel,
287 rcu_ucb_buf_acpt,
288 dbg1_ucb_sel,
289 dbg1_ucb_buf_acpt,
290 niu_ucb_sel,
291 niu_ucb_buf_acpt,
292 ncu_man_ucb_sel,
293 ncu_man_ucb_buf_acpt,
294 ncu_int_ucb_sel,
295 ncu_int_ucb_buf_acpt,
296 bounce_ucb_sel,
297 bounce_ucb_buf_acpt,
298 rd_nack_ucb_sel,
299 rd_nack_ucb_buf_acpt,
300 srvc_wr_ack,
301 iobuf_avail,
302 c2i_wait,
303 tap_iob_packet_vld,
304 tap_iob_packet,
305 iob_tap_busy,
306 tap_sel) ;
307wire cpubuf_tail_ff_scanin;
308wire cpubuf_tail_ff_scanout;
309wire [5:0] cpubuf_tail;
310wire l1clk;
311wire cpubuf_head_d1_ff_scanin;
312wire cpubuf_head_d1_ff_scanout;
313wire [5:0] cpubuf_head_d1;
314wire [5:0] cpubuf_head;
315wire pipe_full;
316wire aov;
317wire pav;
318wire pbv;
319wire cpu_vld;
320wire head_inc;
321wire aog;
322wire rd;
323wire cpubuf_rden_nobist_eco;
324wire aog_ff_scanin;
325wire aog_ff_scanout;
326wire aov_next;
327wire aov_ff_scanin;
328wire aov_ff_scanout;
329wire pav_ff_scanin;
330wire pav_ff_scanout;
331wire pb_ld;
332wire pbv_ff_scanin;
333wire pbv_ff_scanout;
334wire pbs_next;
335wire pbs_ff_scanin;
336wire pbs_ff_scanout;
337wire pbs;
338wire mov;
339wire cpu_sel;
340wire ucb_buf_acpt;
341wire cpu_packet_needs_wr_ack;
342wire cpu_vld_next;
343wire cpu_vld_ff_scanin;
344wire cpu_vld_ff_scanout;
345wire tap_vld;
346wire [3:0] cpu_wr_pkt_sz;
347wire unconnect_cpu_wr_pkt_sz_0;
348wire [2:0] cpu_wr_pkt_sz_enc;
349wire cpu_packet_is_8B;
350wire tap_packet_is_8B;
351wire c2i_packet_is_if_req;
352wire c2i_packet_is_ack;
353wire c2i_packet_is_8B;
354wire tcu_ucb_sel;
355wire pcie_hit;
356wire [11:0] mem32_masked;
357wire [11:0] mem64_masked;
358wire [11:0] iocon_masked;
359wire mem32_vld;
360wire mem64_vld;
361wire iocon_vld;
362wire [11:0] muxed_mask;
363wire no_match_ucb;
364wire blackhole_acpt;
365wire siclk;
366wire soclk;
367wire se;
368wire pce_ov;
369wire stop;
370
371
372
373////////////////////////////////////////////////////////////////////////
374// Signal declarations
375////////////////////////////////////////////////////////////////////////
376// Global interface
377input iol2clk;
378
379input tcu_scan_en;
380input scan_in;
381output scan_out;
382input tcu_pce_ov;
383input tcu_clk_stop;
384input tcu_aclk;
385input tcu_bclk;
386
387// c2i sdp
388input [128:0] pcx_packet;
389input pcx_packet_ue;
390input pcx_packet_pe;
391output pas; // 0in known_driven
392output pa_ld; // 0in known_driven
393output cpubuf_rd; // 0in known_driven
394//output cpu_packet_is_req;
395output [3:0] cpu_packet_type;
396output [2:0] cpu_packet_size;
397input [39:0] c2i_packet_addr;
398
399// c2i fctrl
400input [5:0] cpubuf_tail_f; // 0in known_driven
401output [5:0] cpubuf_head_s; // 0in known_driven
402
403// CPU buffer interface
404output [4:0] cpubuf_head_ptr;// 0in known_driven
405output cpubuf_rden; // 0in known_driven
406
407// creg from ctrl blk //
408input [11:0] mem32_base; // 0in known_driven
409input [11:0] mem32_mask; // 0in known_driven
410input mem32_en; // 0in known_driven
411input [11:0] mem64_base; // 0in known_driven
412input [11:0] mem64_mask; // 0in known_driven
413input mem64_en; // 0in known_driven
414input [11:0] iocon_base; // 0in known_driven
415input [11:0] iocon_mask; // 0in known_driven
416input iocon_en; // 0in known_driven
417output cpubuf_pe; // 0in known_driven
418output cpubuf_ue; // 0in known_driven
419
420// mb0 signals //
421input [5:0] mb0_raddr;
422//input mb0_cpubuf_sel;
423input mb1_run;
424input [5:0] mb1_addr;
425input mb1_cpubuf_rd_en;
426
427
428// UCB buffer interface
429output c2i_packet_vld; // 0in known_driven
430output c2i_packet_is_rd_req; // 0in known -active c2i_packet_vld
431output c2i_packet_is_wr_req; // 0in known -active c2i_packet_vld
432
433output dmupio_ucb_sel; // 0in known -active c2i_packet_vld
434output [1:0] com_map; // 0in known -active c2i_packet_vld
435output [11:0] dmupio_addr35to24 ;
436input dmupio_ucb_buf_acpt; // 0in known -active c2i_packet_vld
437output dmucsr_ucb_sel; // 0in known -active c2i_packet_vld
438input dmucsr_ucb_buf_acpt; // 0in known -active c2i_packet_vld
439output ssi_ucb_sel; // 0in known -active c2i_packet_vld
440input ssi_ucb_buf_acpt; // 0in known -active c2i_packet_vld
441output mcu0_ucb_sel; // 0in known -active c2i_packet_vld
442input mcu0_ucb_buf_acpt; // 0in known -active c2i_packet_vld
443output mcu1_ucb_sel; // 0in known -active c2i_packet_vld
444input mcu1_ucb_buf_acpt; // 0in known -active c2i_packet_vld
445output mcu2_ucb_sel; // 0in known -active c2i_packet_vld
446input mcu2_ucb_buf_acpt; // 0in known -active c2i_packet_vld
447output mcu3_ucb_sel; // 0in known -active c2i_packet_vld
448input mcu3_ucb_buf_acpt; // 0in known -active c2i_packet_vld
449output ccu_ucb_sel; // 0in known -active c2i_packet_vld
450input ccu_ucb_buf_acpt; // 0in known -active c2i_packet_vld
451output rcu_ucb_sel; // 0in known -active c2i_packet_vld
452input rcu_ucb_buf_acpt; // 0in known -active c2i_packet_vld
453output dbg1_ucb_sel; // 0in known -active c2i_packet_vld
454input dbg1_ucb_buf_acpt; // 0in known -active c2i_packet_vld
455output niu_ucb_sel; // 0in known -active c2i_packet_vld
456input niu_ucb_buf_acpt; // 0in known -active c2i_packet_vld
457output ncu_man_ucb_sel; // 0in known -active c2i_packet_vld
458input ncu_man_ucb_buf_acpt; // 0in known -active c2i_packet_vld
459output ncu_int_ucb_sel; // 0in known -active c2i_packet_vld
460input ncu_int_ucb_buf_acpt; // 0in known -active c2i_packet_vld
461output bounce_ucb_sel; // 0in known -active c2i_packet_vld
462input bounce_ucb_buf_acpt; // 0in known -active c2i_packet_vld
463output rd_nack_ucb_sel; // 0in known -active c2i_packet_vld
464input rd_nack_ucb_buf_acpt; // 0in known -active c2i_packet_vld
465
466output srvc_wr_ack; // 0in known_driven
467input iobuf_avail; // 0in known_driven
468input c2i_wait; // 0in known_driven
469
470input tap_iob_packet_vld; // 0in known_driven
471input [127:0] tap_iob_packet;
472output iob_tap_busy; // 0in known_driven
473output tap_sel;
474
475
476// Internal signals
477
478
479reg cpu_packet_is_rd_req;
480reg cpu_packet_is_wr_req;
481reg cpu_packet_is_if_req;
482reg [3:0] cpu_packet_type;
483reg [2:0] cpu_packet_size;
484
485reg tap_packet_is_rd_req;
486reg tap_packet_is_wr_req;
487reg tap_packet_is_ack;
488reg tap_packet_is_if_req;
489
490
491
492// Request packets for these masters will go to one ucb
493
494
495
496
497/*****************************************************************
498 * CPU Buffer Control
499 *****************************************************************/
500// Flop tail pointer to convert to io clock domain
501ncu_c2isc_ctl_msff_ctl_macro__width_6 cpubuf_tail_ff
502 (
503 .scan_in(cpubuf_tail_ff_scanin),
504 .scan_out(cpubuf_tail_ff_scanout),
505 .dout (cpubuf_tail[5:0]),
506 .l1clk (l1clk),
507 .din (cpubuf_tail_f[5:0]),
508 .siclk(siclk),
509 .soclk(soclk)
510 );
511ncu_c2isc_ctl_msff_ctl_macro__width_6 cpubuf_head_d1_ff
512 (
513 .scan_in(cpubuf_head_d1_ff_scanin),
514 .scan_out(cpubuf_head_d1_ff_scanout),
515 .dout (cpubuf_head_d1[5:0]),
516 .l1clk (l1clk),
517 .din (cpubuf_head[5:0]),
518 .siclk(siclk),
519 .soclk(soclk)
520 );
521
522assign cpubuf_head_ptr[4:0] = mb1_run ? mb1_addr[4:0] : cpubuf_head[4:0];
523assign cpubuf_head_s[5:0] = cpubuf_head_d1[5:0];
524//assign pipe_full = (aov+pav+pbv+cpu_vld)==2'b11 ;
525assign pipe_full = ~aov ? (pav & pbv & cpu_vld) :
526 ~pav ? (pbv & cpu_vld) :
527 ~pbv ? (cpu_vld) : 1'b1 ;
528assign head_inc = aog & (rd | ~pipe_full) ;
529assign cpubuf_head[5:0] = head_inc ? cpubuf_head_d1[5:0]+6'h01 : cpubuf_head_d1[5:0] ;
530
531assign cpubuf_rden = mb1_run ? mb1_cpubuf_rd_en : (cpubuf_tail[5:0] != cpubuf_head[5:0]) ;
532assign cpubuf_rden_nobist_eco = (cpubuf_tail[5:0] != cpubuf_head[5:0]) ;
533//assign aog_next = (cpubuf_tail[5:0] != cpubuf_head[5:0]) ;
534ncu_c2isc_ctl_msff_ctl_macro__width_1 aog_ff
535 (
536 .scan_in(aog_ff_scanin),
537 .scan_out(aog_ff_scanout),
538 .dout (aog),
539 .l1clk (l1clk),
540 .din (cpubuf_rden_nobist_eco),
541 .siclk(siclk),
542 .soclk(soclk)
543 );
544
545assign aov_next = cpubuf_rden_nobist_eco & (head_inc | ~aog);
546ncu_c2isc_ctl_msff_ctl_macro__width_1 aov_ff
547 (
548 .scan_in(aov_ff_scanin),
549 .scan_out(aov_ff_scanout),
550 .dout (aov),
551 .l1clk (l1clk),
552 .din (aov_next),
553 .siclk(siclk),
554 .soclk(soclk)
555 );
556
557assign pa_ld = (pav==cpubuf_rd) ;
558ncu_c2isc_ctl_msff_ctl_macro__en_1__width_1 pav_ff
559 (
560 .scan_in(pav_ff_scanin),
561 .scan_out(pav_ff_scanout),
562 .dout (pav),
563 .l1clk (l1clk),
564 .en (pa_ld),
565 .din (pbv),
566 .siclk(siclk),
567 .soclk(soclk)
568 );
569
570assign pb_ld = (~pav | cpubuf_rd | ~pbv) ;
571ncu_c2isc_ctl_msff_ctl_macro__en_1__width_1 pbv_ff
572 (
573 .scan_in(pbv_ff_scanin),
574 .scan_out(pbv_ff_scanout),
575 .dout (pbv),
576 .l1clk (l1clk),
577 .en (pb_ld),
578 .din (aov),
579 .siclk(siclk),
580 .soclk(soclk)
581 );
582
583assign pbs_next = pas ? (aov & !pbv & pav)&rd : cpubuf_rd ;
584ncu_c2isc_ctl_msff_ctl_macro__width_1 pbs_ff
585 (
586 .scan_in(pbs_ff_scanin),
587 .scan_out(pbs_ff_scanout),
588 .dout (pbs),
589 .l1clk (l1clk),
590 .din (pbs_next),
591 .siclk(siclk),
592 .soclk(soclk)
593 );
594assign pas = ~pbs;
595
596
597assign mov = pas ? pav : pbv ;
598assign cpubuf_rd = mov & (~cpu_vld | rd) ;
599
600assign rd = (cpu_vld & ( (cpu_sel&ucb_buf_acpt)|
601 pcx_packet_ue|
602 (pcx_packet_pe&cpu_packet_needs_wr_ack&(iobuf_avail&~c2i_wait))) );
603
604//assign cpubuf_ue = rd&pcx_packet_ue;
605assign cpubuf_ue = cpu_vld&pcx_packet_ue;
606assign cpubuf_pe = rd&pcx_packet_pe;
607
608/*****************************************************************
609 * Arbitrate between TAP and CPU requests
610 *****************************************************************/
611// Valid indicates which master has a valid packet pending
612assign cpu_vld_next = cpu_vld ? (~rd|mov) : mov ;
613//assign cpu_vld_next = cpubuf_rd | (cpu_vld & ~(cpu_sel & ucb_buf_acpt));
614
615ncu_c2isc_ctl_msff_ctl_macro__width_1 cpu_vld_ff
616 (
617 .scan_in(cpu_vld_ff_scanin),
618 .scan_out(cpu_vld_ff_scanout),
619 .dout (cpu_vld),
620 .l1clk (l1clk),
621 .din (cpu_vld_next),
622 .siclk(siclk),
623 .soclk(soclk)
624 );
625
626assign tap_vld = tap_iob_packet_vld;
627
628
629// TAP packets priority > PCX packets priority
630assign tap_sel = tap_vld;
631assign cpu_sel = ~tap_vld;
632
633// Signal masters if the packet is accepted
634assign iob_tap_busy = tap_vld & ~ucb_buf_acpt;
635
636
637assign c2i_packet_vld = tap_vld | (cpu_vld & ~pcx_packet_ue & ~(pcx_packet_pe&cpu_packet_is_wr_req) &
638 ( dmupio_ucb_sel|
639 ~(cpu_packet_needs_wr_ack&(~iobuf_avail|c2i_wait))
640 ) );
641
642
643assign cpu_wr_pkt_sz[3:0] = ({3'b0,pcx_packet[111]}+{3'b0,pcx_packet[110]}) +
644 ({3'b0,pcx_packet[109]}+{3'b0,pcx_packet[108]}) +
645 ({3'b0,pcx_packet[107]}+{3'b0,pcx_packet[106]}) +
646 ({3'b0,pcx_packet[105]}+{3'b0,pcx_packet[104]}) ;
647
648assign unconnect_cpu_wr_pkt_sz_0 = cpu_wr_pkt_sz[0];
649assign cpu_wr_pkt_sz_enc[2:0] = cpu_wr_pkt_sz[3] ? 3'b011 : cpu_wr_pkt_sz[3:1] ;
650
651/*****************************************************************
652 * Decode packet from CPU buffer
653 *****************************************************************/
654always @(/*AUTOSENSE*/cpu_wr_pkt_sz_enc or pcx_packet) begin
655 // Packet will be dropped if it is not a request
656 case (pcx_packet[128:124]) //rqtyp//
657 `PCX_LOAD_RQ : begin
658 cpu_packet_is_rd_req = 1'b1;
659 cpu_packet_is_wr_req = 1'b0;
660 cpu_packet_is_if_req = 1'b0;
661 cpu_packet_type[3:0] = `UCB_READ_REQ ;
662 cpu_packet_size[2:0] = {1'b0,pcx_packet[105:104]} ;
663 end
664 `PCX_IMISS_RQ : begin
665 cpu_packet_is_rd_req = 1'b0;
666 cpu_packet_is_wr_req = 1'b0;
667 cpu_packet_is_if_req = 1'b1;
668 cpu_packet_type[3:0] = `UCB_IFILL_REQ ;
669 cpu_packet_size[2:0] = {1'b0,pcx_packet[105:104]} ;
670 end
671 `PCX_STORE_RQ : begin
672 cpu_packet_is_rd_req = 1'b0;
673 cpu_packet_is_wr_req = 1'b1;
674 cpu_packet_is_if_req = 1'b0;
675 cpu_packet_type[3:0] = `UCB_WRITE_REQ ;
676 cpu_packet_size[2:0] = cpu_wr_pkt_sz_enc[2:0] ;
677 end
678 default : begin
679 cpu_packet_is_rd_req = 1'b0;
680 cpu_packet_is_wr_req = 1'b0;
681 cpu_packet_is_if_req = 1'b0;
682 cpu_packet_type[3:0] = 4'hf;
683 cpu_packet_size[2:0] = 3'b0;
684 end
685 endcase // case(pcx_packet[128:124])
686end
687
688
689// Decode PCX packet to see if it is a write request. We need to
690// generate acks for writes.
691assign cpu_packet_needs_wr_ack = (pcx_packet[128:124] == `PCX_STORE_RQ) ;
692
693//assign cpu_packet_is_8B = pcx_packet[106:104] == 3'b011;
694assign cpu_packet_is_8B = (cpu_packet_size[2:0] == 3'b011) ;
695
696
697/*****************************************************************
698 * Decode packet from TAP
699 *****************************************************************/
700always @(/*AUTOSENSE*/tap_iob_packet) begin
701 case (tap_iob_packet[3:0])
702 `UCB_READ_REQ : begin
703 tap_packet_is_rd_req = 1'b1;
704 tap_packet_is_wr_req = 1'b0;
705 tap_packet_is_ack = 1'b0;
706 tap_packet_is_if_req = 1'b0;
707 end
708 `UCB_WRITE_REQ : begin
709 tap_packet_is_rd_req = 1'b0;
710 tap_packet_is_wr_req = 1'b1;
711 tap_packet_is_ack = 1'b0;
712 tap_packet_is_if_req = 1'b0;
713 end
714 `UCB_IFILL_REQ : begin
715 tap_packet_is_rd_req = 1'b0;
716 tap_packet_is_wr_req = 1'b0;
717 tap_packet_is_ack = 1'b0;
718 tap_packet_is_if_req = 1'b1;
719 end
720 `UCB_READ_NACK,
721 `UCB_READ_ACK : begin
722 tap_packet_is_rd_req = 1'b0;
723 tap_packet_is_wr_req = 1'b0;
724 tap_packet_is_ack = 1'b1;
725 tap_packet_is_if_req = 1'b0;
726 end
727 default : begin
728 tap_packet_is_rd_req = 1'b0;
729 tap_packet_is_wr_req = 1'b0;
730 tap_packet_is_ack = 1'b0;
731 tap_packet_is_if_req = 1'b0;
732 end
733 endcase
734end // always @ (...
735
736assign tap_packet_is_8B = tap_iob_packet[14:12] == 3'b011;
737
738
739/*****************************************************************
740 * Mux between TAP and CPU packet
741 *****************************************************************/
742assign c2i_packet_is_rd_req = tap_sel ? tap_packet_is_rd_req : cpu_packet_is_rd_req;
743
744assign c2i_packet_is_wr_req = tap_sel ? tap_packet_is_wr_req : cpu_packet_is_wr_req;
745
746assign c2i_packet_is_if_req = tap_sel ? tap_packet_is_if_req : cpu_packet_is_if_req;
747
748assign c2i_packet_is_ack = tap_sel ? tap_packet_is_ack : 1'b0 ;
749
750assign c2i_packet_is_8B = tap_sel ? tap_packet_is_8B : cpu_packet_is_8B;
751
752
753/*****************************************************************
754 * Decode 8 MSB of c2i packet address to figure out which UCB it
755 * should go to
756 *****************************************************************/
757// jimmy: assign mem_ucb_sel = ((c2i_packet_addr[39:32] <= `DRAM_DATA_HI) &
758// jimmy: (c2i_packet_addr[39:32] >= `DRAM_DATA_LO)) &
759// jimmy: (c2i_packet_is_rd_req | c2i_packet_is_wr_req);
760
761// jimmy: assign l2_ucb_sel = (c2i_packet_addr[39:32] == `TAP2L2C) &
762
763// jimmy: assign asi_ucb_sel = (c2i_packet_addr[39:32] == `TAP2ASI) &
764// jimmy: (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
765
766assign tcu_ucb_sel = (c2i_packet_addr[39:32] == `TCU_CSR) &
767 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
768
769////
770// Bit 13:12 indicate which DRAM control we want
771assign mcu0_ucb_sel = ((c2i_packet_addr[39:32] == `MCU_CSR) &
772 (c2i_packet_addr[13:12] == 2'b00)) &
773 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
774
775assign mcu1_ucb_sel = ((c2i_packet_addr[39:32] == `MCU_CSR) &
776 (c2i_packet_addr[13:12] == 2'b01)) &
777 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
778
779assign mcu2_ucb_sel = ((c2i_packet_addr[39:32] == `MCU_CSR) &
780 (c2i_packet_addr[13:12] == 2'b10)) &
781 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
782
783assign mcu3_ucb_sel = ((c2i_packet_addr[39:32] == `MCU_CSR) &
784 (c2i_packet_addr[13:12] == 2'b11)) &
785 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
786
787assign dmucsr_ucb_sel = (c2i_packet_addr[39:32] == `DMU_CSR) &
788 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
789
790////
791assign pcie_hit = (c2i_packet_addr[39:36]==`DMU_PIO) ;
792assign mem32_masked[11:0] = c2i_packet_addr[35:24] & mem32_mask[11:0] ;
793assign mem64_masked[11:0] = c2i_packet_addr[35:24] & mem64_mask[11:0] ;
794assign iocon_masked[11:0] = c2i_packet_addr[35:24] & iocon_mask[11:0] ;
795assign mem32_vld = (mem32_masked[11:0]==mem32_base[11:0]) & pcie_hit & mem32_en ;
796assign mem64_vld = (mem64_masked[11:0]==mem64_base[11:0]) & pcie_hit & mem64_en ;
797assign iocon_vld = (iocon_masked[11:0]==iocon_base[11:0]) & pcie_hit & iocon_en ;
798assign com_map[1:0] = mem64_vld ? 2'b11 :
799 mem32_vld ? 2'b10 : {1'b0,c2i_packet_addr[28]} ;
800
801assign muxed_mask[11:0] = mem64_vld ? mem64_mask[11:0] :
802 mem32_vld ? mem32_mask[11:0] :
803 iocon_mask[11:0] ;
804
805assign dmupio_addr35to24[11:0] = c2i_packet_addr[35:24] & {~muxed_mask[11:0]} ;
806
807assign dmupio_ucb_sel = ((mem32_vld|mem64_vld|iocon_vld) &
808 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) ) ;
809
810////
811assign ssi_ucb_sel = (c2i_packet_addr[39:32] == `SSI_CSR) &
812 (c2i_packet_is_rd_req | c2i_packet_is_wr_req |
813 c2i_packet_is_if_req);
814
815assign ccu_ucb_sel = (c2i_packet_addr[39:32] == `CCU_CSR) &
816 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
817
818assign rcu_ucb_sel = (c2i_packet_addr[39:32] == `RCU_CSR) &
819 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
820
821assign dbg1_ucb_sel = (c2i_packet_addr[39:32] == `DBG1_CSR) &
822 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
823
824assign niu_ucb_sel = (c2i_packet_addr[39:32] == `NIU_CSR) & (c2i_packet_addr[2:0]==3'b000) &
825 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
826
827//// addr[18] to tell if ncu's access is man or int(tap_mondo) ////
828assign ncu_man_ucb_sel = ( ((c2i_packet_addr[39:32] == `NCU_CSR)&(c2i_packet_addr[31:16]==`NCU_CSR_MAN)) |
829 (c2i_packet_addr[39:32] == `NCU_ASI) ) &
830 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B ;
831
832assign ncu_int_ucb_sel = (c2i_packet_addr[39:32] == `NCU_CSR)&(c2i_packet_addr[31:16]==`NCU_CSR_MONDO) &
833 (c2i_packet_is_rd_req | c2i_packet_is_wr_req) & c2i_packet_is_8B;
834
835// Request to L2/TAP/ASI addresses can only be accessed through the i2c path
836// Ack to CPU/TAP is also sent through the i2c path
837assign bounce_ucb_sel = tcu_ucb_sel | c2i_packet_is_ack;
838
839// Any request that does not match any defined address space
840assign no_match_ucb = ~( tcu_ucb_sel |
841 mcu0_ucb_sel |
842 mcu1_ucb_sel |
843 mcu2_ucb_sel |
844 mcu3_ucb_sel |
845 dmucsr_ucb_sel |
846 dmupio_ucb_sel |
847 ssi_ucb_sel |
848 ccu_ucb_sel |
849 rcu_ucb_sel |
850 dbg1_ucb_sel |
851 niu_ucb_sel |
852 ncu_man_ucb_sel |
853 ncu_int_ucb_sel ) ;
854
855
856// This handles either read nack or ifill nack
857assign rd_nack_ucb_sel = no_match_ucb &
858 (c2i_packet_is_rd_req | c2i_packet_is_if_req);
859
860// The Black-Hole ucb is for sinking packets with undefined transaction type
861assign blackhole_acpt = c2i_packet_vld &
862 ((~c2i_packet_is_rd_req & ~c2i_packet_is_wr_req &
863 ~c2i_packet_is_if_req & ~c2i_packet_is_ack) |
864 (no_match_ucb & c2i_packet_is_wr_req));
865
866// ucb_buf_acpt means c2i_packet has been accepted by a ucb buffer
867// Assertion: At most only one device should accept
868assign ucb_buf_acpt = ( dmupio_ucb_buf_acpt |
869 dmucsr_ucb_buf_acpt |
870 ssi_ucb_buf_acpt |
871 mcu0_ucb_buf_acpt |
872 mcu1_ucb_buf_acpt |
873 mcu2_ucb_buf_acpt |
874 mcu3_ucb_buf_acpt |
875 ccu_ucb_buf_acpt |
876 rcu_ucb_buf_acpt |
877 dbg1_ucb_buf_acpt |
878 niu_ucb_buf_acpt |
879 ncu_man_ucb_buf_acpt |
880 ncu_int_ucb_buf_acpt |
881 bounce_ucb_buf_acpt |
882 rd_nack_ucb_buf_acpt |
883 blackhole_acpt );
884
885
886// Generate write ack if ucb buffer is accepting a write request
887assign srvc_wr_ack = cpu_sel & (ucb_buf_acpt|(cpu_vld&pcx_packet_pe)) &
888 cpu_packet_needs_wr_ack & ~dmupio_ucb_sel;
889
890
891/**** adding clock header ****/
892ncu_c2isc_ctl_l1clkhdr_ctl_macro clkgen (
893 .l2clk (iol2clk),
894 .l1en (1'b1),
895 .l1clk (l1clk),
896 .pce_ov(pce_ov),
897 .stop(stop),
898 .se(se)
899 );
900
901/*** building tcu port ***/
902assign siclk = tcu_aclk;
903assign soclk = tcu_bclk;
904assign se = tcu_scan_en;
905assign pce_ov = tcu_pce_ov;
906assign stop = tcu_clk_stop;
907
908// fixscan start:
909assign cpubuf_tail_ff_scanin = scan_in ;
910assign cpubuf_head_d1_ff_scanin = cpubuf_tail_ff_scanout ;
911assign aog_ff_scanin = cpubuf_head_d1_ff_scanout;
912assign aov_ff_scanin = aog_ff_scanout ;
913assign pav_ff_scanin = aov_ff_scanout ;
914assign pbv_ff_scanin = pav_ff_scanout ;
915assign pbs_ff_scanin = pbv_ff_scanout ;
916assign cpu_vld_ff_scanin = pbs_ff_scanout ;
917assign scan_out = cpu_vld_ff_scanout ;
918// fixscan end:
919endmodule // c2i_sctrl
920
921
922// Local Variables:
923// verilog-auto-sense-defines-constant:t
924// End:
925
926
927
928
929
930
931// any PARAMS parms go into naming of macro
932
933module ncu_c2isc_ctl_msff_ctl_macro__width_6 (
934 din,
935 l1clk,
936 scan_in,
937 siclk,
938 soclk,
939 dout,
940 scan_out);
941wire [5:0] fdin;
942wire [4:0] so;
943
944 input [5:0] din;
945 input l1clk;
946 input scan_in;
947
948
949 input siclk;
950 input soclk;
951
952 output [5:0] dout;
953 output scan_out;
954assign fdin[5:0] = din[5:0];
955
956
957
958
959
960
961dff #(6) d0_0 (
962.l1clk(l1clk),
963.siclk(siclk),
964.soclk(soclk),
965.d(fdin[5:0]),
966.si({scan_in,so[4:0]}),
967.so({so[4:0],scan_out}),
968.q(dout[5:0])
969);
970
971
972
973
974
975
976
977
978
979
980
981
982endmodule
983
984
985
986
987
988
989
990
991
992
993
994
995
996// any PARAMS parms go into naming of macro
997
998module ncu_c2isc_ctl_msff_ctl_macro__width_1 (
999 din,
1000 l1clk,
1001 scan_in,
1002 siclk,
1003 soclk,
1004 dout,
1005 scan_out);
1006wire [0:0] fdin;
1007
1008 input [0:0] din;
1009 input l1clk;
1010 input scan_in;
1011
1012
1013 input siclk;
1014 input soclk;
1015
1016 output [0:0] dout;
1017 output scan_out;
1018assign fdin[0:0] = din[0:0];
1019
1020
1021
1022
1023
1024
1025dff #(1) d0_0 (
1026.l1clk(l1clk),
1027.siclk(siclk),
1028.soclk(soclk),
1029.d(fdin[0:0]),
1030.si(scan_in),
1031.so(scan_out),
1032.q(dout[0:0])
1033);
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046endmodule
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060// any PARAMS parms go into naming of macro
1061
1062module ncu_c2isc_ctl_msff_ctl_macro__en_1__width_1 (
1063 din,
1064 en,
1065 l1clk,
1066 scan_in,
1067 siclk,
1068 soclk,
1069 dout,
1070 scan_out);
1071wire [0:0] fdin;
1072
1073 input [0:0] din;
1074 input en;
1075 input l1clk;
1076 input scan_in;
1077
1078
1079 input siclk;
1080 input soclk;
1081
1082 output [0:0] dout;
1083 output scan_out;
1084assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
1085
1086
1087
1088
1089
1090
1091dff #(1) d0_0 (
1092.l1clk(l1clk),
1093.siclk(siclk),
1094.soclk(soclk),
1095.d(fdin[0:0]),
1096.si(scan_in),
1097.so(scan_out),
1098.q(dout[0:0])
1099);
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112endmodule
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126// any PARAMS parms go into naming of macro
1127
1128module ncu_c2isc_ctl_l1clkhdr_ctl_macro (
1129 l2clk,
1130 l1en,
1131 pce_ov,
1132 stop,
1133 se,
1134 l1clk);
1135
1136
1137 input l2clk;
1138 input l1en;
1139 input pce_ov;
1140 input stop;
1141 input se;
1142 output l1clk;
1143
1144
1145
1146
1147
1148cl_sc1_l1hdr_8x c_0 (
1149
1150
1151 .l2clk(l2clk),
1152 .pce(l1en),
1153 .l1clk(l1clk),
1154 .se(se),
1155 .pce_ov(pce_ov),
1156 .stop(stop)
1157);
1158
1159
1160
1161endmodule
1162
1163
1164
1165
1166
1167
1168
1169