Skip to content

sifferman/vivado_acorn

Repository files navigation

Sqrl Acorn FPGA Example

The RHS LiteFury, RHS NiteFury, and RHS NiteFury II PCIe FPGA boards are some of the most affordable PCIe FPGA development platforms available. The cryptocurrency company SQRL licensed and re-released the designs as the Acorn CLE-101, CLE-215, and CLE-215+. Although all six boards are now discontinued, they are often available second-hand.

LiteFury

This repository demonstrates how to get these boards working with Vivado.

The easiest way to get started is to purchase the LiteX Acorn Baseboard Mini, a PCIe x4 riser with an onboard FT2232H JTAG programmer.

Scripts

This project includes multiple Vivado Block Design-based projects of varying complexity:

# RHS LiteFury / Acorn CLE101

# Use bd/pcie_bram.tcl
make pcie_bram_program && sudo reboot
vivado build/pcie_bram/acorn.xpr
source xdma_helpers.sh && test_pcie_ram 8K

# Use bd/pcie_ddr3.tcl
dmake pcie_ddr3_program && sudo reboot
vivado build/pcie_ddr3/acorn.xpr
source xdma_helpers.sh && test_pcie_ram 512M

# Use bd/pcie_ddr3_rtl.tcl
make pcie_ddr3_rtl_program && sudo reboot
vivado build/pcie_ddr3_rtl/acorn.xpr
source xdma_helpers.sh && test_pcie_rtl && test_pcie_ram 512M


# RHS NiteFury II / Acorn CLE215+

# Use bd/pcie_bram.tcl
make pcie_bram_program VARIANT=cle215+ && sudo reboot
vivado build/pcie_bram/acorn.xpr
source xdma_helpers.sh && test_pcie_ram 8K

# Use bd/pcie_ddr3.tcl
make pcie_ddr3_program VARIANT=cle215+ && sudo reboot
vivado build/pcie_ddr3/acorn.xpr
source xdma_helpers.sh && test_pcie_ram 1G

# Use bd/pcie_ddr3_rtl.tcl
make pcie_ddr3_rtl_program VARIANT=cle215+ && sudo reboot
vivado build/pcie_ddr3_rtl/acorn.xpr
source xdma_helpers.sh && test_pcie_rtl && test_pcie_ram 1G

# etc...

Connecting and Powering the Board

With PCIe Access

  • The easiest way to install the board is to plug it into an open M.2 slot.
  • The next best option is to install it via a PCIe x4 riser.
  • For laptop users, you may connect the board via an external Thunderbolt 3/4 enclosure.

Without PCIe Access

Because Thunderbolt 3/4 enclosures are quite expensive, laptop users may choose to use a cheap USB3.2 SSD Enclosure like this one: SSK SHE-C325. You won't be able to connect via PCIe, but you can still access the LEDs and the Molex PicoEzMate 6-pins connector.

Programming

General Notes

Note that every time you program the FPGA, you must reboot your computer. The FPGA's volatile memory will be preserved if the FPGA doesn't loose power during the reboot. Otherwise, consider flashing the on-board non-volatile memory.

Programming Over JTAG

Note that to program the board, you first need to power it with an aformentioned method. JTAG does not provide power.

The easiest method of programming the board is with the LiteX Acorn Baseboard Mini.

Otherwise, the Acorn board exposes a JTAG interface which can be programmed via a JTAG programmer, such as the Digilent HS2. Unfortunetly, the connector is not a standard 7-pin 2mm port, but is instead a Molex PicoEzMate 6. An explanation of how to make an adapter is explained here: Use LiteX on the Acorn CLE 215.

Once the board is connected, ensure that you have installed the cable drivers. Then the FPGA should appear in Vivado's Hardware Manager.

cd ${VIVADO_INSTALLATION}/data/xicom/cable_drivers/lin64/install_script/install_drivers
sudo ./install_drivers

If you want to program using OpenOCD instead of Vivado's Hardware Manager, check out this guide: https://github.com/SMB784/SQRL_quickstart.

Programming Over PCIe + SPI

If your design includes PCIe access to the SPI flash, you can program it through PCIe. See the following tutorial: https://github.com/RHSResearchLLC/NiteFury-and-LiteFury/tree/master/spi-loader.

XDMA Help

The PCIe IP used by this example repo is the XDMA. The Linux driver for it is here: https://github.com/Xilinx/dma_ip_drivers/tree/master/XDMA/linux-kernel.

To install the driver just run the following:

git clone [email protected]:Xilinx/dma_ip_drivers.git
cd dma_ip_drivers/XDMA/linux-kernel/xdma
make -C /lib/modules/$(uname -r)/build M=$PWD modules
sudo make -C /lib/modules/$(uname -r)/build M=$PWD modules_install
sudo depmod -a

If make fails due to a missing Makefile, you may have to install your Linux kernel's build files and headers with the following:

sudo apt install linux-headers-$(uname -r)

Now, you should be all set to load the driver module and connect to the FPGA via the XDMA IP.

# unload driver (if needed)
rmmod xdma
# load driver
modprobe xdma

# Ensure that the driver and FPGA are working
dmesg | grep -i xdma
lspci | grep -i Xilinx
ls /dev/xdma*

Example Transfers

Feel free to use the helper functions in "xdma_helpers.sh". Or you may run the commands manually with:

cd dma_ip_drivers/XDMA/linux-kernel/tools
make

# Transfer 8KB to 0x0
dd if=/dev/urandom of=TEST8K bs=8192 count=1
sudo ./dma_to_device --verbose --device /dev/xdma0_h2c_0 --address 0x00000000 --size $((8*1024)) -f TEST8K
sudo ./dma_from_device --verbose --device /dev/xdma0_c2h_0 --address 0x00000000 --size $((8*1024)) --file RECV8K
cmp -b TEST8K RECV8K

# Transfer 512M to 0x0
dd if=/dev/urandom of=TEST512M bs=1M count=512
sudo ./dma_to_device --verbose --device /dev/xdma0_h2c_0 --address 0x00000000 --size $((512*1024*1024)) -f TEST512M
sudo ./dma_from_device --verbose --device /dev/xdma0_c2h_0 --address 0x00000000 --size $((512*1024*1024)) --file RECV512M
cmp -b TEST512M RECV512M

Board Differences

Board FPGA Part Memory
RHS LiteFury / Acorn CLE101 xc7a100tfgg484-2L 512MB DDR3-800
RHS NiteFury / Acorn CLE215 xc7a200tfbg484-2 512MB DDR3-800
RHS NiteFury II / Acorn CLE215+ xc7a200tfbg484-3 1GB DDR3-1066 (MT41K512M16)

About

An example repo showing how to get started with the Lite/NiteFury(II) and Sqrl Acorn 101/215(+) FPGAs

Resources

License

Stars

Watchers

Forks