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

Last change on this file was 408, checked in by haijiang, 18 years ago
File size: 8.3 KB
Line 
1--
2--      Project:  Aurora Module Generator version 2.4
3--
4--         Date:  $Date: 2005/11/07 21:30:56 $
5--          Tag:  $Name: i+IP+98818 $
6--         File:  $RCSfile: tx_ll_datapath_vhd.ejava,v $
7--          Rev:  $Revision: 1.1.2.4 $
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--  TX_LL_DATAPATH
36--
37--  Author: Nigel Gulstone
38--          Xilinx - Embedded Networking System Engineering Group
39--
40--  Description: This module pipelines the data path while handling the PAD
41--               character placement and valid data flags.
42--
43--               This module supports 1 2-byte lane designs
44--
45
46library IEEE;
47use IEEE.STD_LOGIC_1164.all;
48
49entity TX_LL_DATAPATH is
50
51    port (
52
53    -- LocalLink PDU Interface
54
55            TX_D         : in std_logic_vector(0 to 15);
56            TX_REM       : in std_logic;
57            TX_SRC_RDY_N : in std_logic;
58            TX_SOF_N     : in std_logic;
59            TX_EOF_N     : in std_logic;
60
61    -- Aurora Lane Interface
62
63            TX_PE_DATA_V : out std_logic;
64            GEN_PAD      : out std_logic;
65            TX_PE_DATA   : out std_logic_vector(0 to 15);
66
67    -- TX_LL Control Module Interface
68
69            HALT_C       : in std_logic;
70            TX_DST_RDY_N : in std_logic;
71
72    -- System Interface
73
74            CHANNEL_UP   : in std_logic;
75            USER_CLK     : in std_logic
76
77         );
78
79end TX_LL_DATAPATH;
80
81architecture RTL of TX_LL_DATAPATH is
82
83-- Parameter Declarations --
84
85    constant DLY : time := 1 ns;
86
87-- External Register Declarations --
88
89    signal TX_PE_DATA_V_Buffer : std_logic;
90    signal GEN_PAD_Buffer      : std_logic;
91    signal TX_PE_DATA_Buffer   : std_logic_vector(0 to 15);
92
93-- Internal Register Declarations --
94
95    signal in_frame_r              : std_logic;
96    signal storage_r               : std_logic_vector(0 to 15);
97    signal storage_v_r             : std_logic;
98    signal storage_pad_r           : std_logic;
99    signal tx_pe_data_r            : std_logic_vector(0 to 15);
100    signal valid_c                 : std_logic;
101    signal tx_pe_data_v_r          : std_logic;
102    signal gen_pad_c               : std_logic;
103    signal gen_pad_r               : std_logic;
104
105-- Internal Wire Declarations --
106   
107    signal ll_valid_c              : std_logic;
108    signal in_frame_c              : std_logic;
109
110begin
111
112    TX_PE_DATA_V <= TX_PE_DATA_V_Buffer;
113    GEN_PAD      <= GEN_PAD_Buffer;
114    TX_PE_DATA   <= TX_PE_DATA_Buffer;
115
116-- Main Body of Code --
117
118
119
120    -- LocalLink input is only valid when TX_SRC_RDY_N and TX_DST_RDY_N are both asserted
121    ll_valid_c    <=   not TX_SRC_RDY_N and not TX_DST_RDY_N;
122
123
124    -- Data must only be read if it is within a frame. If a frame will last multiple cycles
125    -- we assert in_frame_r as long as the frame is open.
126    process(USER_CLK)
127    begin
128        if(USER_CLK'event and USER_CLK = '1') then
129            if(CHANNEL_UP = '0') then
130                in_frame_r  <=  '0' after DLY;
131            elsif(ll_valid_c = '1') then
132                if( (TX_SOF_N = '0') and (TX_EOF_N = '1') ) then
133                    in_frame_r  <=  '1' after DLY;
134                elsif( TX_EOF_N = '0') then
135                    in_frame_r  <=  '0' after DLY;
136                end if;
137            end if;
138        end if;
139    end process;
140   
141       
142    in_frame_c   <=   ll_valid_c and (in_frame_r  or not TX_SOF_N);
143
144
145
146
147
148    -- The data from the LocalLink interface must be delayed one cycle to
149    -- make room for the SCP code group in the channel.
150
151    process (USER_CLK)
152
153    begin
154
155        if (USER_CLK 'event and USER_CLK = '1') then
156
157            if (HALT_C = '0') then
158
159                storage_r <= TX_D after DLY;
160
161            end if;
162
163        end if;
164
165    end process;
166
167
168    -- This pipeline register aligns the data with the control path.
169
170    process (USER_CLK)
171
172    begin
173
174        if (USER_CLK 'event and USER_CLK = '1') then
175
176            if (HALT_C = '0') then
177
178                tx_pe_data_r <= storage_r after DLY;
179
180            end if;
181
182        end if;
183
184    end process;
185
186
187    -- We generate the valid_c signal based on the REM signal and the EOF signal.
188
189    process (TX_EOF_N, TX_REM)
190
191    begin
192
193        if (TX_EOF_N = '1') then
194
195            valid_c <= '1';
196
197        else
198
199            case TX_REM is
200
201                when '0' => valid_c <= '1';
202                when '1' => valid_c <= '1';
203                when others => valid_c <= '1';
204
205            end case;
206
207        end if;
208
209    end process;
210
211
212    -- If the word is valid, it is placed in the storage register and storage_v_r is
213    -- asserted to indicate the data is valid.  Note that data is only moved to storage
214    -- if the PDU datapath is not halted, the data is valid and both TX_SRC_RDY_N and
215    -- TX_DST_RDY_N are asserted.
216
217    process (USER_CLK)
218
219    begin
220
221        if (USER_CLK 'event and USER_CLK = '1') then
222
223            if (HALT_C = '0') then
224
225                storage_v_r <= valid_c and in_frame_c after DLY;
226
227            end if;
228
229        end if;
230
231    end process;
232
233
234    -- Register the tx_pe_data_valid signal.  All data is moved from the storage register
235    -- to the tx_pe_data register for transmission when the datapath is not halted.  If the
236    -- storage register contains valid PDU data, the tx_pe_data register is marked as
237    -- containing valid PDU data
238
239    process (USER_CLK)
240
241    begin
242
243        if (USER_CLK 'event and USER_CLK = '1') then
244
245            if (HALT_C = '0') then
246
247                tx_pe_data_v_r <= storage_v_r after DLY;
248
249            end if;
250
251        end if;
252
253    end process;
254
255
256    -- We generate the gen_pad_c signal based on the REM signal and the EOF signal.
257
258    process (TX_EOF_N, TX_REM)
259
260    begin
261
262        if (TX_EOF_N = '1') then
263
264            gen_pad_c <= '0';
265
266        else
267
268            case TX_REM is
269
270                when '0' => gen_pad_c <= '1';
271                when '1' => gen_pad_c <= '0';
272                when others => gen_pad_c <= '0';
273
274            end case;
275
276        end if;
277
278    end process;
279
280
281    -- Store padded data when padded and TX_SRC_RDY_N and TX_DST_RDY_N are both asserted.
282
283    process (USER_CLK)
284
285    begin
286
287        if (USER_CLK 'event and USER_CLK = '1') then
288
289            if (HALT_C = '0') then
290
291                storage_pad_r <= gen_pad_c and in_frame_c after DLY;
292
293            end if;
294
295        end if;
296
297    end process;
298
299
300    -- Register the gen_pad signal.
301
302    process (USER_CLK)
303
304    begin
305
306        if (USER_CLK 'event and USER_CLK = '1') then
307
308            if (HALT_C = '0') then
309
310                gen_pad_r <= storage_pad_r after DLY;
311
312            end if;
313
314        end if;
315
316    end process;
317
318
319    -- Implement the data out register.
320
321    process (USER_CLK)
322
323    begin
324
325        if (USER_CLK 'event and USER_CLK = '1') then
326
327            TX_PE_DATA_Buffer   <= tx_pe_data_r after DLY;
328            TX_PE_DATA_V_Buffer <= tx_pe_data_v_r and not HALT_C after DLY;
329            GEN_PAD_Buffer      <= gen_pad_r and not HALT_C after DLY;
330
331        end if;
332
333    end process;
334
335
336end RTL;
Note: See TracBrowser for help on using the repository browser.