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_types.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 pjf
--
2
--
3
--      Purpose: This package defines types for use in IPv4
4
 
5
 
6
library IEEE;
7
use IEEE.STD_LOGIC_1164.all;
8
use work.axi.all;
9 8 pjf
use work.arp_types.all;
10 2 pjf
 
11
package ipv4_types is
12
 
13 6 pjf
        constant IP_BC_ADDR             : std_logic_vector (31 downto 0) := x"ffffffff";
14
        constant MAC_BC_ADDR            : std_logic_vector (47 downto 0) := x"ffffffffffff";
15
 
16 2 pjf
        --------------
17
        -- IPv4 TX --
18
        --------------
19
 
20
        -- coding for result in tx
21
        constant IPTX_RESULT_NONE               : std_logic_vector (1 downto 0) := "00";
22
        constant IPTX_RESULT_SENDING    : std_logic_vector (1 downto 0) := "01";
23
        constant IPTX_RESULT_ERR                : std_logic_vector (1 downto 0) := "10";
24
        constant IPTX_RESULT_SENT               : std_logic_vector (1 downto 0) := "11";
25
 
26
        type ipv4_tx_header_type is record
27
                protocol                                : std_logic_vector (7 downto 0);
28
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);                -- user data size, bytes
29
                dst_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
30
        end record;
31
 
32
        type ipv4_tx_type is record
33
                hdr                             : ipv4_tx_header_type;                                          -- header to tx
34
                data                            : axi_out_type;                                                         -- tx axi bus
35
        end record;
36
 
37
 
38
        --------------
39
        -- IPv4 RX --
40
        --------------
41
 
42
        -- coding for last_error_code in rx hdr
43
        constant RX_EC_NONE             : std_logic_vector (3 downto 0) := x"0";
44
        constant RX_EC_ET_ETH   : std_logic_vector (3 downto 0) := x"1"; -- early termination in ETH hdr phase
45
        constant RX_EC_ET_IP    : std_logic_vector (3 downto 0) := x"2"; -- early termination in IP hdr phase
46
        constant RX_EC_ET_USER  : std_logic_vector (3 downto 0) := x"3"; -- early termination in USER DATA phase
47
 
48
        type ipv4_rx_header_type is record
49
                is_valid                                : std_logic;
50
                protocol                                : std_logic_vector (7 downto 0);
51
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);        -- user data size, bytes
52
                src_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
53
                num_frame_errors        : std_logic_vector (7 downto 0);
54
                last_error_code : std_logic_vector (3 downto 0);         -- see RX_EC_xxx constants
55 6 pjf
                is_broadcast            : std_logic;                                                            -- set if the msg received is a broadcast
56 2 pjf
        end record;
57
 
58
        type ipv4_rx_type is record
59
                hdr                             : ipv4_rx_header_type;                                          -- header received
60
                data                            : axi_in_type;                                                                  -- rx axi bus
61
        end record;
62
 
63 8 pjf
        type ip_control_type is record
64
                arp_controls    : arp_control_type;
65
        end record;
66 2 pjf
 
67
        ------------
68
        -- UDP TX --
69
        ------------
70
 
71
        -- coding for result in tx
72
        constant UDPTX_RESULT_NONE              : std_logic_vector (1 downto 0) := "00";
73
        constant UDPTX_RESULT_SENDING   : std_logic_vector (1 downto 0) := "01";
74
        constant UDPTX_RESULT_ERR                       : std_logic_vector (1 downto 0) := "10";
75
        constant UDPTX_RESULT_SENT              : std_logic_vector (1 downto 0) := "11";
76
 
77
        type udp_tx_header_type is record
78
                dst_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
79
                dst_port                                : STD_LOGIC_VECTOR (15 downto 0);
80
                src_port                                : STD_LOGIC_VECTOR (15 downto 0);
81
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);        -- user data size, bytes
82
                checksum                                : STD_LOGIC_VECTOR (15 downto 0);
83
        end record;
84
 
85
 
86
        type udp_tx_type is record
87
                hdr                             : udp_tx_header_type;                                           -- header received
88
                data                            : axi_out_type;                                                         -- tx axi bus
89
        end record;
90
 
91
 
92
        ------------
93
        -- UDP RX --
94
        ------------
95
 
96
        type udp_rx_header_type is record
97
                is_valid                                : std_logic;
98
                src_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
99
                src_port                                : STD_LOGIC_VECTOR (15 downto 0);
100
                dst_port                                : STD_LOGIC_VECTOR (15 downto 0);
101
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);        -- user data size, bytes
102
        end record;
103
 
104
 
105
        type udp_rx_type is record
106
                hdr                             : udp_rx_header_type;                                           -- header received
107
                data                            : axi_in_type;                                                                  -- rx axi bus
108
        end record;
109
 
110
        type udp_addr_type is record
111
                ip_addr                         : STD_LOGIC_VECTOR (31 downto 0);
112
                port_num                        : STD_LOGIC_VECTOR (15 downto 0);
113
        end record;
114
 
115 8 pjf
        type udp_control_type is record
116
                ip_controls     : ip_control_type;
117
        end record;
118
 
119 2 pjf
 
120
end ipv4_types;

powered by: WebSVN 2.1.0

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