source: PlatformSupport/Deprecated/pcores/linkport_v1_00_a/hdl/vhdl/error_detect.vhd

Last change on this file was 408, checked in by haijiang, 18 years ago
File size: 9.6 KB
Line 
1--
2--      Project:  Aurora Module Generator version 2.4
3--
4--         Date:  $Date: 2005/11/07 21:30:52 $
5--          Tag:  $Name: i+IP+98818 $
6--         File:  $RCSfile: error_detect_vhd.ejava,v $
7--          Rev:  $Revision: 1.1.2.1 $
8--
9--      Company:  Xilinx
10-- Contributors:  R. K. Awalt, B. L. Woodard, N. Gulstone
11--
12--   Disclaimer:  XILINX IS PROVIDING THIS DESIGN, CODE, OR
13--                INFORMATION "AS IS" SOLELY FOR USE IN DEVELOPING
14--                PROGRAMS AND SOLUTIONS FOR XILINX DEVICES.  BY
15--                PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
16--                ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
17--                APPLICATION OR STANDARD, XILINX IS MAKING NO
18--                REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
19--                FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE
20--                RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY
21--                REQUIRE FOR YOUR IMPLEMENTATION.  XILINX
22--                EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH
23--                RESPECT TO THE ADEQUACY OF THE IMPLEMENTATION,
24--                INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
25--                REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
26--                FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES
27--                OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28--                PURPOSE.
29--
30--                (c) Copyright 2004 Xilinx, Inc.
31--                All rights reserved.
32--
33
34--
35--  ERROR_DETECT
36--
37--  Author: Nigel Gulstone
38--          Xilinx - Embedded Networking System Engineering Group
39--
40--  VHDL Translation: Brian Woodard
41--                    Xilinx - Garden Valley Design Team
42--
43--  Description : The ERROR_DETECT module monitors the MGT to detect hard
44--                errors.  It accumulates the Soft errors according to the
45--                leaky bucket algorithm described in the Aurora
46--                Specification to detect Hard errors.  All errors are
47--                reported to the Global Logic Interface.
48--
49
50library IEEE;
51use IEEE.STD_LOGIC_1164.all;
52use WORK.AURORA.all;
53
54entity ERROR_DETECT is
55
56    port (
57
58    -- Lane Init SM Interface
59
60            ENABLE_ERROR_DETECT : in std_logic;
61            HARD_ERROR_RESET    : out std_logic;
62
63    -- Global Logic Interface
64
65            SOFT_ERROR          : out std_logic;
66            HARD_ERROR          : out std_logic;
67
68    -- MGT Interface
69
70            RX_DISP_ERR         : in std_logic_vector(1 downto 0);
71            TX_K_ERR            : in std_logic_vector(1 downto 0);
72            RX_NOT_IN_TABLE     : in std_logic_vector(1 downto 0);
73            RX_BUF_STATUS       : in std_logic;
74            TX_BUF_ERR          : in std_logic;
75            RX_REALIGN          : in std_logic;
76
77    -- System Interface
78
79            USER_CLK            : in std_logic
80
81         );
82
83end ERROR_DETECT;
84
85architecture RTL of ERROR_DETECT is
86
87-- Parameter Declarations --
88
89    constant DLY : time := 1 ns;
90
91-- External Register Declarations --
92
93    signal HARD_ERROR_RESET_Buffer : std_logic;
94    signal SOFT_ERROR_Buffer       : std_logic;
95    signal HARD_ERROR_Buffer       : std_logic;
96
97-- Internal Register Declarations --
98
99    signal count_r           : std_logic_vector(0 to 1);
100    signal bucket_full_r     : std_logic;
101    signal soft_error_r      : std_logic_vector(0 to 1);
102    signal good_count_r      : std_logic_vector(0 to 1);
103    signal soft_error_flop_r : std_logic;                -- Traveling flop for timing.
104    signal hard_error_flop_r : std_logic;                -- Traveling flop for timing.
105
106begin
107
108    HARD_ERROR_RESET <= HARD_ERROR_RESET_Buffer;
109    SOFT_ERROR       <= SOFT_ERROR_Buffer;
110    HARD_ERROR       <= HARD_ERROR_Buffer;
111
112-- Main Body of Code --
113
114    -- Detect Soft Errors
115
116    process (USER_CLK)
117
118    begin
119
120        if (USER_CLK 'event and USER_CLK = '1') then
121
122            if (ENABLE_ERROR_DETECT = '1') then
123
124                soft_error_r(0) <= RX_DISP_ERR(1) or RX_NOT_IN_TABLE(1) after DLY;
125                soft_error_r(1) <= RX_DISP_ERR(0) or RX_NOT_IN_TABLE(0) after DLY;
126
127            else
128
129                soft_error_r(0) <= '0' after DLY;
130                soft_error_r(1) <= '0' after DLY;
131
132            end if;
133
134        end if;
135
136    end process;
137
138
139    process (USER_CLK)
140
141    begin
142
143        if (USER_CLK 'event and USER_CLK = '1') then
144
145            soft_error_flop_r <= soft_error_r(0) or
146                                 soft_error_r(1) after DLY;
147
148            SOFT_ERROR_Buffer <= soft_error_flop_r after DLY;
149
150        end if;
151
152    end process;
153
154
155    -- Detect Hard Errors
156
157    process (USER_CLK)
158
159    begin
160
161        if (USER_CLK 'event and USER_CLK = '1') then
162
163            if (ENABLE_ERROR_DETECT = '1') then
164
165                hard_error_flop_r <= std_bool(TX_K_ERR /= "00") or
166                                     RX_BUF_STATUS or
167                                     TX_BUF_ERR or
168                                     RX_REALIGN or
169                                     bucket_full_r after DLY;
170
171                HARD_ERROR_Buffer <= hard_error_flop_r after DLY;
172
173            else
174
175                hard_error_flop_r <= '0' after DLY;
176                HARD_ERROR_Buffer <= '0' after DLY;
177
178            end if;
179
180        end if;
181
182    end process;
183
184
185    -- Assert hard error reset when there is a hard error.  This assignment
186    -- just renames the two fanout branches of the hard error signal.
187
188    HARD_ERROR_RESET_Buffer <= hard_error_flop_r;
189
190
191    -- Leaky Bucket --
192
193    -- Good cycle counter: it takes 2 consecutive good cycles to remove a demerit from
194    -- the leaky bucket
195
196    process (USER_CLK)
197
198        variable err_vec : std_logic_vector(3 downto 0);
199
200    begin
201
202        if (USER_CLK 'event and USER_CLK = '1') then
203
204            if (ENABLE_ERROR_DETECT = '0') then
205
206                good_count_r <= "01" after DLY;
207
208            else
209
210                err_vec := soft_error_r & good_count_r;
211
212                case err_vec is
213
214                    when "0000" => good_count_r <= "01" after DLY;
215                    when "0001" => good_count_r <= "10" after DLY;
216                    when "0010" => good_count_r <= "01" after DLY;
217                    when "0011" => good_count_r <= "01" after DLY;
218                    when others => good_count_r <= "00" after DLY;
219
220                end case;
221
222            end if;
223
224        end if;
225
226    end process;
227
228
229    -- Perform the leaky bucket algorithm using an up/down counter.  A drop is
230    -- added to the bucket whenever a soft error occurs and is allowed to leak
231    -- out whenever the good cycles counter reaches 2.  Once the bucket fills
232    -- (3 drops) it stays full until it is reset by disabling and then enabling
233    -- the error detection circuit.
234
235    process (USER_CLK)
236
237        variable leaky_bucket : std_logic_vector(4 downto 0);
238
239    begin
240
241        if (USER_CLK 'event and USER_CLK = '1') then
242
243            if (ENABLE_ERROR_DETECT = '0') then
244
245                count_r <= "00" after DLY;
246
247            else
248
249                leaky_bucket := soft_error_r & good_count_r(0) & count_r;
250
251                case leaky_bucket is
252
253                    when "00000" => count_r <= count_r after DLY;
254                    when "00001" => count_r <= count_r after DLY;
255                    when "00010" => count_r <= count_r after DLY;
256                    when "00011" => count_r <= count_r after DLY;
257
258                    when "00100" => count_r <= "00" after DLY;
259                    when "00101" => count_r <= "00" after DLY;
260                    when "00110" => count_r <= "01" after DLY;
261                    when "00111" => count_r <= "11" after DLY;
262
263                    when "01000" => count_r <= "01" after DLY;
264                    when "01001" => count_r <= "10" after DLY;
265                    when "01010" => count_r <= "11" after DLY;
266                    when "01011" => count_r <= "11" after DLY;
267
268                    when "01100" => count_r <= "01" after DLY;
269                    when "01101" => count_r <= "10" after DLY;
270                    when "01110" => count_r <= "11" after DLY;
271                    when "01111" => count_r <= "11" after DLY;
272
273                    when "10000" => count_r <= "01" after DLY;
274                    when "10001" => count_r <= "10" after DLY;
275                    when "10010" => count_r <= "11" after DLY;
276                    when "10011" => count_r <= "11" after DLY;
277
278                    when "10100" => count_r <= "01" after DLY;
279                    when "10101" => count_r <= "10" after DLY;
280                    when "10110" => count_r <= "11" after DLY;
281                    when "10111" => count_r <= "11" after DLY;
282
283                    when "11000" => count_r <= "10" after DLY;
284                    when "11001" => count_r <= "11" after DLY;
285                    when "11010" => count_r <= "11" after DLY;
286                    when "11011" => count_r <= "11" after DLY;
287
288                    when "11100" => count_r <= "10" after DLY;
289                    when "11101" => count_r <= "11" after DLY;
290                    when "11110" => count_r <= "11" after DLY;
291                    when "11111" => count_r <= "11" after DLY;
292
293                    when others  => count_r <= "XX" after DLY;
294
295                end case;
296
297            end if;
298
299        end if;
300
301    end process;
302
303
304    -- Detect when the bucket is full and register the signal.
305
306    process (USER_CLK)
307
308    begin
309
310        if (USER_CLK 'event and USER_CLK = '1') then
311
312            bucket_full_r <= std_bool(count_r = "11") after DLY;
313
314        end if;
315
316    end process;
317
318end RTL;
Note: See TracBrowser for help on using the repository browser.