1 |
2 |
NikosAl |
======================================================================================================
|
2 |
|
|
UDP/IP Core for FPGAs (in VHDL)
|
3 |
|
|
======================================================================================================
|
4 |
|
|
|
5 |
|
|
Update date: February 9th, 2010
|
6 |
|
|
Build date: December 15th, 2009
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
Description
|
10 |
|
|
-----------
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
This is a VHDL implementation of a UDP/IP core that can be connected to the input and output ports of the
|
14 |
|
|
Virtex-5 Ethernet MAC Local Link Wrapper and enable communication betweena a PC and a FPGA.
|
15 |
|
|
|
16 |
|
|
It has been area-optimized, it is suitable for direct PC-FPGA communication and can operate at Gigabit speed.
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
Example placement on a Virtex 5:
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
-- -----------------------------------------------------------------------
|
23 |
|
|
-- | EXAMPLE DESIGN WRAPPER |
|
24 |
|
|
-- | --------------------------------------------------------|
|
25 |
|
|
-- | |LOCAL LINK WRAPPER |
|
26 |
|
|
-- | | -----------------------------------------|
|
27 |
|
|
-- | UDP/IP core | |BLOCK LEVEL WRAPPER |
|
28 |
|
|
-- | ----------- | | --------------------- |
|
29 |
|
|
-- | |-------- | | ---------- | | ETHERNET MAC | |
|
30 |
|
|
-- | || IPv4 | | | | | | | WRAPPER | --------- |
|
31 |
|
|
-- |->| pack |-> |->| |--|--->| Tx Tx |--| |--->|
|
32 |
|
|
-- | || trans| | | | | | | client PHY | | | |
|
33 |
|
|
-- | |-------- | | | LOCAL | | | I/F I/F | | | |
|
34 |
|
|
-- | | | | | LINK | | | | | PHY | |
|
35 |
|
|
-- | | | | | FIFO | | | | | I/F | |
|
36 |
|
|
-- | | | | | | | | | | | |
|
37 |
|
|
-- | |-------- | | | | | | Rx Rx | | | |
|
38 |
|
|
-- | || IPv4 | | | | | | | client PHY | | | |
|
39 |
|
|
-- | || pack |<- |<-| |<-|----| I/F I/F |<-| |<---|
|
40 |
|
|
-- | ||receiv| | | | | | | | --------- |
|
41 |
|
|
-- | |-------- | | ---------- | --------------------- |
|
42 |
|
|
-- | ----------- | -----------------------------------------|
|
43 |
|
|
-- | --------------------------------------------------------|
|
44 |
|
|
-- -----------------------------------------------------------------------
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
Package Structure
|
49 |
|
|
-----------------
|
50 |
|
|
|
51 |
|
|
This package contains the following files and folder:
|
52 |
|
|
|
53 |
|
|
-README : This file
|
54 |
|
|
|
55 |
|
|
-UDP_IP_CORE : This folder contains VHDL, XCO and NGC files both for Virtex 5 as well as Spartan 3 FPGAs.
|
56 |
|
|
|
57 |
|
|
-LUT COE file : This folder contains a COE file for the LUT that contains the IP packet header field.
|
58 |
|
|
|
59 |
|
|
-JAVA app : This folder contains the JAVA application used on the PC side for transmitting and receiving packets.
|
60 |
|
|
|
61 |
|
|
-PAPER : This folder contains a paper that describes in detail the design and implementation of the core.
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
Usage of the UDP/IP core
|
66 |
|
|
------------------------
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
Before integrating the core into your design you have to reinitialize the LUT of the transmitter.
|
70 |
|
|
This LUT contains the header section of the IP packet.One must change the X fields that appear in the following table.
|
71 |
|
|
|
72 |
|
|
The field that should be changed are:
|
73 |
|
|
Destination MAC Address : (LUT)
|
74 |
|
|
Source MAC Address : (LUT)
|
75 |
|
|
Source IP Address : (LUT)
|
76 |
|
|
Destination IP Address : (LUT)
|
77 |
|
|
Source Port : (LUT)
|
78 |
|
|
Destination Port : (LUT)
|
79 |
|
|
Header Checksum : VHDL file
|
80 |
|
|
|
81 |
|
|
The Addresses are read from the LUT, thats why a reinitialization is required.
|
82 |
|
|
The Header Checksum base value is not read from the LUT. It can be found in the VHDL file.
|
83 |
|
|
The Header Checksum base value depends on the IP Addresses and it is the Header Checksum value of a packet with no user data.
|
84 |
|
|
|
85 |
|
|
If you choose to use the JAVA application provided in this packet only the Destination MAC Address needs to change.
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
------------------------------------------------------------------------------------------------------------------------------------------
|
89 |
|
|
------------------------------------------------------------------------------------------------------------------------------------------
|
90 |
|
|
-- IPv4 PACKET STRUCTURE : -- --
|
91 |
|
|
-- size | Description | Transmission Order | Position --
|
92 |
|
|
------------------------------------------------------------------------------------------------------------------------------------------
|
93 |
|
|
-- 6 bytes | Destin MAC Address (PC) | 0 1 2 3 4 5 | LUT --
|
94 |
|
|
-- | X-X-X-X-X-X | | --
|
95 |
|
|
-- | | | --
|
96 |
|
|
-- 6 bytes | Source MAC Address (FPGA) | 6 7 8 9 10 11 | LUT --
|
97 |
|
|
-- | 11111111-11111111-11111111-11111111-... | | --
|
98 |
|
|
-- 2 bytes | Ethernet Type | 12 13 | LUT --
|
99 |
|
|
-- | (fixed to 00001000-00000000 :=> | | --
|
100 |
|
|
-- | Internet Protocol, Version 4 (IPv4)) | | --
|
101 |
|
|
-- -- Start of IPv4 Packet - - - - - - - - - - - - - -- --
|
102 |
|
|
-- 1 byte | 4 MSBs = Version , 4 LSBs = Header Length| 14 | LUT --
|
103 |
|
|
-- | 0100 0101 | | --
|
104 |
|
|
-- 1 byte | Differentiated Services | 15 | LUT --
|
105 |
|
|
-- | 00000000 | | --
|
106 |
|
|
-- 2 bytes | Total Length | 16 17 | REG --
|
107 |
|
|
-- | 00000000-00100100 (base: 20 + 8 + datalength)| | --
|
108 |
|
|
-- 2 bytes | Identification | 18 19 | LUT --
|
109 |
|
|
-- | 00000000-00000000 | | --
|
110 |
|
|
-- 2 bytes | 3 MSBs = Flags , 13 LSBs = Fragment Offset| 20 21 | LUT --
|
111 |
|
|
-- | 010 - 0000000000000 | | --
|
112 |
|
|
-- 1 byte | Time to Live | 22 | LUT --
|
113 |
|
|
-- | 01000000 | | --
|
114 |
|
|
-- 1 byte | Protocol | 23 | LUT --
|
115 |
|
|
-- | 00010001 | | --
|
116 |
|
|
-- 2 bytes | Header Checksum | 24 25 | REG --
|
117 |
|
|
-- | X X (base value) | | --
|
118 |
|
|
-- 4 bytes | Source IP Address | 26 27 28 29 | LUT --
|
119 |
|
|
-- | X-X-X-X - FPGA | | --
|
120 |
|
|
-- 4 bytes | Destin IP Address | 30 31 32 33 | LUT --
|
121 |
|
|
-- | X-X-X-X - PC | | --
|
122 |
|
|
-- -- Start of UDP Packet - - - - - - - - - - - - - - -- --
|
123 |
|
|
-- 2 bytes | Source Port | 34 35 | LUT --
|
124 |
|
|
-- | X-X | | --
|
125 |
|
|
-- 2 bytes | Destination Port | 36 37 | LUT --
|
126 |
|
|
-- | X-X | | --
|
127 |
|
|
-- 2 bytes | Length | 38 39 | REG --
|
128 |
|
|
-- | 00000000 - 00010000 (8 + # data bytes)| | --
|
129 |
|
|
-- 2 bytes | Checksum | 40 41 | LUT --
|
130 |
|
|
-- | 00000000 - 00000000 | | --
|
131 |
|
|
-- X bytes | Data | 42 .. X | from input --
|
132 |
|
|
-- | | | -- --
|
133 |
|
|
------------------------------------------------------------------------------------------------------------------------------------------
|
134 |
|
|
------------------------------------------------------------------------------------------------------------------------------------------
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
Interface of the UDP/IP core
|
139 |
|
|
----------------------------
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
The interface of the unit is defined as follows:
|
143 |
|
|
|
144 |
|
|
entity UDP_IP_Core is
|
145 |
|
|
Port ( rst : in STD_LOGIC; -- active-high
|
146 |
|
|
clk_125MHz : in STD_LOGIC;
|
147 |
|
|
|
148 |
|
|
-- Transmit signals
|
149 |
|
|
transmit_start_enable : in STD_LOGIC;
|
150 |
|
|
transmit_data_length : in STD_LOGIC_VECTOR (15 downto 0);
|
151 |
|
|
usr_data_trans_phase_on : out STD_LOGIC;
|
152 |
|
|
transmit_data_input_bus : in STD_LOGIC_VECTOR (7 downto 0);
|
153 |
|
|
start_of_frame_O : out STD_LOGIC;
|
154 |
|
|
end_of_frame_O : out STD_LOGIC;
|
155 |
|
|
source_ready : out STD_LOGIC;
|
156 |
|
|
transmit_data_output_bus : out STD_LOGIC_VECTOR (7 downto 0);
|
157 |
|
|
|
158 |
|
|
--Receive Signals
|
159 |
|
|
rx_sof : in STD_LOGIC;
|
160 |
|
|
rx_eof : in STD_LOGIC;
|
161 |
|
|
input_bus : in STD_LOGIC_VECTOR(7 downto 0);
|
162 |
|
|
valid_out_usr_data : out STD_LOGIC;
|
163 |
|
|
usr_data_output_bus : out STD_LOGIC_VECTOR (7 downto 0)
|
164 |
|
|
);
|
165 |
|
|
end UDP_IP_Core;
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
The UDP/IP core and the LOCAL LINK WRAPPER must have the same rst and clk signals.
|
169 |
|
|
|
170 |
|
|
Signal transmit_start_enable : active high , It must be high for one clock cycle only.
|
171 |
|
|
|
172 |
|
|
Signal transmit_data_length : number of user data to be transmitted (number of bytes)
|
173 |
|
|
|
174 |
|
|
Signal usr_data_trans_phase_on: is high one clock cycle before the transmittion of user data and remains high while transmitting user data.
|
175 |
|
|
|
176 |
|
|
Signal transmit_data_input_bus : input data to be transmitted. Starts transmitting one clock cycle after the usr_data_trans_phase_on is set.
|
177 |
|
|
|
178 |
|
|
Signals start_of_frame_O,end_of_frame_O,source_ready,transmit_data_output_bus should be connected to the local link wrapper's input ports.
|
179 |
|
|
|
180 |
|
|
Signals rx_sof, rx_eof : active low, inputs from the local link wrapper
|
181 |
|
|
|
182 |
|
|
Signal input_bus : input from the local link wrapper
|
183 |
|
|
|
184 |
|
|
Signal valid_out_usr_data : output to user, when set it indicates that the usr_data_output_bus contains the user data section of the incoming packet
|
185 |
|
|
|
186 |
|
|
Signal usr_data_output_bus : user data output bus output to the user
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
Implementation Details
|
191 |
|
|
----------------------
|
192 |
|
|
|
193 |
|
|
The VHDL unit have been designed using the Xilinx 10.1 Design Suite.
|
194 |
|
|
|
195 |
|
|
ISE 10.1 was used to create the unit.
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
Verification Details
|
200 |
|
|
--------------------
|
201 |
|
|
|
202 |
|
|
Modelsim 6.3f was used for extensive post place and route simulations.
|
203 |
|
|
|
204 |
|
|
The development board HTG-V5-PCIE by HiTech Global populated with a V5SX95T-1 FPGA was used to verify the correct behavior of the core.
|
205 |
|
|
|
206 |
3 |
NikosAl |
The Spartan3 configuration has not been hardware-verified!
|
207 |
|
|
|
208 |
|
|
It has been verified on Virtex 6 FPGA by users!
|
209 |
2 |
NikosAl |
|
210 |
|
|
|
211 |
|
|
Citation
|
212 |
|
|
--------
|
213 |
|
|
|
214 |
|
|
By using this component in any architecture design and associated publication, you agree to cite it as:
|
215 |
|
|
"Efficient PC-FPGA Communication over Gigabit Ethernet", by Nikolaos Alachiotis, Simon A. Berger and Alexandros Stamatakis,
|
216 |
3 |
NikosAl |
IEEE ICESS 2010, June/July 2010.
|
217 |
2 |
NikosAl |
|
218 |
|
|
|
219 |
|
|
Authors and Contact Details
|
220 |
|
|
---------------------------
|
221 |
|
|
|
222 |
3 |
NikosAl |
Nikos Alachiotis n.alachiotis@gmail.com
|
223 |
2 |
NikosAl |
Simon A. Berger bergers@in.tum.de
|
224 |
|
|
Alexandros Stamatakis stamatak@in.tum.de
|
225 |
|
|
|
226 |
|
|
Technichal University of Munich
|
227 |
|
|
Department of Computer Science / I 12
|
228 |
|
|
The Exelixis Lab
|
229 |
|
|
Boltzmannstr. 3
|
230 |
|
|
D-85748 Garching b. Muenchen
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
Copyright
|
234 |
|
|
---------
|
235 |
|
|
|
236 |
|
|
This component is free. In case you use it for any purpose, particularly
|
237 |
3 |
NikosAl |
when publishing work relying on this component you must cite it as:
|
238 |
|
|
|
239 |
|
|
N. Alachiotis, S.A. Berger, A. Stamatakis: "Efficient PC-FPGA Communication over Gigabit Ethernet". IEEE ICESS 2010, June/July 2010.
|
240 |
|
|
|
241 |
2 |
NikosAl |
|
242 |
|
|
|
243 |
|
|
You can redistribute it and/or modify
|
244 |
3 |
NikosAl |
it under the terms of the GNU Lesser General Public License as published by
|
245 |
2 |
NikosAl |
the Free Software Foundation; either version 2 of the License, or
|
246 |
|
|
(at your option) any later version.
|
247 |
|
|
|
248 |
|
|
This component is distributed in the hope that it will be useful,
|
249 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
250 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
251 |
|
|
GNU General Public License for more details.
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
Release Notes
|
256 |
|
|
------------
|
257 |
|
|
|
258 |
|
|
Update date: February 9th, 2010
|
259 |
|
|
|
260 |
|
|
Build date : December 15th, 2009
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
|