// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: ncu_ssiflow_ctl.v
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
wire [1:0] buf_head_next;
wire buf_head_ff0_scanin;
wire buf_head_ff0_scanout;
wire buf_head_ff1_scanin;
wire buf_head_ff1_scanout;
wire [1:0] buf_tail_next;
wire buf_tail_ff0_scanin;
wire buf_tail_ff0_scanout;
wire buf_tail_ff1_scanin;
wire buf_tail_ff1_scanout;
wire buf_full_ff_scanout;
wire buf_empty_ff_scanin;
wire buf_empty_ff_scanout;
wire [8:0] unconnected_rsvd;
wire ack_buf_vld_ff_scanin;
wire ack_buf_vld_ff_scanout;
wire ack_buf_is_nack_ff_scanin;
wire ack_buf_is_nack_ff_scanout;
wire int_buf_vld_ff_scanin;
wire int_buf_vld_ff_scanout;
wire int_last_rd_ff_scanin;
wire int_last_rd_ff_scanout;
wire [127:0] outdata_buf_in;
wire [31:0] outdata_vec_in;
wire ucb_bus_out_scanout;
// Request from IO Bridge
input [3:0] iob_ucb_data;
output [2:0] size_in; // only pertinent to JBI and SPI
// Ack/Nack from local unit
// Interrupt from local unit
input [3:0] int_typ; // interrupt type
input [5:0] int_thr_id; // interrupt thread ID
input [8:0] dev_id; // interrupt device ID
input [31:0] int_stat; // interrupt status
input [5:0] int_vec; // interrupt vector
output [3:0] ucb_iob_data;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
ncu_ssiui4_ctl ucb_bus_in (/*autoinst*/
.stall(ucb_iob_stall), // Templated
.indata_buf_vld(indata_buf_vld),
.indata_buf(indata_buf[127:0]),
.scan_in(ucb_bus_in_scanin),
.scan_out(ucb_bus_in_scanout),
.tcu_clk_stop(tcu_clk_stop),
.tcu_scan_en(tcu_scan_en),
.vld(iob_ucb_vld), // Templated
.data(iob_ucb_data[3:0]), // Templated
.stall_a1(ucb_iob_stall_a1)); // Templated
/************************************************************
* Decode inbound packet type
************************************************************/
assign read_pending = (indata_buf[3:0] == 4'b0100) & indata_buf_vld;
assign write_pending = (indata_buf[3:0] == 4'b0101) & indata_buf_vld;
assign ifill_pending = (indata_buf[3:0] == 4'b0110) & indata_buf_vld;
assign ucb_iob_stall_a1 = (read_pending | write_pending | ifill_pending) & buf_full;
/************************************************************
************************************************************/
assign rd_buf = req_acpted;
assign buf_head_next[1:0] = rd_buf ? {buf_head[0],buf_head[1]} : buf_head[1:0];
assign buf_head_next0_n = ~buf_head_next[0] ;
assign buf_head[0] = ~buf_head0_n ;
ncu_ssiflow_ctl_msff_ctl_macro__width_1 buf_head_ff0
.scan_in(buf_head_ff0_scanin),
.scan_out(buf_head_ff0_scanout),
ncu_ssiflow_ctl_msff_ctl_macro__width_1 buf_head_ff1
.scan_in(buf_head_ff1_scanin),
.scan_out(buf_head_ff1_scanout),
assign wr_buf = (read_pending | write_pending | ifill_pending) & ~buf_full;
assign buf_tail_next[1:0] = wr_buf ? {buf_tail[0], buf_tail[1]} : buf_tail[1:0];
assign buf_tail_next0_n = ~buf_tail_next[0];
assign buf_tail[0] = ~buf_tail0_n ;
ncu_ssiflow_ctl_msff_ctl_macro__width_1 buf_tail_ff0
.scan_in(buf_tail_ff0_scanin),
.scan_out(buf_tail_ff0_scanout),
ncu_ssiflow_ctl_msff_ctl_macro__width_1 buf_tail_ff1
.scan_in(buf_tail_ff1_scanin),
.scan_out(buf_tail_ff1_scanout),
assign buf_full_next = (buf_head_next[1:0] == buf_tail_next[1:0]) & wr_buf;
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_1 buf_full_ff
.scan_in(buf_full_ff_scanin),
.scan_out(buf_full_ff_scanout),
assign buf_empty_next = ((buf_head_next[1:0] == buf_tail_next[1:0]) & rd_buf) ;
assign buf_empty_next_n = ~buf_empty_next ;
assign buf_empty = ~buf_empty_n;
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_1 buf_empty_ff
.scan_in(buf_empty_ff_scanin),
.scan_out(buf_empty_ff_scanout),
req_in[53:0]} = {indata_buf[127:64],
assign buf0_en = buf_tail[0] & wr_buf;
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_118 buf0_ff
.scan_in(buf0_ff_scanin),
.scan_out(buf0_ff_scanout),
assign buf1_en = buf_tail[1] & wr_buf;
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_118 buf1_ff
.scan_in(buf1_ff_scanin),
.scan_out(buf1_ff_scanout),
assign req_out[117:0] = buf_head[0] ? buf0[117:0] :
buf_head[1] ? buf1[117:0] :118'b0 ;
/************************************************************
* Inbound interface to local unit
************************************************************/
rd_req_vld_nq} = req_out[117:0];
assign rd_req_vld = rd_req_vld_nq & ~buf_empty;
assign wr_req_vld = wr_req_vld_nq & ~buf_empty;
assign ifill_req_vld = ifill_req_vld_nq & ~buf_empty & sck_cntexp;
/************************************************************
************************************************************/
assign ack_buf_wr = rd_ack_vld | rd_nack_vld | ifill_ack_vld | ifill_nack_vld;
assign ack_buf_vld_next = ack_buf_wr ? 1'b1 :
ack_buf_rd ? 1'b0 : ack_buf_vld;
ncu_ssiflow_ctl_msff_ctl_macro__width_1 ack_buf_vld_ff
.scan_in(ack_buf_vld_ff_scanin),
.scan_out(ack_buf_vld_ff_scanout),
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_1 ack_buf_is_nack_ff
.scan_in(ack_buf_is_nack_ff_scanin),
.scan_out(ack_buf_is_nack_ff_scanout),
.din (rd_nack_vld|ifill_nack_vld),
assign ack_typ_out[3:0] = rd_ack_vld ? 4'b0001: //READ_ACK
rd_nack_vld ? 4'b0000: //READ_NACK
ifill_ack_vld ? 4'b0011: //IFILL_ACK
assign ack_buf_in[75:0] = {data_out[63:0],
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_76 ack_buf_ff
.scan_in(ack_buf_ff_scanin),
.scan_out(ack_buf_ff_scanout),
assign ack_buf_vec[31:0] = ack_buf_is_nack ? {16'h0000,16'hffff} : {32'hffff_ffff} ;
assign ack_busy = ack_buf_vld;
/************************************************************
************************************************************/
// Assertion: int_buf_wr shoudn't be asserted if int_buf_busy
assign int_buf_wr = int_vld;
assign int_buf_vld_next = int_buf_wr ? 1'b1 :
int_buf_rd ? 1'b0 : int_buf_vld;
ncu_ssiflow_ctl_msff_ctl_macro__width_1 int_buf_vld_ff
.scan_in(int_buf_vld_ff_scanin),
.scan_out(int_buf_vld_ff_scanout),
assign int_buf_in[56:0] = { int_vec[5:0],
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_57 int_buf_ff
.scan_in(int_buf_ff_scanin),
.scan_out(int_buf_ff_scanout),
assign int_buf_vec[31:0] = {16'h0000,16'hffff} ;
assign int_busy = int_buf_vld;
/************************************************************
* Outbound ack/interrupt Arbitration
************************************************************/
ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_1 int_last_rd_ff
.scan_in(int_last_rd_ff_scanin),
.scan_out(int_last_rd_ff_scanout),
.en (ack_buf_rd|int_buf_rd),
assign ack_buf_rd = ~outdata_buf_busy & ack_buf_vld &
(~int_buf_vld | int_last_rd);
assign int_buf_rd = ~outdata_buf_busy & int_buf_vld &
(~ack_buf_vld | ~int_last_rd);
assign outdata_buf_wr = ack_buf_rd | int_buf_rd;
assign outdata_buf_in[127:0] = ack_buf_rd ? {ack_buf[75:12],
assign outdata_vec_in[31:0] = ack_buf_rd ? ack_buf_vec[31:0] : int_buf_vec[31:0];
ncu_ssiuo4_ctl ucb_bus_out (/*autoinst*/
.vld(ucb_iob_vld), // Templated
.data(ucb_iob_data[3:0]), // Templated
.outdata_buf_busy(outdata_buf_busy),
.scan_in(ucb_bus_out_scanin),
.scan_out(ucb_bus_out_scanout),
.tcu_clk_stop(tcu_clk_stop),
.tcu_scan_en(tcu_scan_en),
.stall(iob_ucb_stall), // Templated
.outdata_buf_in(outdata_buf_in[127:0]),
.outdata_vec_in(outdata_vec_in[31:0]), // Templated
.outdata_buf_wr(outdata_buf_wr));
/**** adding clock header ****/
ncu_ssiflow_ctl_l1clkhdr_ctl_macro clkgen (
/*** building tcu port ***/
assign pce_ov = tcu_pce_ov;
assign stop = tcu_clk_stop;
assign ucb_bus_in_scanin = scan_in ;
assign buf_head_ff0_scanin = ucb_bus_in_scanout ;
assign buf_head_ff1_scanin = buf_head_ff0_scanout ;
assign buf_tail_ff0_scanin = buf_head_ff1_scanout ;
assign buf_tail_ff1_scanin = buf_tail_ff0_scanout ;
assign buf_full_ff_scanin = buf_tail_ff1_scanout ;
assign buf_empty_ff_scanin = buf_full_ff_scanout ;
assign buf0_ff_scanin = buf_empty_ff_scanout ;
assign buf1_ff_scanin = buf0_ff_scanout ;
assign ack_buf_vld_ff_scanin = buf1_ff_scanout ;
assign ack_buf_is_nack_ff_scanin = ack_buf_vld_ff_scanout ;
assign ack_buf_ff_scanin = ack_buf_is_nack_ff_scanout;
assign int_buf_vld_ff_scanin = ack_buf_ff_scanout ;
assign int_buf_ff_scanin = int_buf_vld_ff_scanout ;
assign int_last_rd_ff_scanin = int_buf_ff_scanout ;
assign ucb_bus_out_scanin = int_last_rd_ff_scanout ;
assign scan_out = ucb_bus_out_scanout ;
// verilog-library-directories:(".")
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_1 (
assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_4 (
assign fdin[3:0] = (din[3:0] & {4{en}}) | (dout[3:0] & ~{4{en}});
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__width_1 (
assign fdin[0:0] = din[0:0];
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_32 (
assign fdin[31:0] = (din[31:0] & {32{en}}) | (dout[31:0] & ~{32{en}});
.so({so[30:0],scan_out}),
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_128 (
assign fdin[127:0] = (din[127:0] & {128{en}}) | (dout[127:0] & ~{128{en}});
.si({scan_in,so[126:0]}),
.so({so[126:0],scan_out}),
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_l1clkhdr_ctl_macro (
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_118 (
assign fdin[117:0] = (din[117:0] & {118{en}}) | (dout[117:0] & ~{118{en}});
.si({scan_in,so[116:0]}),
.so({so[116:0],scan_out}),
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_76 (
assign fdin[75:0] = (din[75:0] & {76{en}}) | (dout[75:0] & ~{76{en}});
.so({so[74:0],scan_out}),
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__en_1__width_57 (
assign fdin[56:0] = (din[56:0] & {57{en}}) | (dout[56:0] & ~{57{en}});
.so({so[55:0],scan_out}),
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__width_32 (
assign fdin[31:0] = din[31:0];
.so({so[30:0],scan_out}),
// any PARAMS parms go into naming of macro
module ncu_ssiflow_ctl_msff_ctl_macro__width_128 (
assign fdin[127:0] = din[127:0];
.si({scan_in,so[126:0]}),
.so({so[126:0],scan_out}),