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/] [UDP_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: 
4
-- 
5
-- Create Date:    17:51:18 06/11/2011 
6
-- Design Name: 
7
-- Module Name:    UDP_Complete - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Revision 0.02 - separated RX and TX clocks
18
-- Additional Comments: 
19
--
20
----------------------------------------------------------------------------------
21
library IEEE;
22
use IEEE.STD_LOGIC_1164.ALL;
23
use IEEE.NUMERIC_STD.ALL;
24
use work.axi.all;
25
use work.ipv4_types.all;
26
use work.arp_types.all;
27
 
28
entity UDP_Complete is
29
    Port (
30
                        -- UDP TX signals
31
                        udp_tx_start                    : in std_logic;                                                 -- indicates req to tx UDP
32
                        udp_txi                                 : in udp_tx_type;                                                       -- UDP tx cxns
33
                        udp_tx_result                   : out std_logic_vector (1 downto 0);-- tx status (changes during transmission)
34
                        udp_tx_data_out_ready: out std_logic;                                                   -- indicates udp_tx is ready to take data
35
                        -- UDP RX signals
36
                        udp_rx_start                    : out std_logic;                                                        -- indicates receipt of udp header
37
                        udp_rxo                                 : out udp_rx_type;
38
                        -- IP RX signals
39
                        ip_rx_hdr                               : out ipv4_rx_header_type;
40
                        -- system signals
41
                        clk_in_p             : in  std_logic;                                           -- 200MHz clock input from board
42
                        clk_in_n             : in  std_logic;
43
                        clk_out                                 : out std_logic;
44
                        reset                                   : in  STD_LOGIC;
45
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
46
                        our_mac_address                 : in std_logic_vector (47 downto 0);
47
                        -- status signals
48
                        arp_pkt_count                   : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
49
                        ip_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
50
                        -- GMII Interface
51
                        phy_resetn           : out std_logic;
52
                        gmii_txd             : out std_logic_vector(7 downto 0);
53
                        gmii_tx_en           : out std_logic;
54
                        gmii_tx_er           : out std_logic;
55
                        gmii_tx_clk          : out std_logic;
56
                        gmii_rxd             : in  std_logic_vector(7 downto 0);
57
                        gmii_rx_dv           : in  std_logic;
58
                        gmii_rx_er           : in  std_logic;
59
                        gmii_rx_clk          : in  std_logic;
60
                        gmii_col             : in  std_logic;
61
                        gmii_crs             : in  std_logic;
62
                        mii_tx_clk           : in  std_logic
63
                        );
64
end UDP_Complete;
65
 
66
architecture structural of UDP_Complete is
67
 
68
  ------------------------------------------------------------------------------
69
  -- Component Declaration for UDP complete no mac
70
  ------------------------------------------------------------------------------
71
 
72
    COMPONENT UDP_Complete_nomac
73
    PORT(
74
                        -- UDP TX signals
75
                        udp_tx_start                    : in std_logic;                                                 -- indicates req to tx UDP
76
                        udp_txi                                 : in udp_tx_type;                                                       -- UDP tx cxns
77
                        udp_tx_result                   : out std_logic_vector (1 downto 0);-- tx status (changes during transmission)
78
                        udp_tx_data_out_ready: out std_logic;                                                   -- indicates udp_tx is ready to take data
79
                        -- UDP RX signals
80
                        udp_rx_start                    : out std_logic;                                                        -- indicates receipt of udp header
81
                        udp_rxo                                 : out udp_rx_type;
82
                        -- IP RX signals
83
                        ip_rx_hdr                               : out ipv4_rx_header_type;
84
                        -- system signals
85
                        rx_clk                                  : in  STD_LOGIC;
86
                        tx_clk                                  : in  STD_LOGIC;
87
                        reset                                   : in  STD_LOGIC;
88
                        our_ip_address          : in STD_LOGIC_VECTOR (31 downto 0);
89
                        our_mac_address                 : in std_logic_vector (47 downto 0);
90
                        -- status signals
91
                        arp_pkt_count                   : out STD_LOGIC_VECTOR(7 downto 0);                      -- count of arp pkts received
92
                        ip_pkt_count                    : out STD_LOGIC_VECTOR(7 downto 0);                      -- number of IP pkts received for us
93
                        -- MAC Transmitter
94
                        mac_tx_tdata         : out  std_logic_vector(7 downto 0);        -- data byte to tx
95
                        mac_tx_tvalid        : out  std_logic;                                                  -- tdata is valid
96
                        mac_tx_tready        : in std_logic;                                                    -- mac is ready to accept data
97
                        mac_tx_tlast         : out  std_logic;                                                  -- indicates last byte of frame
98
                        -- MAC Receiver
99
                        mac_rx_tdata         : in std_logic_vector(7 downto 0);  -- data byte received
100
                        mac_rx_tvalid        : in std_logic;                                                    -- indicates tdata is valid
101
                        mac_rx_tready        : out  std_logic;                                                  -- tells mac that we are ready to take data
102
                        mac_rx_tlast         : in std_logic                                                             -- indicates last byte of the trame
103
                        );
104
    END COMPONENT;
105
 
106
 
107
  ------------------------------------------------------------------------------
108
  -- Component Declaration for the MAC layer
109
  ------------------------------------------------------------------------------
110
component mac_layer
111
         port (
112
                        -- System controls
113
                        ------------------
114
                        glbl_rst                      : in  std_logic;                                  -- asynchronous reset
115
                        mac_reset                       : in  std_logic;                                                        -- reset mac layer
116
                        clk_in_p                                : in  std_logic;                                        -- 200MHz clock input from board
117
                        clk_in_n                                : in  std_logic;
118
 
119
                        -- MAC Transmitter (AXI-S) Interface
120
                        ---------------------------------------------
121
                        mac_tx_clock                            : out  std_logic;                                                       -- data sampled on rising edge
122
                        mac_tx_tdata                            : in  std_logic_vector(7 downto 0);      -- data byte to tx
123
                        mac_tx_tvalid                           : in  std_logic;                                                        -- tdata is valid
124
                        mac_tx_tready                           : out std_logic;                                                        -- mac is ready to accept data
125
                        mac_tx_tlast                            : in  std_logic;                                                        -- indicates last byte of frame
126
 
127
                        -- MAC Receiver (AXI-S) Interface
128
                        ------------------------------------------
129
                        mac_rx_clock                            : out  std_logic;                                                       -- data valid on rising edge
130
                        mac_rx_tdata                            : out std_logic_vector(7 downto 0);      -- data byte received
131
                        mac_rx_tvalid                           : out std_logic;                                                        -- indicates tdata is valid
132
                        mac_rx_tready                           : in  std_logic;                                                        -- tells mac that we are ready to take data
133
                        mac_rx_tlast                            : out std_logic;                                                        -- indicates last byte of the trame
134
 
135
                        -- GMII Interface
136
                        -----------------     
137
                        phy_resetn                              : out std_logic;
138
                        gmii_txd                      : out std_logic_vector(7 downto 0);
139
                        gmii_tx_en                    : out std_logic;
140
                        gmii_tx_er                    : out std_logic;
141
                        gmii_tx_clk                   : out std_logic;
142
                        gmii_rxd                      : in  std_logic_vector(7 downto 0);
143
                        gmii_rx_dv                    : in  std_logic;
144
                        gmii_rx_er                    : in  std_logic;
145
                        gmii_rx_clk                   : in  std_logic;
146
                        gmii_col                      : in  std_logic;
147
                        gmii_crs                      : in  std_logic;
148
                        mii_tx_clk                    : in  std_logic
149
         );
150
end component;
151
 
152
 
153
        ---------------------------
154
        -- Signals
155
        ---------------------------
156
 
157
        -- MAC RX bus
158
        signal mac_rx_clock                     : std_logic;
159
        signal mac_rx_tdata                     : std_logic_vector (7 downto 0);
160
        signal mac_rx_tvalid                    : std_logic;
161
        signal mac_rx_tready                    : std_logic;
162
        signal mac_rx_tlast                     : std_logic;
163
        -- MAC TX bus
164
        signal mac_tx_clock                     : std_logic;
165
        signal mac_tx_tdata                     : std_logic_vector (7 downto 0);
166
        signal mac_tx_tvalid                    : std_logic;
167
        signal mac_tx_tready                    : std_logic;
168
        signal mac_tx_tlast                     : std_logic;
169
        -- control signals
170
        signal mac_tx_tready_int        : std_logic;
171
        signal mac_tx_granted_int       : std_logic;
172
 
173
 
174
begin
175
 
176
 
177
        process (mac_tx_clock)
178
        begin
179
                -- output followers
180
                clk_out <= mac_tx_clock;
181
        end process;
182
 
183
   ------------------------------------------------------------------------------
184
   -- Instantiate the UDP layer
185
   ------------------------------------------------------------------------------
186
 
187
   udp_block: UDP_Complete_nomac PORT MAP (
188
                         -- UDP TX signals
189
          udp_tx_start                  => udp_tx_start,
190
          udp_txi                               => udp_txi,
191
          udp_tx_result                 => udp_tx_result,
192
          udp_tx_data_out_ready => udp_tx_data_out_ready,
193
                         -- UDP RX signals
194
          udp_rx_start                  => udp_rx_start,
195
          udp_rxo                               => udp_rxo,
196
                         -- IP RX signals
197
          ip_rx_hdr                             => ip_rx_hdr,
198
                         -- system signals
199
          rx_clk                                        => mac_rx_clock,
200
          tx_clk                                        => mac_tx_clock,
201
          reset                                         => reset,
202
          our_ip_address                => our_ip_address,
203
          our_mac_address               => our_mac_address,
204
                         -- status signals
205
          arp_pkt_count                 => arp_pkt_count,
206
          ip_pkt_count                  => ip_pkt_count,
207
 
208
                         -- MAC Transmitter
209
          mac_tx_tready                 => mac_tx_tready_int,
210
          mac_tx_tvalid                 => mac_tx_tvalid,
211
          mac_tx_tlast                  => mac_tx_tlast,
212
          mac_tx_tdata                  => mac_tx_tdata,
213
                    -- MAC Receiver
214
          mac_rx_tdata                  => mac_rx_tdata,
215
          mac_rx_tvalid                 => mac_rx_tvalid,
216
                         mac_rx_tready                  => mac_rx_tready,
217
          mac_rx_tlast                  => mac_rx_tlast
218
        );
219
 
220
 
221
   ------------------------------------------------------------------------------
222
   -- Instantiate the MAC layer
223
   ------------------------------------------------------------------------------
224
        mac_block : mac_layer
225
                 Port map(
226
                                -- System controls
227
                                ------------------
228
                                glbl_rst                                => reset,
229
                                mac_reset         => '0',
230
                                clk_in_p          => clk_in_p,
231
                                clk_in_n          => clk_in_n,
232
 
233
                                -- MAC Transmitter (AXI-S) Interface
234
                                ---------------------------------------------
235
                                mac_tx_clock      => mac_tx_clock,
236
                                mac_tx_tdata      => mac_tx_tdata,
237
                                mac_tx_tvalid     => mac_tx_tvalid,
238
                                mac_tx_tready     => mac_tx_tready_int,
239
                                mac_tx_tlast      => mac_tx_tlast,
240
 
241
                                -- MAC Receiver (AXI-S) Interface
242
                                ------------------------------------------
243
                                mac_rx_clock      => mac_rx_clock,
244
                                mac_rx_tdata      => mac_rx_tdata,
245
                                mac_rx_tvalid     => mac_rx_tvalid,
246
                                mac_rx_tready     => mac_rx_tready,
247
                                mac_rx_tlast      => mac_rx_tlast,
248
 
249
                                -- GMII Interface
250
                                -----------------     
251
                                phy_resetn        => phy_resetn,
252
                                gmii_txd                => gmii_txd,
253
                                gmii_tx_en        => gmii_tx_en,
254
                                gmii_tx_er        => gmii_tx_er,
255
                                gmii_tx_clk       => gmii_tx_clk,
256
                                gmii_rxd                => gmii_rxd,
257
                                gmii_rx_dv        => gmii_rx_dv,
258
                                gmii_rx_er        => gmii_rx_er,
259
                                gmii_rx_clk       => gmii_rx_clk,
260
                                gmii_col        => gmii_col,
261
                                gmii_crs                => gmii_crs,
262
                                mii_tx_clk        => mii_tx_clk
263
                          );
264
 
265
 
266
end structural;
267
 

powered by: WebSVN 2.1.0

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