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

Subversion Repositories udp_ip_stack

[/] [udp_ip_stack/] [trunk/] [rtl/] [vhdl/] [ml605/] [IP_complete.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 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
                        clk                                             : in std_logic;
79
                        reset                                   : in  STD_LOGIC;
80
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
81
                        our_mac_address                 : in std_logic_vector (47 downto 0);
82
                        -- status signals
83
                        arp_pkt_count                   : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
84
                        ip_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
85
                        -- MAC Transmitter
86
                        mac_tx_tdata         : out  std_logic_vector(7 downto 0);        -- data byte to tx
87
                        mac_tx_tvalid        : out  std_logic;                                                  -- tdata is valid
88
                        mac_tx_tready        : in std_logic;                                                    -- mac is ready to accept data
89
                        mac_tx_tlast         : out  std_logic;                                                  -- indicates last byte of frame
90
                        -- MAC Receiver
91
                        mac_rx_tdata         : in std_logic_vector(7 downto 0);  -- data byte received
92
                        mac_rx_tvalid        : in std_logic;                                                    -- indicates tdata is valid
93
                        mac_rx_tready        : out  std_logic;                                                  -- tells mac that we are ready to take data
94
                        mac_rx_tlast         : in std_logic                                                     -- indicates last byte of the trame
95
        );
96
    END COMPONENT;
97
 
98
 
99
  ------------------------------------------------------------------------------
100
  -- Component Declaration for the MAC layer
101
  ------------------------------------------------------------------------------
102
component mac_layer
103
         port (
104
                        -- System controls
105
                        ------------------
106
                        glbl_rst                      : in  std_logic;                                  -- asynchronous reset
107
                        mac_reset                       : in  std_logic;                                                        -- reset mac layer
108
                        clk_in_p                                : in  std_logic;                                        -- 200MHz clock input from board
109
                        clk_in_n                                : in  std_logic;
110
 
111
                        -- MAC Transmitter (AXI-S) Interface
112
                        ---------------------------------------------
113
                        mac_tx_clock                            : out  std_logic;                                                       -- data sampled on rising edge
114
                        mac_tx_tdata                            : in  std_logic_vector(7 downto 0);      -- data byte to tx
115
                        mac_tx_tvalid                           : in  std_logic;                                                        -- tdata is valid
116
                        mac_tx_tready                           : out std_logic;                                                        -- mac is ready to accept data
117
                        mac_tx_tlast                            : in  std_logic;                                                        -- indicates last byte of frame
118
 
119
                        -- MAC Receiver (AXI-S) Interface
120
                        ------------------------------------------
121
                        mac_rx_clock                            : out  std_logic;                                                       -- data valid on rising edge
122
                        mac_rx_tdata                            : out std_logic_vector(7 downto 0);      -- data byte received
123
                        mac_rx_tvalid                           : out std_logic;                                                        -- indicates tdata is valid
124
                        mac_rx_tready                           : in  std_logic;                                                        -- tells mac that we are ready to take data
125
                        mac_rx_tlast                            : out std_logic;                                                        -- indicates last byte of the trame
126
 
127
                        -- GMII Interface
128
                        -----------------     
129
                        phy_resetn                              : out std_logic;
130
                        gmii_txd                      : out std_logic_vector(7 downto 0);
131
                        gmii_tx_en                    : out std_logic;
132
                        gmii_tx_er                    : out std_logic;
133
                        gmii_tx_clk                   : out std_logic;
134
                        gmii_rxd                      : in  std_logic_vector(7 downto 0);
135
                        gmii_rx_dv                    : in  std_logic;
136
                        gmii_rx_er                    : in  std_logic;
137
                        gmii_rx_clk                   : in  std_logic;
138
                        gmii_col                      : in  std_logic;
139
                        gmii_crs                      : in  std_logic;
140
                        mii_tx_clk                    : in  std_logic
141
         );
142
end component;
143
 
144
        ---------------------------
145
        -- Signals
146
        ---------------------------
147
 
148
        -- MAC RX bus
149
        signal mac_rx_clock                     : std_logic;
150
        signal mac_rx_tdata                     : std_logic_vector (7 downto 0);
151
        signal mac_rx_tvalid                    : std_logic;
152
        signal mac_rx_tready                    : std_logic;
153
        signal mac_rx_tlast                     : std_logic;
