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

Subversion Repositories udp_ip_stack

[/] [udp_ip_stack/] [trunk/] [contrib/] [from_tim/] [udp_ip_stack/] [tags/] [v1.2/] [rtl/] [vhdl/] [ml605/] [IP_complete.vhd] - Blame information for rev 35

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 pjf
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:            Peter Fall
4
-- 
5
-- Create Date:    20:25:56 06/03/2011 
6
-- Design Name: 
7
-- Module Name:    IP_complete - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: Implements complete IP stack with ARP and MAC
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
LIBRARY ieee;
21
USE ieee.std_logic_1164.ALL;
22
use IEEE.NUMERIC_STD.ALL;
23
use work.axi.all;
24
use work.ipv4_types.all;
25
use work.arp_types.all;
26
 
27
entity IP_complete is
28
    Port (
29
                        -- IP Layer signals
30
                        ip_tx_start                             : in std_logic;
31
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
32
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
33
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
34
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
35
                        ip_rx                                           : out ipv4_rx_type;
36
                        -- system signals
37
                        clk_in_p             : in  std_logic;                                           -- 200MHz clock input from board
38
                        clk_in_n             : in  std_logic;
39
                        clk_out                                 : out std_logic;
40
                        reset                                   : in  STD_LOGIC;
41
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
42
                        our_mac_address                 : in std_logic_vector (47 downto 0);
43
                        -- status signals
44
                        arp_pkt_count                   : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
45
                        ip_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
46
                        -- GMII Interface
47
                        phy_resetn           : out std_logic;
48
                        gmii_txd             : out std_logic_vector(7 downto 0);
49
                        gmii_tx_en           : out std_logic;
50
                        gmii_tx_er           : out std_logic;
51
                        gmii_tx_clk          : out std_logic;
52
                        gmii_rxd             : in  std_logic_vector(7 downto 0);
53
                        gmii_rx_dv           : in  std_logic;
54
                        gmii_rx_er           : in  std_logic;
55
                        gmii_rx_clk          : in  std_logic;
56
                        gmii_col             : in  std_logic;
57
                        gmii_crs             : in  std_logic;
58
                        mii_tx_clk           : in  std_logic
59
                        );
60
end IP_complete;
61
 
62
architecture structural of IP_complete is
63
 
64
  ------------------------------------------------------------------------------
65
  -- Component Declaration for the IP layer
66
  ------------------------------------------------------------------------------
67
 
68
    COMPONENT IP_complete_nomac
69
    PORT(
70
                        -- IP Layer signals
71
                        ip_tx_start                             : in std_logic;
72
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
73
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
74
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
75
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
76
                        ip_rx                                           : out ipv4_rx_type;
77
                        -- system signals
78
                        rx_clk                                  : in  STD_LOGIC;
79
                        tx_clk                                  : in  STD_LOGIC;
80
                        reset                                   : in  STD_LOGIC;
81
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
82
                        our_mac_address                 : in std_logic_vector (47 downto 0);
83
                        -- status signals
84
                        arp_pkt_count                   : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
85
                        ip_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
86
                        -- MAC Transmitter
87
                        mac_tx_tdata         : out  std_logic_vector(7 downto 0);        -- data byte to tx
88
                        mac_tx_tvalid        : out  std_logic;                                                  -- tdata is valid
89
                        mac_tx_tready        : in std_logic;                                                    -- mac is ready to accept data
90
                        mac_tx_tfirst        : out  std_logic;                                                  -- indicates first byte of frame
91
                        mac_tx_tlast         : out  std_logic;                                                  -- indicates last byte of frame
92
                        -- MAC Receiver
93
                        mac_rx_tdata         : in std_logic_vector(7 downto 0);  -- data byte received
94
                        mac_rx_tvalid        : in std_logic;                                                    -- indicates tdata is valid
95
                        mac_rx_tready        : out  std_logic;                                                  -- tells mac that we are ready to take data
96
                        mac_rx_tlast         : in std_logic                                                             -- indicates last byte of the trame
97
        );
98
    END COMPONENT;
99
 
100
 
101
  ------------------------------------------------------------------------------
102
  -- Component Declaration for the MAC layer
103
  ------------------------------------------------------------------------------
104
component mac_layer
105
         port (
106
                        -- System controls
107
                        ------------------
108
                        glbl_rst                      : in  std_logic;                                  -- asynchronous reset
109
                        mac_reset                       : in  std_logic;                                                        -- reset mac layer
110
                        clk_in_p                                : in  std_logic;                                        -- 200MHz clock input from board
111
                        clk_in_n                                : in  std_logic;
112
 
113
                        -- MAC Transmitter (AXI-S) Interface
114
                        ---------------------------------------------
115
                        mac_tx_clock                            : out  std_logic;                                                       -- data sampled on rising edge
116
                        mac_tx_tdata                            : in  std_logic_vector(7 downto 0);      -- data byte to tx
117
                        mac_tx_tvalid                           : in  std_logic;                                                        -- tdata is valid
118
                        mac_tx_tready                           : out std_logic;                                                        -- mac is ready to accept data
119
                        mac_tx_tlast                            : in  std_logic;                                                        -- indicates last byte of frame
120
 
121
                        -- MAC Receiver (AXI-S) Interface
122
                        ------------------------------------------
123
                        mac_rx_clock                            : out  std_logic;                                                       -- data valid on rising edge
124
                        mac_rx_tdata                            : out std_logic_vector(7 downto 0);      -- data byte received
125
                        mac_rx_tvalid                           : out std_logic;                                                        -- indicates tdata is valid
126
                        mac_rx_tready                           : in  std_logic;                                                        -- tells mac that we are ready to take data
127
                        mac_rx_tlast                            : out std_logic;                                                        -- indicates last byte of the trame
128
 
129
                        -- GMII Interface
130
                        -----------------     
131
                        phy_resetn                              : out std_logic;
132
                        gmii_txd                      : out std_logic_vector(7 downto 0);
133
                        gmii_tx_en                    : out std_logic;
134
                        gmii_tx_er                    : out std_logic;
135
                        gmii_tx_clk                   : out std_logic;
136
                        gmii_rxd                      : in  std_logic_vector(7 downto 0);
137
                        gmii_rx_dv                    : in  std_logic;
138
                        gmii_rx_er                    : in  std_logic;
139
                        gmii_rx_clk                   : in  std_logic;
140
                        gmii_col                      : in  std_logic;
141
                        gmii_crs                      : in  std_logic;
142
                        mii_tx_clk                    : in  std_logic
143
         );
