Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / pcs_rx_dpath.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: pcs_rx_dpath.v
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35// @(#)pcs_rx_dpath.v 1.1G
36/**********************************************************************/
37/* Project Name : CASSINI */
38/* Module Name : PCS Rx Datapath */
39/* Description : The PCS Rx datapath contains the four stage */
40/* pipeline used to detect special sequences. It */
41/* also contains the Decoder block and input */
42/* register. A mux exists which selects among */
43/* several special characters and encoded data to */
44/* to be shipped over the GMII. */
45/* */
46/* Assumptions : none. */
47/* */
48/* Parent module : pcs.v */
49/* Child modules : pcs_decoder.v */
50/* Author Name : Linda Chen */
51/* Date Created : 10/24/96 */
52/* */
53/* Copyright (c) 1994, Sun Microsystems, Inc. */
54/* Sun Proprietary and Confidential */
55/* */
56/* Modifications : 12/9/98 : added output ports comma_p,k285_p for */
57/* carrier detect generation and sync */
58/* Synthesis Notes : none yet */
59/**********************************************************************/
60
61module pcs_rx_dpath (rxclk,reset_rx,enable_pci, // inputs
62 rx_10bdata,rx_d_sel,link_up_rx,
63
64 rxd,
65 rx_8bdata,kchar,disp_err,dec_err, // outputs
66 rx_8bdata_p,kchar_p,disp_err_p,dec_err_p,
67 rx_8bdata_pp,kchar_pp,
68 got_d_linkconf_p,comma_p,k285w1_p,enable_rx);
69
70input rxclk; // 125 MHz rx clock
71input reset_rx; // reset synchronized to rx clk
72input enable_pci; // PCS enable bit
73input [9:0] rx_10bdata; // incoming 10 bits from link
74input [2:0] rx_d_sel; // receive data mux to GMII select
75input link_up_rx; // link status sychronized to rx clock domain
76
77output [7:0] rxd; // data going onto GMII
78output [7:0] rx_8bdata, // data from decoder
79 rx_8bdata_p, // data from decoder previous stage
80 rx_8bdata_pp;
81output kchar,
82 kchar_p,
83 kchar_pp;
84output disp_err, // disparity error flag for rx_8bdata
85 disp_err_p;
86output dec_err, // decoder error flag for rx_8bdata
87 dec_err_p;
88output got_d_linkconf_p;
89output comma_p;
90output k285w1_p;
91output enable_rx;
92
93wire [9:0] rx_10bdec_in; // data bus input to encoder
94wire [7:0] nxt_rxd; // rx data bus to MAC
95wire enable_rx; // PCS enable synchronized
96wire clr; // clear pipeline
97wire disp_err_p;
98wire dec_err_p;
99
100wire dec_err_pp,disp_err_pp,got_d_linkconf_pp,comma_pp,k285w1_pp;
101
102assign clr = reset_rx | ~enable_rx | !link_up_rx;
103
104/*
105** Pre Decoder Data Reg
106*/
107REG #(10) r_in_reg (.qout(rx_10bdec_in),.clk(rxclk),.din(rx_10bdata));
108
109
110/*
111** DECODER - takes whatever comes in and decodes it to an 8 bit value.
112** Generates helpful flags for special data characters and k characters.
113** Flags disparity and decode errors.
114*/
115// vlint flag_non_name_based_inst off
116pcs_decoder pcs_decoder(rx_10bdec_in,rxclk, // inputs
117
118 rx_8bdata_pp,dec_err_pp,disp_err_pp, // outputs
119 kchar_pp,got_d_linkconf_pp,comma_pp,k285w1_pp);
120// vlint flag_non_name_based_inst on
121
122/*
123** Pipeline regs
124*/
125REG #(8) r_8bdata_p (.qout(rx_8bdata_p),.clk(rxclk),.din(rx_8bdata_pp));
126REG #(8) r_8bdata (.qout(rx_8bdata),.clk(rxclk),.din(rx_8bdata_p));
127
128REG #(1) r_kchar_p (.qout(kchar_p),.clk(rxclk),.din(kchar_pp));
129REG #(1) r_kchar (.qout(kchar),.clk(rxclk),.din(kchar_p));
130
131REG #(1) r_disp_err_p (.qout(disp_err_p),.clk(rxclk),.din(disp_err_pp));
132REG #(1) r_disp_err (.qout(disp_err),.clk(rxclk),.din(disp_err_p));
133
134REG #(1) r_dec_err_p (.qout(dec_err_p),.clk(rxclk),.din(dec_err_pp));
135REG #(1) r_dec_err (.qout(dec_err),.clk(rxclk),.din(dec_err_p));
136
137REG #(1) r_got_d_linkconf_p(.qout(got_d_linkconf_p),.clk(rxclk),
138 .din(got_d_linkconf_pp));
139REG #(1) r_comma_p(.qout(comma_p),.clk(rxclk),
140 .din(comma_pp));
141REG #(1) r_k285w1_p(.qout(k285w1_p),.clk(rxclk),
142 .din(k285w1_pp));
143
144SYNCREG r_enable_rx (enable_rx,rxclk,enable_pci);
145
146/*
147** Output MUX for rx data out
148** PCS_RXD_ZERO 3'h0
149** PCS_RXD_PREAMBLE 3'h1
150** PCS_RXD_FALSE_CARRIER 3'h2
151** PCS_RXD_CRS_EXT 3'h3
152** PCS_RXD_CRS_EXT_ER 3'h4
153** PCS_RXD_DECODER 3'h5
154*/
155MUX6TO1 #(8) rxd_outmux (.dout(nxt_rxd),.sel(rx_d_sel),.D0(8'h0),.D1(8'h55),
156 .D2(8'hE),.D3(8'hF),.D4(8'h1F),.D5(rx_8bdata));
157
158/*
159** Output RXD reg
160*/
161RREG #(8) r_rxd (.qout(rxd),.clk(rxclk),.rst(clr),.din(nxt_rxd));
162
163endmodule
164
165