Skip to content

tongchen126/fpga_pcie_ethernet

Repository files navigation

Build a custom PCIe Gigabyte Ethernet on your own!

This project is based on litex.

Step 1: Replace the corresponding files of original litex library.

  1. Make sure you have installed litex and know its installation path.
  2. Append the content of soc.py in this repo to your local library path located in litex/litex/soc/integration/soc.py.
  3. Copy wishbone_dma.py to your local library path located in litepcie/litepcie/frontend/.
  4. Then override the original file of your local liteeth project with the corresponding files.

Step 2: Generate bitstream and driver header.

Suppose you are using a KC705 FPGA board. In the origianl kc705 board file, it has something like this.

# Ethernet ---------------------------------------------------------------------------------
if with_ethernet:
    self.submodules.ethphy = LiteEthPHY(
        clock_pads = self.platform.request("eth_clocks"),
        pads       = self.platform.request("eth"),
        clk_freq   = self.clk_freq)
    self.add_ethernet(phy=self.ethphy)

# PCIe -------------------------------------------------------------------------------------
if with_pcie:
    self.submodules.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x4"),
        data_width = 128,
        bar0_size  = 0x20000)
    self.add_pcie(phy=self.pcie_phy, ndmas=1)

To add PCIe Gigabyte Ethernet support, you can replace the previous lines with the following:

self.submodules.ethphy = LiteEthPHY(
    clock_pads = self.platform.request("eth_clocks", 0),
    pads       = self.platform.request("eth", 0),
    clk_freq   = self.clk_freq)

self.submodules.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x1"),
                                 data_width=64,
                                 bar0_size=0x20000)
self.add_ethernet_pcie(phy=self.ethphy, pcie_phy=self.pcie_phy)

Then you can generate bitstream, and don't forget to specify the generate driver option.

Step 3:

You should have driver and bitstream generated. The driver should be located in your generated path (kc705/driver/kernel/). Copy this ethernet driver file to the generated driver path (kc705/driver/kernel/) and override main.c. The driver is ready!

Appendix:

RX: 912Mbit/s
rx
TX: 858Mbit/s
tx
RX(371Mbit/s) and TX(868Mbit/s):
rx_tx

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published