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

Last change on this file was 408, checked in by haijiang, 18 years ago
File size: 6.9 KB
Line 
1--
2--      Project:  Aurora Module Generator version 2.4
3--
4--         Date:  $Date: 2005/11/07 21:30:54 $
5--          Tag:  $Name: i+IP+98818 $
6--         File:  $RCSfile: rx_ll_nfc_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--  RX_LL_NFC
36--
37--  Author: Nigel Gulstone
38--          Xilinx - Embedded Networking System Engineering Group
39--
40--  VHDL Translation: B. Woodard, N. Gulstone
41--
42--  Description: the RX_LL_NFC module detects, decodes and executes NFC messages
43--               from the channel partner. When a message is recieved, the module
44--               signals the TX_LL module that idles are required until the number
45--               of idles the TX_LL module sends are enough to fulfil the request.
46--
47--               This module supports 1 2-byte lane designs
48--
49
50library IEEE;
51use IEEE.STD_LOGIC_1164.all;
52use IEEE.STD_LOGIC_ARITH.all;
53use IEEE.STD_LOGIC_UNSIGNED.all;
54use WORK.AURORA.all;
55
56entity RX_LL_NFC is
57
58    port (
59
60    -- Aurora Lane Interface
61
62            RX_SNF        : in  std_logic;
63            RX_FC_NB      : in  std_logic_vector(0 to 3);
64
65    -- TX_LL Interface
66
67            DECREMENT_NFC : in  std_logic;
68            TX_WAIT       : out std_logic;
69
70    -- Global Logic Interface
71
72            CHANNEL_UP    : in  std_logic;
73
74    -- USER Interface
75
76            USER_CLK      : in  std_logic
77
78         );
79
80end RX_LL_NFC;
81
82architecture RTL of RX_LL_NFC is
83
84-- Parameter Declarations --
85
86    constant DLY : time := 1 ns;
87
88-- External Register Declarations --
89
90    signal TX_WAIT_Buffer : std_logic;
91
92-- Internal Register Declarations --
93
94    signal load_nfc_r           : std_logic;
95    signal fcnb_r               : std_logic_vector(0 to 3);
96    signal nfc_counter_r        : std_logic_vector(0 to 8);
97    signal xoff_r               : std_logic;
98    signal fcnb_decode_c        : std_logic_vector(0 to 8);
99
100begin
101
102    TX_WAIT <= TX_WAIT_Buffer;
103
104-- Main Body of Code --
105
106   
107    -- ____________________Stage 1: Detect the most recent NFC message___________
108
109    -- Generate the load NFC signal if an NFC signal is detected.
110
111    process(USER_CLK)
112    begin
113        if (USER_CLK 'event and USER_CLK = '1') then
114            load_nfc_r <= RX_SNF after DLY;
115        end if;
116    end process;
117
118
119    -- Register the FC_NB signal.
120    process(USER_CLK)
121    begin
122        if (USER_CLK 'event and USER_CLK = '1') then
123            fcnb_r <= RX_FC_NB after DLY;
124        end if;
125    end process;
126
127
128    -- _________________Stage 2: Use the FCNB code to set the counter ______________
129
130    -- We use a counter to keep track of the number of dead cycles we must produce to
131    -- satisfy the NFC request from the Channel Partner.  Note we *increment* nfc_counter
132    -- when decrement NFC is asserted.  This is because the nfc counter uses the difference
133    -- between the max value and the current value to determine how many cycles to demand
134    -- a pause.  This allows us to use the carry chain more effectively to save LUTS, and
135    -- gives us a registered output from the counter.
136
137    process (USER_CLK)
138    begin
139        if (USER_CLK 'event and USER_CLK = '1') then
140            if (CHANNEL_UP = '0') then
141                nfc_counter_r <= "100000000" after DLY;
142            else
143                if (load_nfc_r = '1') then
144                    nfc_counter_r <= fcnb_decode_c after DLY;
145                else
146                    if ((not nfc_counter_r(0) and DECREMENT_NFC and not xoff_r) = '1') then
147                        nfc_counter_r <= nfc_counter_r + "000000001";
148                    end if;
149                end if;
150            end if;
151        end if;
152    end process;
153
154
155    -- We load the counter with a decoded version of the FCNB code.  The decode values are
156    -- chosen such that the counter will assert TX_WAIT for the number of cycles required
157    -- by the FCNB code.
158
159    process (fcnb_r)
160    begin
161        case fcnb_r is
162            when "0000" =>
163                fcnb_decode_c <= "100000000"; -- XON
164            when "0001" =>
165                fcnb_decode_c <= "011111110"; -- 2
166            when "0010" =>
167                fcnb_decode_c <= "011111100"; -- 4
168            when "0011" =>
169                fcnb_decode_c <= "011111000"; -- 8
170            when "0100" =>
171                fcnb_decode_c <= "011110000"; -- 16
172            when "0101" =>
173                fcnb_decode_c <= "011100000"; -- 32
174            when "0110" =>
175                fcnb_decode_c <= "011000000"; -- 64
176            when "0111" =>
177                fcnb_decode_c <= "010000000"; -- 128
178            when "1000" =>
179                fcnb_decode_c <= "000000000"; -- 256
180            when "1111" =>
181                fcnb_decode_c <= "000000000"; -- 8
182            when others =>
183                fcnb_decode_c <= "100000000"; -- 8
184        end case;
185    end process;
186
187
188    -- The XOFF signal forces an indefinite wait.  We decode FCNB to determine whether
189    -- XOFF should be asserted.
190
191    process (USER_CLK)
192    begin
193        if (USER_CLK 'event and USER_CLK = '1') then
194            if (CHANNEL_UP = '0') then
195                xoff_r <= '0' after DLY;
196            else
197                if (load_nfc_r = '1') then
198                    if (fcnb_r = "1111") then
199                        xoff_r <= '1' after DLY;
200                    else
201                        xoff_r <= '0' after DLY;
202                    end if;
203                end if;
204            end if;
205        end if;
206    end process;
207
208
209    -- The TXWAIT signal comes from the MSBit of the counter.  We wait whenever the counter
210    -- is not at max value.
211
212    TX_WAIT_Buffer <= not nfc_counter_r(0);
213
214end RTL;
Note: See TracBrowser for help on using the repository browser.