Skip to content
You're not viewing the latest version. Click here to go to latest.

# Ethernet Interface

## Overview

For scenarios where UART is not available or higher bandwidth is desired, Manta provides an Ethernet interface for communicating between the host and FPGA. This interface uses UDP for communication, and leverages the builtin Python `sockets` module on the host side, and the open-source LiteEth Ethernet core on the FPGA side.

Not every device is supported!

Although Manta aims to be as platform-agnostic as possible, Ethernet PHYs and FPGA clock primitives are very particular devices. As a result, the supported devices are loosely restricted to those on this list. If a device you'd like to use isn't on the list, the community would love your help!

Although UDP does not guarantee reliable packet delivery, this usually doesn't pose an issue in practice. Manta will throw a runtime error if packets are dropped, and the UDP checksum and Ethernet FCS guarantee that any data delivered is not corrupted. Together, these two behaviors prevent corrupted data from being provided to the user, as Manta will error before returning invalid data. As long as your network is not terribly congested, Manta will operate without issue.

## Configuration

The configuration of the Ethernet core is best shown by example:

    ethernet:
      phy: LiteEthPHYRMII
      vendor: xilinx
      toolchain: vivado

      clk_freq: 50e6
      refclk_freq: 50e6

      fpga_ip_addr: "192.168.0.110"
      host_ip_addr: "192.168.0.100"

This snippet at the end of the configuration file defines the interface. The following parameters must be set:

- `phy` (required): The name of the LiteEth PHY class to use. Valid values consist of any of the names in this list. Select the appropriate one for your FPGA vendor and family.

- `vendor` (required): The vendor of the FPGA being designed for. Currently only values of `xilinx` and `lattice` are supported. Used to generate timing constraints files, which are currently unused.

- `toolchain` (required): The toolchain being used. Currently only values of `vivado` and `diamond` are supported.

- `clk_freq` (required): The frequency of the clock provided to the Manta instance.

- `refclk_freq` (required): The frequency of the reference clock to be provided to the Ethernet PHY. This frequency must match the MII variant supported by the PHY, as well as speed that the PHY is being operated at. For instance, a RGMII PHY may be operated at either 125MHz in Gigabit mode, or 25MHz in 100Mbps mode.

- `fpga_ip_addr` (required): The IP address the FPGA will attempt to claim. Upon power-on, the FPGA will issue a DHCP request for this IP address. The easiest way to check if this was successful is by pinging the FPGA's IP, but if you have access to your network's router it may report a list of connected devices.

- `host_ip_addr` (required): The IP address of the host machine, which the FPGA will send packets back to.

Lastly, any additonal arguments provided in the `ethernet` section of the config file will be passed to the LiteEth standalone core generator. As a result, the examples provided by LiteEth may be of some service to you if you're bringing up a different FPGA!

LiteEth doesn't always generate its own `refclk`!

Although LitEth is built on Migen and LiteX which support PLLs and other clock generation primitives, I haven't seen it instantiate one to synthesize a suitable `refclk` at the appropriate frequency from the input clock. As a result, for now it's recommended to generate your `refclk` outside Manta, and then use it to clock your Manta instance.