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

Subversion Repositories udp_ip_stack

[/] [udp_ip_stack/] [trunk/] [rtl/] [vhdl/] [IPv4.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:    16:20:42 06/01/2011 
6
-- Design Name: 
7
-- Module Name:    IPv4 - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--              handle simple IP RX and TX
13
--              doesnt handle seg & reass
14
--              dest MAC addr resolution through ARP layer
15
--              Handle IPv4 protocol
16
--              Respond to ARP requests and replies
17
--              Ignore pkts that are not IP
18
--              Ignore pkts that are not addressed to us--
19
-- Dependencies: 
20
--
21
-- Revision: 
22
-- Revision 0.01 - File Created
23
-- Revision 0.02 - separated RX and TX clocks
24
-- Additional Comments: 
25
--
26
----------------------------------------------------------------------------------
27
LIBRARY ieee;
28
USE ieee.std_logic_1164.ALL;
29
use IEEE.NUMERIC_STD.ALL;
30
use work.axi.all;
31
use work.ipv4_types.all;
32
use work.arp_types.all;
33
 
34
entity IPv4 is
35
    Port (
36
                        -- IP Layer signals
37
                        ip_tx_start                             : in std_logic;
38
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
39
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
40
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
41
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
42
                        ip_rx                                           : out ipv4_rx_type;
43
                        -- system control signals
44
                        rx_clk                                  : in  STD_LOGIC;
45
                        tx_clk                                  : in  STD_LOGIC;
46
                        reset                                   : in  STD_LOGIC;
47
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
48
                        our_mac_address                 : in std_logic_vector (47 downto 0);
49
                        -- system status signals
50
                        rx_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
51
                        -- ARP lookup signals
52
                        arp_req_req                             : out arp_req_req_type;
53
                        arp_req_rslt                    : in arp_req_rslt_type;
54
                        -- MAC layer RX signals
55
                        mac_data_in                     : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
56
                        mac_data_in_valid       : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
57
                        mac_data_in_last                : in  STD_LOGIC;                                                                        -- indicates last data in frame
58
                        -- MAC layer TX signals
59
                        mac_tx_req                              : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
60
                        mac_tx_granted                  : in std_logic;                                                                 -- indicates that access to channel has been granted            
61
                        mac_data_out_ready      : in std_logic;                                                                 -- indicates system ready to consume data
62
                        mac_data_out_valid      : out std_logic;                                                                        -- indicates data out is valid
63
                        mac_data_out_last               : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
64
                        mac_data_out                    : out std_logic_vector (7 downto 0)                      -- ethernet frame (from dst mac addr through to last byte of frame)      
65
                        );
66
end IPv4;
67
 
68
architecture structural of IPv4 is
69
 
70
    COMPONENT IPv4_TX
71
    PORT(
72
                        -- IP Layer signals
73
                        ip_tx_start                             : in std_logic;
74
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
75
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
76
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
77
                        -- system control 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
                        -- ARP lookup signals
83
                        arp_req_req                             : out arp_req_req_type;
84
                        arp_req_rslt                    : in arp_req_rslt_type;
85
                        -- MAC layer TX signals
86
                        mac_tx_req                              : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
87
                        mac_tx_granted                  : in std_logic;                                                                 -- indicates that access to channel has been granted            
88
                        mac_data_out_ready      : in std_logic;                                                                 -- indicates system ready to consume data
89
                        mac_data_out_valid      : out std_logic;                                                                        -- indicates data out is valid
90
                        mac_data_out_last               : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
91
                        mac_data_out                    : out std_logic_vector (7 downto 0)                      -- ethernet frame (from dst mac addr through to last byte of frame)      
92
        );
93
    END COMPONENT;
94
 
95
    COMPONENT IPv4_RX
96
    PORT(
97
                        -- IP Layer signals
98
                        ip_rx                                           : out ipv4_rx_type;
99
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
100
                        -- system signals
101
                        clk                                             : in  STD_LOGIC;
102
                        reset                                   : in  STD_LOGIC;
103
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
104
                        rx_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
105
                        -- MAC layer RX signals
106
                        mac_data_in                     : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
107
                        mac_data_in_valid       : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
108
                        mac_data_in_last                : in  STD_LOGIC                                                                 -- indicates last data in frame
109
       );
110
    END COMPONENT;
111
 
112
begin
113
 
114
   TX : IPv4_TX PORT MAP (
115
          ip_tx_start                   => ip_tx_start,
116
          ip_tx                                         => ip_tx,
117
          ip_tx_result                  => ip_tx_result,
118
          ip_tx_data_out_ready=> ip_tx_data_out_ready,
119
          clk                                           => tx_clk,
120
          reset                                         => reset,
121
          our_ip_address                => our_ip_address,
122
          our_mac_address               => our_mac_address,
123
          arp_req_req                   => arp_req_req,
124
          arp_req_rslt                  => arp_req_rslt,
125
          mac_tx_req                    => mac_tx_req,
126
          mac_tx_granted                => mac_tx_granted,
127
          mac_data_out_ready    => mac_data_out_ready,
128
          mac_data_out_valid    => mac_data_out_valid,
129
          mac_data_out_last     => mac_data_out_last,
130
          mac_data_out                  => mac_data_out
131
        );
132
 
133
   RX : IPv4_RX PORT MAP (
134
          ip_rx                                         => ip_rx,
135
          ip_rx_start                   => ip_rx_start,
136
          clk                                           => rx_clk,
137
          reset                                         => reset,
138
          our_ip_address                => our_ip_address,
139
                         rx_pkt_count                   => rx_pkt_count,
140
          mac_data_in                   => mac_data_in,
141
          mac_data_in_valid     => mac_data_in_valid,
142
          mac_data_in_last      => mac_data_in_last
143
        );
144
 
145
 
146
end structural;
147
 

powered by: WebSVN 2.1.0

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