Ethernet Connection
The whole point of XiBIF is that it allows a host (typically your computer) to connect to the FPGA via Ethernet and exchange data. Before we can talk to the device, we need to do some setup.
Network Setup
Connect your FPGA with an Ethernet cable to your computer.
Open Adapter Settings
Open the Control Panel on your Windows computer.
Navigate to “Network and Internet”.
Click on “Network and Sharing Center”.
In the Network and Sharing Center, find and click on “Change adapter settings” on the left sidebar.
You will see a list of network connections. Look for the one that corresponds to your Ethernet adapter to the FPGA.
Right-click on the Ethernet connection and select “Properties”.
Configure IPv4 Settings
In the Properties window, scroll down and select “Internet Protocol Version 4 (TCP/IPv4)”.
Click on “Properties”.
In the Internet Protocol Version 4 (TCP/IPv4) Properties window, select “Use the following IP address”.
Enter the following values:
IP Address: 192.168.1.1
Subnet Mask: 255.255.255.0
Default Gateway: Leave this field blank or set it to 192.168.1.1.
The DNS server settings can typically be left as “Obtain DNS server address automatically”, as DNS is not required for direct communication between your computer and the XiBIF board.
Click “OK” to save the settings.
Verify the Connection
After setting the IP address, you can verify the connection between your computer and the XiBIF board.
Open a command prompt (search for cmd in the Start menu).
Type
ping 192.168.1.10and press “Enter”.If the connection is successful, you should see replies from the FPGA board.
Static IP Address
By default, XiBIF uses the static IP address 192.168.1.10 with a netmask of 255.255.255.0 and a gateway of 192.168.1.1. For XiBIF to be able to communicate with your computer, it must be able to reach its gateway.
Typically, the gateway is a networking device (router, L3 switch), but your computer presents this IP to XiBIF in this case.
Why Static IP Addresses?
In a network, devices are identified by their IP addresses. In regular day-to-day use, the network router automatically assigns IP addresses (DHCP). However, you need to set static IP addresses to directly communicate between your computer and the XiBIF hardware without a router. This ensures that both the FPGA and the computer know where to send and receive data without confusion or conflict.
How does it work?
IP Address: This is the unique identifier for a device on a network. By setting the computer’s IP address to
192.168.1.1, you ensure that it is on the same subnet as the XiBIF board (192.168.1.10), allowing them to communicate directly.Subnet Mask: The subnet mask
255.255.255.0tells the network that the first three segments of the IP address (192.168.1) must match for two devices to be on the same network. This is why both the computer and the XiBIF board share the192.168.1.xaddress range.Default Gateway: This is typically used to route traffic to other networks. Since we are configuring a direct connection, the default gateway is not necessary, but it can be set to the computer’s IP as a placeholder.
Connecting using DHCP (Advanced)
If you use XiBIF on a network, you can enable DHCP for dynamic IP addressing of the FPGA. DHCP is activated by default, but when no IP can be obtained within 10 seconds, it automatically switches to fixed IP mode. During Startup, XiBIF always reports its IP address on the UART output.
Warning
To use DHCP within the OST network, the MAC address of the FPGA must be registered with the IT department. Ask your supervisor for help with this.
Configuring Ethernet settings
Various Ethernet settings can be configured in XiBIF. The settings are stored in the XiBIF project file .xibif. The following settings can be configured:
name |
description |
default value |
|---|---|---|
mac |
The MAC address of the FPGA. |
|
default_ip |
The IP address of the FPGA. Used when the FPGA switches to static mode. |
|
default_netmask |
The netmask of the FPGA. Used when the FPGA switches to static mode. |
|
default_gateway |
The gateway of the FPGA. Used when the FPGA switches to static mode. |
|
timeout_dhcp_s |
The timeout for DHCP in seconds. After this time, the FPGA switches to static mode. |
|
timeout_connection_drop_ms |
The timeout until a connection counts as dropped in milliseconds. See Status and Control Signals for more information. |
|
connection_drop_flush_fifo |
If set to |
|
All settings can be modified by using the command xibif settings. The command to change the default IP address would be:
xibif settings --ethernet.default_ip 192.168.1.22
Networking Basics
This section aims to give a very brief introduction into the terminology and workings of networking.
OSI Model
The Open Systems Interconnection model is a reference model that “provides a common basis for the coordination of standards development for the purpose of systems interconnection”. The communications between systems is split into seven distinct layers:
Layer |
Protocol data unit (PDU) |
Function |
|
|---|---|---|---|
7 |
Application |
Data |
High-level protocols such as for resource sharing or remote file access, e.g. HTTP. |
6 |
Application |
Data |
Translation of data between a networking service and an application; including character encoding, data compression and encryption/decryption. |
5 |
Session |
Data |
Managing communication sessions, i.e., continuous exchange of information in the form of multiple back-and-forth transmissions between two nodes. |
4 |
Transport |
Segment |
Reliable transmission of data segments between points on a network, including segmentation, acknowledgement and multiplexing. |
3 |
Network |
Packet, Datagram |
Structuring and managing a multi-node network, including addressing, routing and traffic control. |
2 |
Data link |
Frame |
Transmission of data frames between two nodes connected by a physical layer. |
1 |
Physical |
Bit, Symbol |
Transmission and reception of raw bit streams over a physical medium. |
Each layer serves exactly one purpose. To understand how XiBIF connects, we need to look at layers 1 to 3.
Physical
This is essentially the connection between our systems that need to communicate. Think: the physical interface used to transport the data.
Link Layer
A MAC address (short MAC) is a physical address, meaning that a MAC is assigned to a physical network interface, such as an ethernet port. The ethernet port on your computer (or USB-C dongle, hurray) has a MAC address. Your phone’s WiFi chip has a MAC address. Everything has a MAC address. The important thing is that (usually), a network connection can be uniquely identified by its MAC address. The MAC address lives on the Link Layer, and now you know why: knowing an interface’s MAC address allows to speak to it specifically in a network.
Note
The MAC address is how most switches determine how they distribute packets. When they receive a message on a port where a client is connected (this is normal, every device announces itself), it learns the MAC address corresponding to that port. So when a package is sent for that device, the switch knows on which interface to put it. Nowadays, many switches are L3 aware (Network Layer) and thus the layers blend a bit.
Networking Layer
Whilst a MAC address might identify an interface, there is no requirement for them to be ordered in any way. We need to find a way to logically structure our network.
This is the purpose of the networking layer. It assigns Internet Protocol (IP) addresses to every device and thus achieves some logical structure in the network. For now, we only talk about IPv4 addresses. An IPv4 address is a 32-bit number that is formatted in four sets of 8-bit numbers, each of which can take values from 0 to 255. The sets of numbers are separated by a period point. The most common IP address is 192.168.1.1. and is highly likely the IP address of your router.
Being a 32-bit number, there is a hard limit of how many unique addresses there are: 4’294’967’295. This sounds like a lot, but these addresses are actually running out; hence there is IPv6.
Subnets
A subnet is a defined range of IP addresses. For example, the most common subnet spans 192.168.1.0 to 192.168.1.255. The idea behind a subnet is that a router only has to know about a relatively small amount of possible endpoints (256 is a lot more manageable than four billion).
A subnet is identified by another 32-bit number called a Netmask. The netmask masks the network address and specifies in which range the network address may be. The most common netmask is 255.255.255.0. The trailing 0 means that the last 8 bits of the address number (remember, the address is 32-bit) can be changed. With a network of 192.168.1.0, this allows for all addresses up to 192.168.1.255.
If you have a netmask of 255.255.255.128, you are only allowed to change the last seven bits of the address. So a network starting at 192.168.1.0 can only have addresses up to 192.168.1.127.
Network Identifier
A network is always identified by the lowest IP in its subnet. For the standard IP network at home, the network is defined by 192.168.1.0.
Broadcast Address
There is an IP address that speaks to every device in the network, and it is always the highest address of the network. For our example, this is 192.168.1.255.
Reserved Addresses and Address Classes
A small set of IP addresses is reserved regardless of network.
0.0.0.0 is the default network. It is non-routable and designates an invalid, non-applicable or unknown network.
127.0.0.1 is known as the loopback address, and it is used for a computer to identify itself, regardless of whether it has been assigned an IP address.
255.255.255.255 is the universal broadcast address that addresses every single target in a network.
There is also a set of IP address classes:
Network 10.0.0.0 with a netmask of 255.0.0.0 is Class A
Network 172.16.0.0 with a netmask of 255.255.0.0 is Class B
Network 192.168.1.0 with a netmask of 255.255.255.0 is Class C
Network 224.0.0.0 with a netmask of 240.0.0.0 is Class D
Network 172.16.0.0 with a netmask of 240.0.0.0 is Class E
IP addresses listed under Class A, Class B, and Class C are most commonly used in the creation of subnets. Addresses within the multicast or Class D have specific usage rules outlined in the Internet Engineering Task Force (IETF) guidelines, while the release of Class E addresses for public use was the cause of plenty of debate before the IPv6 standard was introduced.