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 23

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 4 pjf
-- Revision 0.03 - Added mac_data_out_first
25 2 pjf
-- Additional Comments: 
26
--
27
----------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
use IEEE.NUMERIC_STD.ALL;
31
use work.axi.all;
32
use work.ipv4_types.all;
33
use work.arp_types.all;
34
 
35
entity IPv4 is
36
    Port (
37
                        -- IP Layer signals
38
                        ip_tx_start                             : in std_logic;
39
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
40
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
41
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
42
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
43
                        ip_rx                                           : out ipv4_rx_type;
44
                        -- system control signals
45
                        rx_clk                                  : in  STD_LOGIC;
46
                        tx_clk                                  : in  STD_LOGIC;
47
                        reset                                   : in  STD_LOGIC;
48
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
49
                        our_mac_address                 : in std_logic_vector (47 downto 0);
50
                        -- system status signals
51
                        rx_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
52
                        -- ARP lookup signals
53
                        arp_req_req                             : out arp_req_req_type;
54
                        arp_req_rslt                    : in arp_req_rslt_type;
55
                        -- MAC layer RX signals
56
                        mac_data_in                     : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
57
                        mac_data_in_valid       : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
58
                        mac_data_in_last                : in  STD_LOGIC;                                                                        -- indicates last data in frame
59
                        -- MAC layer TX signals
60
                        mac_tx_req                              : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
61
                        mac_tx_granted                  : in std_logic;                                                                 -- indicates that access to channel has been granted            
62
                        mac_data_out_ready      : in std_logic;                                                                 -- indicates system ready to consume data
63
                        mac_data_out_valid      : out std_logic;                                                                        -- indicates data out is valid
64 4 pjf
                        mac_data_out_first      : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
65 2 pjf
                        mac_data_out_last               : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
66
                        mac_data_out                    : out std_logic_vector (7 downto 0)                      -- ethernet frame (from dst mac addr through to last byte of frame)      
67
                        );
68
end IPv4;
69
 
70
architecture structural of IPv4 is
71
 
72
    COMPONENT IPv4_TX
73
    PORT(
74
                        -- IP Layer signals
75
                        ip_tx_start                             : in std_logic;
76
                        ip_tx                                           : in ipv4_tx_type;                                                              -- IP tx cxns
77
                        ip_tx_result                    : out std_logic_vector (1 downto 0);             -- tx status (changes during transmission)
78
                        ip_tx_data_out_ready    : out std_logic;                                                                        -- indicates IP TX is ready to take data
79 4 pjf
 
80
                        -- system signals
81
                        clk                                             : in  STD_LOGIC;                                                                        -- same clock used to clock mac data and ip data
82 2 pjf
                        reset                                   : in  STD_LOGIC;
83
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
84
                        our_mac_address                 : in std_logic_vector (47 downto 0);
85
                        -- ARP lookup signals
86
                        arp_req_req                             : out arp_req_req_type;
87
                        arp_req_rslt                    : in arp_req_rslt_type;
88
                        -- MAC layer TX signals
89
                        mac_tx_req                              : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
90
                        mac_tx_granted                  : in std_logic;                                                                 -- indicates that access to channel has been granted            
91
                        mac_data_out_ready      : in std_logic;                                                                 -- indicates system ready to consume data
92 4 pjf
                        mac_data_out_valid      : out std_logic;                                                                -- indicates data out is valid
93
                        mac_data_out_first      : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
94 2 pjf
                        mac_data_out_last               : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
95 4 pjf
                        mac_data_out                    : out std_logic_vector (7 downto 0)              -- ethernet frame (from dst mac addr through to last byte of frame)      
96 2 pjf
        );
97
    END COMPONENT;
98
 
99
    COMPONENT IPv4_RX
100
    PORT(
101
                        -- IP Layer signals
102
                        ip_rx                                           : out ipv4_rx_type;
103
                        ip_rx_start                             : out std_logic;                                                                        -- indicates receipt of ip frame.
104
                        -- system signals
105
                        clk                                             : in  STD_LOGIC;
106
                        reset                                   : in  STD_LOGIC;
107
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
108
                        rx_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
109
                        -- MAC layer RX signals
110
                        mac_data_in                     : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
111
                        mac_data_in_valid       : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
112
                        mac_data_in_last                : in  STD_LOGIC                                                                 -- indicates last data in frame
113
       );
114
    END COMPONENT;
115
 
116
begin
117
 
118
   TX : IPv4_TX PORT MAP (
119
          ip_tx_start                   => ip_tx_start,
120
          ip_tx                                         => ip_tx,
121
          ip_tx_result                  => ip_tx_result,
122
          ip_tx_data_out_ready=> ip_tx_data_out_ready,
123
          clk                                           => tx_clk,
124
          reset                                         => reset,
125
          our_ip_address                => our_ip_address,
126
          our_mac_address               => our_mac_address,
127
          arp_req_req                   => arp_req_req,
128
          arp_req_rslt                  => arp_req_rslt,
129
          mac_tx_req                    => mac_tx_req,
130
          mac_tx_granted                => mac_tx_granted,
131
          mac_data_out_ready    => mac_data_out_ready,
132
          mac_data_out_valid    => mac_data_out_valid,
133 4 pjf
          mac_data_out_first    => mac_data_out_first,
134 2 pjf
          mac_data_out_last     => mac_data_out_last,
135
          mac_data_out                  => mac_data_out
136
        );
137
 
138
   RX : IPv4_RX PORT MAP (
139
          ip_rx                                         => ip_rx,
140
          ip_rx_start                   => ip_rx_start,
141
          clk                                           => rx_clk,
142
          reset                                         => reset,
143
          our_ip_address                => our_ip_address,
144
                         rx_pkt_count                   => rx_pkt_count,
145
          mac_data_in                   => mac_data_in,
146
          mac_data_in_valid     => mac_data_in_valid,
147
          mac_data_in_last      => mac_data_in_last
148
        );
149
 
150
 
151
end structural;
152
 

powered by: WebSVN 2.1.0

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