144
end component;
145
 
146
        ---------------------------
147
        -- Signals
148
        ---------------------------
149
 
150
        -- MAC RX bus
151
        signal mac_rx_clock                     : std_logic;
152
        signal mac_rx_tdata                     : std_logic_vector (7 downto 0);
153
        signal mac_rx_tvalid                    : std_logic;
154
        signal mac_rx_tready                    : std_logic;
155
        signal mac_rx_tlast                     : std_logic;
156
        -- MAC TX bus
157
        signal mac_tx_clock                     : std_logic;
158
        signal mac_tx_tdata                     : std_logic_vector (7 downto 0);
159
        signal mac_tx_tvalid                    : std_logic;
160
        signal mac_tx_tready                    : std_logic;
161
        signal mac_tx_tlast                     : std_logic;
162
        -- control signals
163
        signal mac_tx_tready_int        : std_logic;
164
        signal mac_tx_granted_int       : std_logic;
165
 
166
begin
167
 
168
        clk_out <= mac_rx_clock;
169
 
170
   ------------------------------------------------------------------------------
171
   -- Instantiate the IP layer
172
   ------------------------------------------------------------------------------
173
 
174
    IP_layer : IP_complete_nomac PORT MAP
175
                (
176
                         -- IP Layer signals
177
          ip_tx_start                   => ip_tx_start,
178
          ip_tx                                         => ip_tx,
179
          ip_tx_result                  => ip_tx_result,
180
          ip_tx_data_out_ready => ip_tx_data_out_ready,
181
          ip_rx_start                   => ip_rx_start,
182
          ip_rx                                         => ip_rx,
183
                         -- system signals
184
          rx_clk                                        => mac_rx_clock,
185
          tx_clk                                        => mac_rx_clock,
186
          reset                                         => reset,
187
          our_ip_address                => our_ip_address,
188
          our_mac_address               => our_mac_address,
189
                         -- status signals
190
          arp_pkt_count                 => arp_pkt_count,
191
                         ip_pkt_count                   => ip_pkt_count,
192
                         -- MAC Transmitter
193
          mac_tx_tready                 => mac_tx_tready_int,
194
          mac_tx_tvalid                 => mac_tx_tvalid,
195
                         mac_tx_tfirst                  => open,
196
          mac_tx_tlast                  => mac_tx_tlast,
197
          mac_tx_tdata                  => mac_tx_tdata,
198
                    -- MAC Receiver
199
          mac_rx_tdata                  => mac_rx_tdata,
200
          mac_rx_tvalid                 => mac_rx_tvalid,
201
                         mac_rx_tready                  => mac_rx_tready,
202
          mac_rx_tlast                  => mac_rx_tlast
203
        );
204
 
205
 
206
   ------------------------------------------------------------------------------
207
   -- Instantiate the MAC layer
208
   ------------------------------------------------------------------------------
209
        mac_block : mac_layer
210
                 Port map(
211
                                -- System controls
212
                                ------------------
213
                                glbl_rst                                => reset,
214
                                mac_reset         => '0',
215
                                clk_in_p          => clk_in_p,
216
                                clk_in_n          => clk_in_n,
217
 
218
                                -- MAC Transmitter (AXI-S) Interface
219
                                ---------------------------------------------
220
                                mac_tx_clock      => mac_tx_clock,
221
                                mac_tx_tdata      => mac_tx_tdata,
222
                                mac_tx_tvalid     => mac_tx_tvalid,
223
                                mac_tx_tready     => mac_tx_tready_int,
224
                                mac_tx_tlast      => mac_tx_tlast,
225
 
226
                                -- MAC Receiver (AXI-S) Interface
227
                                ------------------------------------------
228
                                mac_rx_clock      => mac_rx_clock,
229
                                mac_rx_tdata      => mac_rx_tdata,
230
                                mac_rx_tvalid     => mac_rx_tvalid,
231
                                mac_rx_tready     => mac_rx_tready,
232
                                mac_rx_tlast      => mac_rx_tlast,
233
 
234
                                -- GMII Interface
235
                                -----------------     
236
                                phy_resetn        => phy_resetn,
237
                                gmii_txd                => gmii_txd,
238
                                gmii_tx_en        => gmii_tx_en,
239
                                gmii_tx_er        => gmii_tx_er,
240
                                gmii_tx_clk       => gmii_tx_clk,
241
                                gmii_rxd                => gmii_rxd,
242
                                gmii_rx_dv        => gmii_rx_dv,
243
                                gmii_rx_er        => gmii_rx_er,
244
                                gmii_rx_clk       => gmii_rx_clk,
245
                                gmii_col        => gmii_col,
246
                                gmii_crs                => gmii_crs,
247
                                mii_tx_clk        => mii_tx_clk
248
                          );
249
 
250
end structural;
251
 

powered by: WebSVN 2.1.0

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