Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: xpcs_rxio_sync.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 | // **************************************************************** | |
36 | // | |
37 | // Sun Proprietary/Confidential: Internal Use Only | |
38 | // | |
39 | // **************************************************************** | |
40 | // Design: IB Phy Interface Core | |
41 | // Block: IB Phy Interface Core Top Level | |
42 | // Author: Carlos Castil | |
43 | // | |
44 | // Module: xpcs_rxio_sync | |
45 | // File: xpcs_rxio_sync.v | |
46 | // | |
47 | // Description: This block contains an X12 receive physical | |
48 | // channel. | |
49 | // | |
50 | // Revision History | |
51 | // ------------------------------------------------------------ | |
52 | // Ver Date Comments | |
53 | // ------------------------------------------------------------ | |
54 | // 1.0 09/21/02 Created | |
55 | // | |
56 | // **************************************************************** | |
57 | ||
58 | module xpcs_rxio_sync ( | |
59 | rx_clk, | |
60 | ||
61 | reset_rxclk, | |
62 | reset_rxclk_lane, | |
63 | ||
64 | flush, | |
65 | ||
66 | rx_signal_detect, | |
67 | ||
68 | hold, | |
69 | ||
70 | byte_out, | |
71 | special_out, | |
72 | error_out, | |
73 | ||
74 | symbol_in, | |
75 | ||
76 | csr_lane_sync_state, | |
77 | csr_lane_sync_status, | |
78 | ||
79 | rx_lane_clk); | |
80 | ||
81 | // RX Link Interface | |
82 | ||
83 | input rx_clk; | |
84 | input rx_signal_detect; | |
85 | input reset_rxclk; | |
86 | input reset_rxclk_lane; | |
87 | input rx_lane_clk; | |
88 | input flush; | |
89 | ||
90 | input hold; | |
91 | ||
92 | input [9:0] symbol_in; | |
93 | ||
94 | output [7:0] byte_out; | |
95 | output special_out; | |
96 | output error_out; | |
97 | ||
98 | output csr_lane_sync_status; | |
99 | output [3:0] csr_lane_sync_state; | |
100 | ||
101 | // Wires | |
102 | ||
103 | wire rx_lane_clk; | |
104 | ||
105 | wire [7:0] byte_deskew; | |
106 | wire special_deskew; | |
107 | wire error_deskew; | |
108 | ||
109 | wire [2:0] w_ptr; | |
110 | wire [2:0] r_ptr; | |
111 | ||
112 | reg flush_d; | |
113 | ||
114 | wire flush_hold; | |
115 | wire flush_sync; | |
116 | ||
117 | ||
118 | // ********************************************** | |
119 | // Synchronize flush from rx_clk to rx lane clk | |
120 | // ********************************************** | |
121 | ||
122 | always @ (posedge rx_clk) | |
123 | flush_d <= flush; | |
124 | ||
125 | assign flush_hold = flush | flush_d; | |
126 | ||
127 | SYNC_CELL FLUSH_SYNC (.D(flush_hold), | |
128 | .CP(rx_lane_clk), | |
129 | .Q(flush_sync)); | |
130 | ||
131 | xpcs_rxio_sync_fifo_ptr xpcs_rxio_sync_fifo_ptr ( | |
132 | .w_clk (rx_lane_clk), | |
133 | .w_rst (reset_rxclk_lane), | |
134 | ||
135 | .rx_clk (rx_clk), | |
136 | ||
137 | .w_ptr (w_ptr), | |
138 | .r_ptr (r_ptr), | |
139 | ||
140 | .hold (hold), | |
141 | ||
142 | .rst (reset_rxclk), | |
143 | .flush (flush) ); | |
144 | ||
145 | ||
146 | // 10b/8b decoder for low byte | |
147 | ||
148 | xpcs_rxio_sync_decoder xpcs_rxio_sync_decode ( | |
149 | .rx_lane_clk (rx_lane_clk), | |
150 | .rx_lane_reset (reset_rxclk_lane), | |
151 | ||
152 | .rx_symbol (symbol_in), | |
153 | ||
154 | .byte (byte_deskew), | |
155 | .special (special_deskew), | |
156 | .error (error_deskew)); | |
157 | ||
158 | // Synchronization State Machine | |
159 | ||
160 | xpcs_rxio_sync_sm xpcs_rxio_sync_sm ( | |
161 | .rx_lane_clk (rx_lane_clk), | |
162 | .rx_signal_detect (rx_signal_detect), | |
163 | .rx_lane_reset (reset_rxclk_lane), | |
164 | ||
165 | .byte_deskew (byte_deskew), // Before synchronization on lane clock | |
166 | .special_deskew (special_deskew), | |
167 | .error_deskew (error_deskew), | |
168 | ||
169 | .state (csr_lane_sync_state), | |
170 | .csr_lane_sync_status (csr_lane_sync_status)); | |
171 | ||
172 | // deskew fifo for low byte stream | |
173 | ||
174 | xpcs_rxio_sync_deskew_fifo xpcs_rxio_sync_deskew_fifo ( | |
175 | .w_clk (rx_lane_clk), | |
176 | .w_rst (reset_rxclk_lane | flush_sync), | |
177 | ||
178 | .w_byte (byte_deskew), // Before synchronization on lane clock | |
179 | .w_special (special_deskew), | |
180 | .w_error (error_deskew), | |
181 | ||
182 | .w_ptr (w_ptr), | |
183 | .r_ptr (r_ptr), // read ptr synchronized to rx_clk | |
184 | ||
185 | .byte (byte_out), // data synchronized to rx_clk | |
186 | .special (special_out), | |
187 | .error (error_out)); | |
188 | ||
189 | endmodule |