// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: xtlm_sm.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 ============================================
/*************************************************************************
* Description : This module is used to gnerate txfifo_rd_en,
* Copyright (c) 2002, Sun Microsystems, Inc.
* Sun Proprietary and Confidential
*************************************************************************/
max_pkt_size_limit_txclk,
min_pkt_size_limit_txclk,
`ifdef ENABLE_XMAC_PAD_64_BYTES
tx_on, // exclude pa_time
input txfifo_empty_txclk;
input eop_tag; // Hi or Low eop pulse
input max_pkt_size_limit_txclk;
input min_pkt_size_limit_txclk;
`ifdef ENABLE_XMAC_PAD_64_BYTES
output tx_on; // exclude pa_time
output tx_max_pkt_size_err;
output restart_ipg_timer;
output txfifo_underrun_txclk;
reg txfifo_underrun_txclk;
reg tx_max_pkt_size_err ;
parameter IDLE = 3'b000, // 0
RD_DATA = 3'b100, // 4 , no 2
`ifdef ENABLE_XMAC_PAD_64_BYTES
PHONEY_RD = 3'b001; // 1 , no 7 // read/flush out remaining packet.
assign tx_on = xtlm_state[2];
// assign tx_on = (xtlm_state == RD_DATA) |
// (xtlm_state == PAD_COND3) |
// (xtlm_state == PAD_COND4) |
// (xtlm_state == PAD_UNDER) ;
/* ----------------------- com part ----------------------- */
always @ (xtlm_state or eop_tag or txfifo_unload_rdy or
ipg_done or pause or tx_enable_txclk or link_up or
min_pkt_size_limit_txclk or txfifo_empty_txclk or
`ifdef ENABLE_XMAC_PAD_64_BYTES
cond1 or cond2 or cond3 or cond4
txfifo_xfr_err = 0; // a delay version of force_tx_err.
txfifo_underrun_txclk = 0;
casex(xtlm_state) // synopsys parallel_case full_case
if (eop_tag) // packet is <= 16 bytes
nx_xtlm_state = xtlm_state;
txfifo_rd_en = 1; // phoney read
else if(txfifo_unload_rdy & ipg_done & ~pause & tx_enable_txclk & link_up) // (~eop_tag)
begin // normal data transfer
end // if (~txfifo_empty_txclk & ipg_done)
else nx_xtlm_state = xtlm_state; // stay
casex({eop_tag,min_pkt_size_limit_txclk,txfifo_empty_txclk}) // synopsys parallel_case full_case
3'b0x0: begin // normal reading
if (max_pkt_size_limit_txclk)
nx_xtlm_state = PHONEY_RD;
end // if (max_pkt_size_limit_txclk)
nx_xtlm_state = xtlm_state; // stay
txfifo_rd_en = 1; // valid read
end // else: !if(max_pkt_size_limit_txclk)
3'b001: begin // txfifo underrun
nx_xtlm_state = PHONEY_RD;
txfifo_underrun_txclk = 1;
nx_xtlm_state = PAD_UNDER;
3'b100: begin // normal ending
txfifo_rd_en = 1; // valid read
3'b1x1: begin // impossible condition
txfifo_rd_en = 1; // valid read
`ifdef ENABLE_XMAC_PAD_64_BYTES
3'b110: begin // pad the min pkt
txfifo_rd_en = 1; // valid read
nx_xtlm_state = PAD_COND3;
nx_xtlm_state = PAD_COND4;
// synopsys translate_off
begin // impossible condition
endcase // casex({eop_tag,min_pkt_size_limit_txclk,txfifo_empty_txclk})
`ifdef ENABLE_XMAC_PAD_64_BYTES
nx_xtlm_state = xtlm_state;
nx_xtlm_state = PAD_COND3;
if (min_pkt_size_limit_txclk)
nx_xtlm_state = xtlm_state; // stay
nx_xtlm_state = PHONEY_RD;
casex({eop_tag,txfifo_empty_txclk}) // synopsys parallel_case full_case
nx_xtlm_state = xtlm_state; // stay
txfifo_rd_en = 1; // phoney read
nx_xtlm_state = xtlm_state; // stay
txfifo_rd_en = 1; // phoney read
// synopsys translate_off
$display("( Warning: PHONEY_RD in unknown state.)");
endcase // casex({eop_tag,txfifo_empty_txclk})
txfifo_underrun_txclk = 0;
endcase // casex(xtlm_state)
end // always @ (tx_clk or xtlm_state or eop_tag or txfifo_unload_rdy or...
RegRst #(3) xtlm_state_RegRst(.din(nx_xtlm_state),