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.0/] [rtl/] [vhdl/] [ipv4_types.vhd] - Blame information for rev 35

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 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
 
10
package ipv4_types is
11
 
12
        --------------
13
        -- IPv4 TX --
14
        --------------
15
 
16
        -- coding for result in tx
17
        constant IPTX_RESULT_NONE               : std_logic_vector (1 downto 0) := "00";
18
        constant IPTX_RESULT_SENDING    : std_logic_vector (1 downto 0) := "01";
19
        constant IPTX_RESULT_ERR                : std_logic_vector (1 downto 0) := "10";
20
        constant IPTX_RESULT_SENT               : std_logic_vector (1 downto 0) := "11";
21
 
22
        type ipv4_tx_header_type is record
23
                protocol                                : std_logic_vector (7 downto 0);
24
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);                -- user data size, bytes
25
                dst_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
26
        end record;
27
 
28
        type ipv4_tx_type is record
29
                hdr                             : ipv4_tx_header_type;                                          -- header to tx
30
                data                            : axi_out_type;                                                         -- tx axi bus
31
        end record;
32
 
33
 
34
        --------------
35
        -- IPv4 RX --
36
        --------------
37
 
38
        -- coding for last_error_code in rx hdr
39
        constant RX_EC_NONE             : std_logic_vector (3 downto 0) := x"0";
40
        constant RX_EC_ET_ETH   : std_logic_vector (3 downto 0) := x"1"; -- early termination in ETH hdr phase
41
        constant RX_EC_ET_IP    : std_logic_vector (3 downto 0) := x"2"; -- early termination in IP hdr phase
42
        constant RX_EC_ET_USER  : std_logic_vector (3 downto 0) := x"3"; -- early termination in USER DATA phase
43
 
44
        type ipv4_rx_header_type is record
45
                is_valid                                : std_logic;
46
                protocol                                : std_logic_vector (7 downto 0);
47
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);        -- user data size, bytes
48
                src_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
49
                num_frame_errors        : std_logic_vector (7 downto 0);
50
                last_error_code : std_logic_vector (3 downto 0);         -- see RX_EC_xxx constants
51
        end record;
52
 
53
        type ipv4_rx_type is record
54
                hdr                             : ipv4_rx_header_type;                                          -- header received
55
                data                            : axi_in_type;                                                                  -- rx axi bus
56
        end record;
57
 
58
 
59
        ------------
60
        -- UDP TX --
61
        ------------
62
 
63
        -- coding for result in tx
64
        constant UDPTX_RESULT_NONE              : std_logic_vector (1 downto 0) := "00";
65
        constant UDPTX_RESULT_SENDING   : std_logic_vector (1 downto 0) := "01";
66
        constant UDPTX_RESULT_ERR                       : std_logic_vector (1 downto 0) := "10";
67
        constant UDPTX_RESULT_SENT              : std_logic_vector (1 downto 0) := "11";
68
 
69
        type udp_tx_header_type is record
70
                dst_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
71
                dst_port                                : STD_LOGIC_VECTOR (15 downto 0);
72
                src_port                                : STD_LOGIC_VECTOR (15 downto 0);
73
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);        -- user data size, bytes
74
                checksum                                : STD_LOGIC_VECTOR (15 downto 0);
75
        end record;
76
 
77
 
78
        type udp_tx_type is record
79
                hdr                             : udp_tx_header_type;                                           -- header received
80
                data                            : axi_out_type;                                                         -- tx axi bus
81
        end record;
82
 
83
 
84
        ------------
85
        -- UDP RX --
86
        ------------
87
 
88
        type udp_rx_header_type is record
89
                is_valid                                : std_logic;
90
                src_ip_addr             : STD_LOGIC_VECTOR (31 downto 0);
91
                src_port                                : STD_LOGIC_VECTOR (15 downto 0);
92
                dst_port                                : STD_LOGIC_VECTOR (15 downto 0);
93
                data_length                     : STD_LOGIC_VECTOR (15 downto 0);        -- user data size, bytes
94
        end record;
95
 
96
 
97
        type udp_rx_type is record
98
                hdr                             : udp_rx_header_type;                                           -- header received
99
                data                            : axi_in_type;                                                                  -- rx axi bus
100
        end record;
101
 
102
        type udp_addr_type is record
103
                ip_addr                         : STD_LOGIC_VECTOR (31 downto 0);
104
                port_num                        : STD_LOGIC_VECTOR (15 downto 0);
105
        end record;
106
 
107
 
108
end ipv4_types;

powered by: WebSVN 2.1.0

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