// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: port_clk.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 ============================================
`include "neptune_defines.h"
module port_clk( tx_clkp,
input [3:0] tx_config, rx_config;
reg [3:0] old_tx_config, old_rx_config;
//assign #7 tx_clkp = tx_clkp_int;
//assign #3 tx_clkp = rx_clkp;
assign #3 tx_clkp = rx_clkn;
#5 old_tx_config = tx_config;
#5 old_rx_config = rx_config;
parameter txdelay_0 = 400, // Clock period for 10MBS (2.5Mhz)
txdelay_1 = 200, // Clock period for 10MBS (2.5Mhz)
txdelay_2 = 20, // Clock period for 100MBS (25 Mhz)
txdelay_3 = 4, // Clock period for 1000MBS (125 Mhz)
txdelay_4 = 0.4; // Clock period for 10GBS (156.25 Mhz)
parameter rxdelay_0 = 400, // Clock period for 10MBS (2.5 Mhz)
rxdelay_1 = 200, // Clock period for 10MBS (2.5 Mhz)
rxdelay_2 = 20, // Clock period for 100MBS (25 Mhz)
rxdelay_3 = 4, // Clock period for 1000MBS (125 Mhz)
rxdelay_4 = 0.4; // Clock period for 10GBS (156.25 Mhz)
assign tx_clkn = ~tx_clkp_int;
assign rx_clkn = ~rx_clkp;
tx_cycle=txdelay_3; // -- Added the default value as this causes simulation hang
//$display("ERROR: %m Invalid tx_config %0d",tx_config);
if(old_tx_config != tx_config)
old_tx_config = tx_config;
repeat(2) @(posedge `TOP.core_clk);
repeat(2) @(posedge `TOP.core_clk);
#tx_cycle tx_clkp_int = ~tx_clkp_int;
repeat(2) @(posedge `TOP.core_clk);
repeat(2) @(posedge `TOP.core_clk);
#`TX_CLK_SKEW tx_clkp_int = ~tx_clkp_int;
repeat(4) @(posedge `TOP.core_clk);
repeat(4) @(posedge `TOP.core_clk);
#(7.5/2) tx_clkp_int = ~tx_clkp_int;
repeat(4) @(posedge `TOP.core_clk);
repeat(4) @(posedge `TOP.core_clk);
#(7.5/4*3) tx_clkp_int = ~tx_clkp_int;
repeat(4) @(posedge `TOP.core_clk);
repeat(4) @(posedge `TOP.core_clk);
#(7.5/4) tx_clkp_int = ~tx_clkp_int;
rx_cycle=rxdelay_3; // -- Added the default value as this causes simulation hang
//$display("ERROR: %m Invalid rx_config %0d",rx_config);
if(old_rx_config != rx_config)
old_rx_config = rx_config;
repeat(2) @(posedge `TOP.core_clk);
repeat(2) @(posedge `TOP.core_clk);
#rx_cycle rx_clkp = ~rx_clkp;
repeat(2) @(posedge `TOP.core_clk);
repeat(2) @(posedge `TOP.core_clk);
#`RX_CLK_SKEW rx_clkp = ~rx_clkp;