// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: tcu_dmo_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 ============================================
tcu_mio_jtag_membist_mode,
wire dmo_spc4din_reg_scanin;
wire dmo_spc4din_reg_scanout;
wire [35:0] spc4_dmo_data;
wire dmo_spc6din_reg_scanin;
wire dmo_spc6din_reg_scanout;
wire [35:0] spc6_dmo_data;
wire dmo_l2t4din_reg_scanin;
wire dmo_l2t4din_reg_scanout;
wire [38:0] l2t4_dmo_data;
wire dmo_l2t6din_reg_scanin;
wire dmo_l2t6din_reg_scanout;
wire [38:0] l2t6_dmo_data;
wire dmo_rtxdin_reg_scanin;
wire dmo_rtxdin_reg_scanout;
wire [39:0] rtx_dmo_data;
wire dmo_rdpdin_reg_scanin;
wire dmo_rdpdin_reg_scanout;
wire [39:0] rdp_dmo_data;
wire dmo_tdsdin_reg_scanin;
wire dmo_tdsdin_reg_scanout;
wire [39:0] tds_dmo_data;
wire dmo_sampledata_reg_scanin;
wire dmo_sampledata_reg_scanout;
wire [39:0] dmo_sampled_data;
wire dmo_io2xdata_reg_scanin;
wire dmo_io2xdata_reg_scanout;
wire [39:0] dmo_sampled_data_io2x;
wire jtag_dmo_enable_io2x_sync;
wire dmo_muxctl_reg_scanin;
wire dmo_muxctl_reg_scanout;
wire [15:0] dmo_ctl_next;
wire dmo_ensync_reg_scanin;
wire dmo_ensync_reg_scanout;
wire jtag_dmo_enable_sync;
wire dmo_dmoen_reg_scanin;
wire dmo_dmoen_reg_scanout;
wire dmo_updsync_reg_scanin;
wire dmo_updsync_reg_scanout;
wire jtag_dmo_control_upd_sync;
wire dmo_dmosync_reg_scanin;
wire dmo_dmosync_reg_scanout;
wire dmo_dmosyncout_reg_scanin;
wire dmo_dmosyncout_reg_scanout;
wire dmo_dmodf_reg_scanin;
wire dmo_dmodf_reg_scanout;
wire mbist_start_io2x_sync;
// Scan input/output for this block
input io_cmp_sync_en_local;
input cmp_io2x_sync_en_local;
// MBIST Start from mbist controller
input mbist_start_io_sync;
output [39:0] tcu_mio_dmo_data;
output tcu_mio_mbist_done;
output tcu_mio_mbist_fail;
output tcu_mio_jtag_membist_mode;
input [35:0] spc4_dmo_dout;
input [35:0] spc6_dmo_dout;
output [5:0] dmo_coresel;
input [38:0] l2t4_dmo_dout;
input [38:0] l2t6_dmo_dout;
input [39:0] rtx_tcu_dmo_data_out;
input [39:0] tds_tcu_dmo_dout;
input [39:0] rdp_tcu_dmo_dout;
output [2:0] tcu_rtx_dmo_ctl;
input jtag_dmo_enable; // enables DMO port
input jtag_dmo_control_upd;
input [47:0] jtag_dmo_control;
//********************************************************************
//********************************************************************
assign l1en = tcu_int_ce; // 1'b1;
assign pce_ov = tcu_pce_ov; // 1'b1;
assign siclk = tcu_int_aclk;
assign soclk = tcu_int_bclk;
tcu_dmo_ctl_l1clkhdr_ctl_macro dmo_clkgen
//*******************************************************************
// Incoming BIST Data from SPC Cores 4 & 6
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__width_36 dmo_spc4din_reg
.scan_in(dmo_spc4din_reg_scanin),
.scan_out(dmo_spc4din_reg_scanout),
.din (spc4_dmo_dout[35:0]),
.dout (spc4_dmo_data[35:0]),
tcu_dmo_ctl_msff_ctl_macro__width_36 dmo_spc6din_reg
.scan_in(dmo_spc6din_reg_scanin),
.scan_out(dmo_spc6din_reg_scanout),
.din (spc6_dmo_dout[35:0]),
.dout (spc6_dmo_data[35:0]),
//*******************************************************************
// Incoming BIST Data from L2 Tags 4 & 6
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__width_39 dmo_l2t4din_reg
.scan_in(dmo_l2t4din_reg_scanin),
.scan_out(dmo_l2t4din_reg_scanout),
.din (l2t4_dmo_dout[38:0]),
.dout (l2t4_dmo_data[38:0]),
tcu_dmo_ctl_msff_ctl_macro__width_39 dmo_l2t6din_reg
.scan_in(dmo_l2t6din_reg_scanin),
.scan_out(dmo_l2t6din_reg_scanout),
.din (l2t6_dmo_dout[38:0]),
.dout (l2t6_dmo_data[38:0]),
//*******************************************************************
// Incoming BIST Data from RTX, RDP & TDS (all NIU)
// Synchronized into cmp clock domain from IO clock domain
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__en_1__width_40 dmo_rtxdin_reg
.scan_in(dmo_rtxdin_reg_scanin),
.scan_out(dmo_rtxdin_reg_scanout),
.en (io_cmp_sync_en_local),
.din (rtx_tcu_dmo_data_out[39:0]),
.dout (rtx_dmo_data[39:0]),
tcu_dmo_ctl_msff_ctl_macro__en_1__width_40 dmo_rdpdin_reg
.scan_in(dmo_rdpdin_reg_scanin),
.scan_out(dmo_rdpdin_reg_scanout),
.en (io_cmp_sync_en_local),
.din (rdp_tcu_dmo_dout[39:0]),
.dout (rdp_dmo_data[39:0]),
tcu_dmo_ctl_msff_ctl_macro__en_1__width_40 dmo_tdsdin_reg
.scan_in(dmo_tdsdin_reg_scanin),
.scan_out(dmo_tdsdin_reg_scanout),
.en (io_cmp_sync_en_local),
.din (tds_tcu_dmo_dout[39:0]),
.dout (tds_dmo_data[39:0]),
//*******************************************************************
// Assign jtag register values to control signals
//*******************************************************************
assign spcl2t_sel = dmo_control[15];
assign spcl2tag_ctl[1:0] = dmo_control[14:13];
assign niu_ctl[1:0] = dmo_control[12:11];
assign tcu_rtx_dmo_ctl[2:0]= dmo_control[10:8];
assign dmo_dcmuxctl = dmo_control[7];
assign dmo_icmuxctl = dmo_control[6];
assign dmo_coresel[5:0] = dmo_control[5:0];
assign dmo_tagmuxctl = dmo_control[6]; // same as core's?
assign dmo_l2tsel = dmo_control[5:0]; // same as coresel
//*******************************************************************
// Incoming BIST Data from RTX, RDP & TDS (all NIU)
// Synchronized into cmp clock domain from IO clock domain
//*******************************************************************
assign spc4_sel = ~spcl2tag_ctl[1] & ~spcl2tag_ctl[0];
assign spc6_sel = ~spcl2tag_ctl[1] & spcl2tag_ctl[0];
assign l2t4_sel = spcl2tag_ctl[1] & ~spcl2tag_ctl[0];
assign l2t6_sel = spcl2tag_ctl[1] & spcl2tag_ctl[0];
assign l2tag_sel = spcl2tag_ctl[1];
assign rtx_sel = ~niu_ctl[1] & ~niu_ctl[0];
assign rdp_sel = ~niu_ctl[1] & niu_ctl[0];
assign tds_sel = niu_ctl[1] & ~niu_ctl[0];
// Multiplex core & l2tag dmo data
assign spc_data[35:0] = spc4_sel ? spc4_dmo_data[35:0]
: spc6_sel ? spc6_dmo_data[35:0] : 36'b0;
assign l2t_data[38:0] = l2t4_sel ? l2t4_dmo_data[38:0]
: l2t6_sel ? l2t6_dmo_data[38:0] : 39'b0;
assign spcl2t_data[38:0] = l2tag_sel ? l2t_data[38:0] : {3'b0,spc_data[35:0]};
// Multiplex NIU dmo data
assign niu_data[39:0] = rtx_sel ? rtx_dmo_data[39:0]
: rdp_sel ? rdp_dmo_data[39:0]
: tds_sel ? tds_dmo_data[39:0]
// Select between core/l2tag and NIU
assign dmo_data[39:0] = spcl2t_sel ? {1'b0,spcl2t_data[38:0]} : niu_data[39:0];
//*******************************************************************
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__en_1__width_40 dmo_sampledata_reg
.scan_in(dmo_sampledata_reg_scanin),
.scan_out(dmo_sampledata_reg_scanout),
.dout (dmo_sampled_data[39:0]),
assign sample_data = sr_out[31];
//*******************************************************************
// Send Sample DMO Data to MIO in IO2X Domain
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__en_1__width_40 dmo_io2xdata_reg
.scan_in(dmo_io2xdata_reg_scanin),
.scan_out(dmo_io2xdata_reg_scanout),
.en (cmp_io2x_sync_en_local),
.din (dmo_sampled_data[39:0]),
.dout (dmo_sampled_data_io2x[39:0]),
assign tcu_mio_dmo_data[39:0] = dmo_sampled_data_io2x[39:0];
//*******************************************************************
// Shift Register to Generate Sample Points for DMO Data
// Uses bits 31:16 of JTAG DMO Register
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__width_32 dmo_sr_reg
.scan_in(dmo_sr_reg_scanin),
.scan_out(dmo_sr_reg_scanout),
assign sr_next[31:0] = shift ? {sr_out[0],sr_out[31:1]}
: dmoctl_upd ? jtag_dmo_control[47:16]
assign shift = jtag_dmo_enable_io2x_sync & start_dmo;
//*******************************************************************
// Mux Controls for DMO Data
// Uses bits 15:0 of JTAG DMO Register
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__en_1__width_16 dmo_muxctl_reg
.scan_in(dmo_muxctl_reg_scanin),
.scan_out(dmo_muxctl_reg_scanout),
.en (cmp_io2x_sync_en_local),
.din (dmo_ctl_next[15:0]),
.dout (dmo_control[15:0]),
assign dmo_ctl_next[15:0] = dmoctl_upd ? jtag_dmo_control[15:0]
assign dmo_cfg[47:0] = {sr_out[31:0],dmo_control[15:0]}; // to jtag
//********************************************************************
// DMO Enable from JTAG (TCK Clock Domain)
//********************************************************************
cl_sc1_clksyncff_4x dmo_en_sync_reg
.si (dmo_ensync_reg_scanin),
.so (dmo_ensync_reg_scanout),
.q (jtag_dmo_enable_sync),
tcu_dmo_ctl_msff_ctl_macro__en_1__width_1 dmo_dmoen_reg
.scan_in(dmo_dmoen_reg_scanin),
.scan_out(dmo_dmoen_reg_scanout),
.en (cmp_io2x_sync_en_local),
.din (jtag_dmo_enable_sync),
.dout (jtag_dmo_enable_io2x_sync),
assign tcu_mio_jtag_membist_mode = jtag_dmo_enable_io2x_sync;
assign start_dmo = mbist_start_io_sync;
//assign start_dmo = jtag_dmo_enable_io2x_sync; //mbist_start_io_sync;
// mbist_start_io_sync is mbist_start from mbist_ctl synch'ed with cmp_io_sync_en
//********************************************************************
// Synchronizers for Updates from JTAG (TCK Clock Domain)
//********************************************************************
cl_sc1_clksyncff_4x dmo_upd_sync_reg
.si (dmo_updsync_reg_scanin),
.so (dmo_updsync_reg_scanout),
.d (jtag_dmo_control_upd),
.q (jtag_dmo_control_upd_sync),
assign dmoctl_upd = jtag_dmo_control_upd_sync;
//*******************************************************************
// Generate mbist_sync to MIO; this runs at 1/2 frequency of data
// going to MIO, for tester to tell where/when data is valid
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__clr__1__width_1 dmo_dmosync_reg
.scan_in(dmo_dmosync_reg_scanin),
.scan_out(dmo_dmosync_reg_scanout),
tcu_dmo_ctl_msff_ctl_macro__en_1__width_1 dmo_dmosyncout_reg
.scan_in(dmo_dmosyncout_reg_scanin),
.scan_out(dmo_dmosyncout_reg_scanout),
.en (cmp_io2x_sync_en_local),
.dout (tcu_mio_dmo_sync),
assign dmo_sync_next = sample_data ? ~dmo_sync : dmo_sync;
//*******************************************************************
// Generate mbist_done, mbist_fail to MIO;
//*******************************************************************
tcu_dmo_ctl_msff_ctl_macro__en_1__width_3 dmo_dmodf_reg
.scan_in(dmo_dmodf_reg_scanin),
.scan_out(dmo_dmodf_reg_scanout),
.en (cmp_io2x_sync_en_local),
.din ({mbist_start_io_sync, done, fail}),
.dout ({mbist_start_io2x_sync, done_sync, fail_sync}),
assign mbist_start_pulse = mbist_start_io_sync & ~mbist_start_io2x_sync;
assign done = mbist_start_pulse | mbist_all_done;
assign fail = mbist_start_pulse | mbist_one_fail;
assign tcu_mio_mbist_done = done_sync;
assign tcu_mio_mbist_fail = fail_sync;
assign dmo_spc4din_reg_scanin = scan_in ;
assign dmo_spc6din_reg_scanin = dmo_spc4din_reg_scanout ;
assign dmo_l2t4din_reg_scanin = dmo_spc6din_reg_scanout ;
assign dmo_l2t6din_reg_scanin = dmo_l2t4din_reg_scanout ;
assign dmo_rtxdin_reg_scanin = dmo_l2t6din_reg_scanout ;
assign dmo_rdpdin_reg_scanin = dmo_rtxdin_reg_scanout ;
assign dmo_tdsdin_reg_scanin = dmo_rdpdin_reg_scanout ;
assign dmo_sampledata_reg_scanin = dmo_tdsdin_reg_scanout ;
assign dmo_io2xdata_reg_scanin = dmo_sampledata_reg_scanout;
assign dmo_sr_reg_scanin = dmo_io2xdata_reg_scanout ;
assign dmo_muxctl_reg_scanin = dmo_sr_reg_scanout ;
assign dmo_ensync_reg_scanin = dmo_muxctl_reg_scanout ;
assign dmo_dmoen_reg_scanin = dmo_ensync_reg_scanout ;
assign dmo_updsync_reg_scanin = dmo_dmoen_reg_scanout ;
assign dmo_dmosync_reg_scanin = dmo_updsync_reg_scanout ;
assign dmo_dmosyncout_reg_scanin = dmo_dmosync_reg_scanout ;
assign dmo_dmodf_reg_scanin = dmo_dmosyncout_reg_scanout ;
assign scan_out = dmo_dmodf_reg_scanout ;
// any PARAMS parms go into naming of macro
module tcu_dmo_ctl_l1clkhdr_ctl_macro (
// any PARAMS parms go into naming of macro
module tcu_dmo_ctl_msff_ctl_macro__width_36 (
assign fdin[35:0] = din[35:0];
.so({so[34:0],scan_out}),
// any PARAMS parms go into naming of macro
module tcu_dmo_ctl_msff_ctl_macro__width_39 (
assign fdin[38:0] = din[38:0];
.so({so[37:0],scan_out}),
// any PARAMS parms go into naming of macro
module tcu_dmo_ctl_msff_ctl_macro__en_1__width_40 (
assign fdin[39:0] = (din[39:0] & {40{en}}) | (dout[39:0] & ~{40{en}});
.so({so[38:0],scan_out}),
// any PARAMS parms go into naming of macro
module tcu_dmo_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 tcu_dmo_ctl_msff_ctl_macro__en_1__width_16 (
assign fdin[15:0] = (din[15:0] & {16{en}}) | (dout[15:0] & ~{16{en}});
.so({so[14:0],scan_out}),
// any PARAMS parms go into naming of macro
module tcu_dmo_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 tcu_dmo_ctl_msff_ctl_macro__clr__1__width_1 (
assign fdin[0:0] = din[0:0] & ~{1{(~clr_)}};
// any PARAMS parms go into naming of macro
module tcu_dmo_ctl_msff_ctl_macro__en_1__width_3 (
assign fdin[2:0] = (din[2:0] & {3{en}}) | (dout[2:0] & ~{3{en}});