Prepare
Project structure
Like most Fletcher projects, this example project contains software (host application) and hardware (accelerator functional unit) sources.
Software
The host application consists of a single C++ source file that contains the host application that interacts with the accelerator. A CMake file is included that can be used to build the application. Instructions are available in the simulate and hardware sections.
Hardware
The hardware directory contains a number of important files.
sv
ofs_plat_afu.sv
: this is the platform specific top-level that wraps the top-level generated by Fletcher
vhdl
Sum.vhd
: this is the sum kernel, taken (without modification) from the Fletcher project.
generate-input.py
: an example python script to generate an Arrow recordbatch file with some numbers that the accelerator will add.sources.txt
: a list of sources that are used by the tools to discover the required files.sum.json
: contains information about the accelerator that is used by the tools. Theaccelerator-type-uuid
is used by the host application for discovery.sum.mmio.yml
: a customvhdmmio
input file. Needed because currently Fletchgen does not support generating compatible MMIO files for this platform.
The first step is to use fletchgen
to generate the required hardware to wrap the sum kernel.
Start by starting a new container from the root of the example.
cd fletcher-opae/examples/sum/
docker run -it --rm -v `pwd`:/src ias:1.2.1
Generate an input recordbatch file using the provided generate-input.py
Python script.
python3 generate-input.py
This script generates the example.rb
file.
Then run Fletchgen on the mounted source folder.
cd /src/hw
fletchgen -n Sum -r example.rb -l vhdl --mmio64 --mmio-offset 64 --axi
Because Fletchgen currently does not support generating MMIO files for this platform run vhdmmio
on the provided MMIO yaml file.
vhdmmio -V vhdl -P vhdl sum.mmio.yml
You can now exit
the container and inspect the generated files.