// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: sop_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 : start of frame deliminter detection state machine.
* It looks at two different data point at different time.
* In the initial state CHK_SOP sop_sm looks at
* xrc_a, xrc_b, xrd_a, xrd_b.
* S_detected is used at this state.
* After S is verify, sop_sm is in CHK_T_E state and looks at
* rxc_a, rxc_b, rxd_a, rxd_b.
* T_detected_at_modified_pkt and RR_detected_at_modified_pkt
* are used at this state.
* Copyright (c) 2002, Sun Microsystems, Inc.
* Sun Proprietary and Confidential
* Modification : complete redesign on 5/29/03 to take care of
*************************************************************************/
T_detected_at_modified_pkt,
MID_PKT_ERR_detected_at_modified_pkt,
input T_detected_at_modified_pkt;
input MID_PKT_ERR_detected_at_modified_pkt;
input rxfifo_afull_rxclk;
reg nx_sop_state;// next state
wire sop_state; // current state
// ------------------------------------------------
// -------------------------- --------------------
// xrc_a xrc_b encode comments
// ------- ------- ---------- --------------------
// S I 2'b01 pull b (abnormal)
// D S 2'b10 swap a&b (abnormal)
// I S 2'b11 swap a&b + pull a
// ------------------------------------------------
// 1. whenever the I is detected,
// the rxc_a_p1/rxc_b_p1 is used.
// 2. sel[1]: is the swap enable bit
// sel[0]: is the delay bit.
parameter CHK_SOP = 1'b0,
/* ----------------------- com part ----------------------- */
always @ (sop_state or rxfifo_full_rxclk or rxfifo_afull_rxclk or
link_fault or S_detected or S_D or S_I or D_S or I_S or
T_detected_at_modified_pkt or MID_PKT_ERR_detected_at_modified_pkt)
case (sop_state) // synopsys parallel_case full_case
CHK_SOP: if (rxfifo_full_rxclk | rxfifo_afull_rxclk |
link_fault | ~S_detected)
nx_sop_state = sop_state; // stay
CHK_T_E: if (rxfifo_full_rxclk | rxfifo_afull_rxclk |
link_fault | T_detected_at_modified_pkt | (~T_detected_at_modified_pkt & MID_PKT_ERR_detected_at_modified_pkt))
else nx_sop_state = sop_state; // stay
endcase // case(sop_state)
end // always @ (sop_state or S_detected_R or S_detected_F or...
RegRst #(1) sop_state_RegRst(.clk(rx_clk),.reset(rx_reset),.din(nx_sop_state),.qout(sop_state));