OpenCores
URL https://opencores.org/ocsvn/core1990_interlaken/core1990_interlaken/trunk

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [sources/] [interlaken/] [transceiver/] [transceiver_10g_64b67b_block_sync_sm.vhd] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 N.Boukadid
-------------------------------------------------------------------------------
2
--   ____  ____
3
--  /   /\/   /
4
-- /___/  \  /    Vendor: Xilinx
5
-- \   \   \/     Version : 3.6
6
--  \   \         Application : 7 Series FPGAs Transceivers Wizard
7
--  /   /         Filename : transceiver_10g_64b67b_block_sync_sm.vhd
8
-- /___/   /\     
9
-- \   \  /  \ 
10
--  \___\/\___\
11
--
12
--
13
-- Module BLOCK_SYNC_SM
14
-- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
15
-- 
16
-- 
17
-- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
18
-- 
19
-- This file contains confidential and proprietary information
20
-- of Xilinx, Inc. and is protected under U.S. and
21
-- international copyright and other intellectual property
22
-- laws.
23
-- 
24
-- DISCLAIMER
25
-- This disclaimer is not a license and does not grant any
26
-- rights to the materials distributed herewith. Except as
27
-- otherwise provided in a valid license issued to you by
28
-- Xilinx, and to the maximum extent permitted by applicable
29
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
30
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
31
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
32
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
33
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
34
-- (2) Xilinx shall not be liable (whether in contract or tort,
35
-- including negligence, or under any other theory of
36
-- liability) for any loss or damage of any kind or nature
37
-- related to, arising under or in connection with these
38
-- materials, including for any direct, or any indirect,
39
-- special, incidental, or consequential loss or damage
40
-- (including loss of data, profits, goodwill, or any type of
41
-- loss or damage suffered as a result of any action brought
42
-- by a third party) even if such damage or loss was
43
-- reasonably foreseeable or Xilinx had been advised of the
44
-- possibility of the same.
45
-- 
46
-- CRITICAL APPLICATIONS
47
-- Xilinx products are not designed or intended to be fail-
48
-- safe, or for use in any application requiring fail-safe
49
-- performance, such as life-support or safety devices or
50
-- systems, Class III medical devices, nuclear facilities,
51
-- applications related to the deployment of airbags, or any
52
-- other applications that could lead to death, personal
53
-- injury, or severe property or environmental damage
54
-- (individually and collectively, "Critical
55
-- Applications"). Customer assumes the sole risk and
56
-- liability of any use of Xilinx products in Critical
57
-- Applications, subject only to applicable laws and
58
-- regulations governing limitations on product liability.
59
-- 
60
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
61
-- PART OF THIS FILE AT ALL TIMES. 
62
 
63
 
64
library ieee;
65
use ieee.std_logic_1164.all;
66
use ieee.numeric_std.all;
67
library UNISIM;
68
use UNISIM.VCOMPONENTS.ALL;
69
 
70
entity Transceiver_10g_64b67b_BLOCK_SYNC_SM is
71
generic
72
(
73
    SH_CNT_MAX         :  integer  := 64;
74
    SH_INVALID_CNT_MAX :  integer  := 16
75
);
76
port
77
(
78
   -- User Interface
79
BLOCKSYNC_OUT      : out   std_logic;
80
RXGEARBOXSLIP_OUT  : out   std_logic;
81
RXHEADER_IN        : in    std_logic_vector(2 downto 0);
82
RXHEADERVALID_IN   : in    std_logic;
83
 
84
    -- System Interface
85
USER_CLK           : in    std_logic;
86
SYSTEM_RESET       : in    std_logic
87
);
88
 
89
 
90
end Transceiver_10g_64b67b_BLOCK_SYNC_SM;
91
 
92
architecture RTL of Transceiver_10g_64b67b_BLOCK_SYNC_SM is
93
 
94
--***********************************Parameter Declarations********************
95
 
96
    constant DLY : time := 1 ns;
97
 
98
--********************************* Wire Declarations************************** 
99
 
100
signal  next_begin_c                  :   std_logic;
101
signal  next_sh_invalid_c             :   std_logic;
102
signal  next_sh_valid_c               :   std_logic;
103
signal  next_slip_c                   :   std_logic;
104
signal  next_sync_done_c              :   std_logic;
105
signal  next_test_sh_c                :   std_logic;
106
signal  sh_count_equals_max_i         :   std_logic;
107
signal  sh_invalid_cnt_equals_max_i   :   std_logic;
108
signal  sh_invalid_cnt_equals_zero_i  :   std_logic;
109
signal  slip_done_i                   :   std_logic;
110
signal  slip_pulse_i                  :   std_logic;
111
signal  sync_found_i                  :   std_logic;
112
 
113
---***************************Internal Register Declarations*************************** 
114
 
115
signal  begin_r                       :   std_logic;
116
signal  blocksync_out_i               :   std_logic;
117
signal  rxgearboxslip_out_i           :   std_logic;
118
signal  sh_invalid_r                  :   std_logic;
119
signal  sh_valid_r                    :   std_logic;
120
signal  slip_count_i                  :   std_logic_vector(31 downto 0);
121
signal  slip_r                        :   std_logic;
122
signal  sync_done_r                   :   std_logic;
123
    signal  sync_header_count_i           :   unsigned(9 downto 0);
124
    signal  sync_header_invalid_count_i   :   unsigned(9 downto 0);
125
signal  test_sh_r                     :   std_logic;
126
 
127
---**************************** Main Body of Code *******************************
128
begin
129
 
130
 
131
    sync_found_i   <=  '1' when ((RXHEADER_IN(1 downto 0) = "01") or (RXHEADER_IN(1 downto 0) = "10")) else '0';
132
 
133
    ---________________________________ State machine __________________________    
134
 
135
    --- State registers
136
    process( USER_CLK )
137
    begin
138
        if(USER_CLK'event and USER_CLK = '1') then
139
            if(SYSTEM_RESET = '1') then
140
                begin_r      <=  '1' after DLY;
141
                test_sh_r    <=  '0' after DLY;
142
                sh_valid_r   <=  '0' after DLY;
143
                sh_invalid_r <=  '0' after DLY;
144
                slip_r       <=  '0' after DLY;
145
                sync_done_r  <=  '0' after DLY;
146
            else
147
                begin_r      <=  next_begin_c after DLY;
148
                test_sh_r    <=  next_test_sh_c after DLY;
149
                sh_valid_r   <=  next_sh_valid_c after DLY;
150
                sh_invalid_r <=  next_sh_invalid_c after DLY;
151
                slip_r       <=  next_slip_c after DLY;
152
                sync_done_r  <=  next_sync_done_c after DLY;
153
            end if;
154
        end if;
155
    end process;
156
 
157
    --- Next state logic
158
    next_begin_c      <=    sync_done_r
159
                            or (slip_r and slip_done_i)
160
                            or (sh_valid_r and sh_count_equals_max_i and not sh_invalid_cnt_equals_max_i)
161
                            or (sh_invalid_r and sh_count_equals_max_i and not sh_invalid_cnt_equals_max_i and blocksync_out_i);
162
 
163
    next_test_sh_c    <=   begin_r
164
                           or (test_sh_r and not RXHEADERVALID_IN)
165
                           or (sh_valid_r and not sh_count_equals_max_i)
166
                           or (sh_invalid_r and not sh_count_equals_max_i and not sh_invalid_cnt_equals_max_i and blocksync_out_i);
167
 
168
 
169
    next_sh_valid_c   <=   (test_sh_r and RXHEADERVALID_IN and sync_found_i);
170
 
171
    next_sh_invalid_c <=   (test_sh_r and RXHEADERVALID_IN and not sync_found_i);
172
 
173
    next_slip_c       <=   (sh_invalid_r and (sh_invalid_cnt_equals_max_i or not blocksync_out_i))
174
                           or (sh_valid_r and sh_count_equals_max_i and not sh_invalid_cnt_equals_zero_i and (sh_invalid_cnt_equals_max_i or not blocksync_out_i))
175
                           or (slip_r and not slip_done_i);
176
 
177
    next_sync_done_c  <=   (sh_valid_r and sh_count_equals_max_i and sh_invalid_cnt_equals_zero_i);
178
 
179
    ---________________ Counter keep track of sync headers counted _____________    
180
 
181
    process( USER_CLK )
182
    begin
183
        if(USER_CLK'event and USER_CLK = '1') then
184
            if(begin_r = '1') then
185
                sync_header_count_i   <=    (others => '0') after DLY;
186
            elsif ((sh_valid_r= '1') or (sh_invalid_r = '1')) then
187
                sync_header_count_i  <=   sync_header_count_i + 1 after DLY;
188
            end if;
189
        end if;
190
    end process;
191
 
192
    sh_count_equals_max_i <= '1' when (sync_header_count_i=SH_CNT_MAX) else '0';
193
 
194
    ---________________ Counter keep track of invalid sync headers  ____________    
195
 
196
    process( USER_CLK )
197
    begin
198
        if(USER_CLK'event and USER_CLK = '1') then
199
            if(begin_r = '1') then
200
               sync_header_invalid_count_i   <=  (others => '0') after DLY;
201
            elsif (sh_invalid_r = '1') then
202
                sync_header_invalid_count_i  <=   sync_header_invalid_count_i + 1 after DLY;
203
            end if;
204
        end if;
205
    end process;
206
 
207
    --- signal to indicate max number of invalid sync headers has been reached
208
    sh_invalid_cnt_equals_max_i  <= '1'  when (sync_header_invalid_count_i=SH_INVALID_CNT_MAX)
209
                                     else '0';
210
 
211
    --- signal to indicate no invalid sync headers
212
    sh_invalid_cnt_equals_zero_i <= '1' when (sync_header_invalid_count_i=0) else '0';
213
 
214
    ---_______ Counter wait for 16 cycles to ensure that slip is complete _______    
215
 
216
    slip_pulse_i <= next_slip_c and not slip_r;
217
 
218
    process( USER_CLK )
219
    begin
220
        if(USER_CLK'event and USER_CLK = '1') then
221
            rxgearboxslip_out_i   <=  slip_pulse_i after DLY;
222
        end if;
223
    end process;
224
 
225
    ---_____________ Ouput assignment to indicate block sync complete  _________    
226
 
227
    process( USER_CLK )
228
    begin
229
        if(USER_CLK'event and USER_CLK = '1') then
230
            if(slip_r = '0') then
231
                slip_count_i   <=  (others => '0') after DLY;
232
            else
233
                slip_count_i   <=  (slip_count_i(30 downto 0) & rxgearboxslip_out_i) after DLY;
234
            end if;
235
        end if;
236
    end process;
237
 
238
    slip_done_i <= slip_count_i(31);
239
 
240
 
241
    ---_____________ Pulse GEARBOXSLIP port to slip the data by 1 bit  _________    
242
 
243
    process( USER_CLK )
244
    begin
245
        if(USER_CLK'event and USER_CLK = '1') then
246
            if((SYSTEM_RESET='1') or (slip_r= '1')) then
247
                blocksync_out_i   <=  '0' after DLY;
248
            elsif (sync_done_r = '1') then
249
                blocksync_out_i   <=  '1' after DLY;
250
            end if;
251
        end if;
252
    end process;
253
 
254
 
255
    --__________________________ Ouput Port Assignment ________________________    
256
 
257
    BLOCKSYNC_OUT   <=   blocksync_out_i;
258
    RXGEARBOXSLIP_OUT   <=   rxgearboxslip_out_i;
259
 
260
end RTL;
261
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.