154
        -- MAC TX bus
155
        signal mac_tx_clock                     : std_logic;
156
        signal mac_tx_tdata                     : std_logic_vector (7 downto 0);
157
        signal mac_tx_tvalid                    : std_logic;
158
        signal mac_tx_tready                    : std_logic;
159
        signal mac_tx_tlast                     : std_logic;
160
        -- control signals
161
        signal mac_tx_tready_int        : std_logic;
162
        signal mac_tx_granted_int       : std_logic;
163
 
164
begin
165
 
166
        clk_out <= mac_rx_clock;
167
 
168
   ------------------------------------------------------------------------------
169
   -- Instantiate the IP layer
170
   ------------------------------------------------------------------------------
171
 
172
    IP_layer : IP_complete_nomac PORT MAP
173
                (
174
                         -- IP Layer signals
175
          ip_tx_start                   => ip_tx_start,
176
          ip_tx                                         => ip_tx,
177
          ip_tx_result                  => ip_tx_result,
178
          ip_tx_data_out_ready => ip_tx_data_out_ready,
179
          ip_rx_start                   => ip_rx_start,
180
          ip_rx                                         => ip_rx,
181
                         -- system signals
182
          clk                                           => mac_rx_clock,
183
          reset                                         => reset,
184
          our_ip_address                => our_ip_address,
185
          our_mac_address               => our_mac_address,
186
                         -- status signals
187
          arp_pkt_count                 => arp_pkt_count,
188
                         ip_pkt_count                   => ip_pkt_count,
189
                         -- MAC Transmitter
190
          mac_tx_tready                 => mac_tx_tready_int,
191
          mac_tx_tvalid                 => mac_tx_tvalid,
192
          mac_tx_tlast                  => mac_tx_tlast,
193
          mac_tx_tdata                  => mac_tx_tdata,
194
                    -- MAC Receiver
195
          mac_rx_tdata                  => mac_rx_tdata,
196
          mac_rx_tvalid                 => mac_rx_tvalid,
197
                         mac_rx_tready                  => mac_rx_tready,
198
          mac_rx_tlast                  => mac_rx_tlast
199
        );
200
 
201
 
202
   ------------------------------------------------------------------------------
203
   -- Instantiate the MAC layer
204
   ------------------------------------------------------------------------------
205
        mac_block : mac_layer
206
                 Port map(
207
                                -- System controls
208
                                ------------------
209
                                glbl_rst                                => reset,
210
                                mac_reset         => '0',
211
                                clk_in_p          => clk_in_p,
212
                                clk_in_n          => clk_in_n,
213
 
214
                                -- MAC Transmitter (AXI-S) Interface
215
                                ---------------------------------------------
216
                                mac_tx_clock      => mac_tx_clock,
217
                                mac_tx_tdata      => mac_tx_tdata,
218
                                mac_tx_tvalid     => mac_tx_tvalid,
219
                                mac_tx_tready     => mac_tx_tready_int,
220
                                mac_tx_tlast      => mac_tx_tlast,
221
 
222
                                -- MAC Receiver (AXI-S) Interface
223
                                ------------------------------------------
224
                                mac_rx_clock      => mac_rx_clock,
225
                                mac_rx_tdata      => mac_rx_tdata,
226
                                mac_rx_tvalid     => mac_rx_tvalid,
227
                                mac_rx_tready     => mac_rx_tready,
228
                                mac_rx_tlast      => mac_rx_tlast,
229
 
230
                                -- GMII Interface
231
                                -----------------     
232
                                phy_resetn        => phy_resetn,
233
                                gmii_txd                => gmii_txd,
234
                                gmii_tx_en        => gmii_tx_en,
235
                                gmii_tx_er        => gmii_tx_er,
236
                                gmii_tx_clk       => gmii_tx_clk,
237
                                gmii_rxd                => gmii_rxd,
238
                                gmii_rx_dv        => gmii_rx_dv,
239
                                gmii_rx_er        => gmii_rx_er,
240
                                gmii_rx_clk       => gmii_rx_clk,
241
                                gmii_col        => gmii_col,
242
                                gmii_crs                => gmii_crs,
243
                                mii_tx_clk        => mii_tx_clk
244
                          );
245
 
246
end structural;
247
 

powered by: WebSVN 2.1.0

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