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
primmap.vhd
: this is the primmap kernel. It adds one to all elements of the input batch and writes the result to the output batch.
generate.py
: an example python script to generate an Arrow recordbatch file with some numbers that the accelerator will add and the output schema.sources.txt
: a list of sources that are used by the tools to discover the required files.primmap.json
: contains information about the accelerator that is used by the tools. Theaccelerator-type-uuid
is used by the host application for discovery.primmap.mmio.yml
: a customvhdmmio
input file. Needed because currently Fletchgen does not support generating compatible MMIO files for this platform.primmap.ext.yml
: a set of custom signals that are added to the design by fletchgen.
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/primmap/
docker run -it --rm -v `pwd`:/src ias:1.2.1
Generate an input recordbatch file and the output schema using the provided generate.py
Python script.
python3 generate.py
This script generates the in.rb
and out.as
files.
Then run Fletchgen on the mounted source folder.
cd /src/hw
fletchgen -n primmap -r in.rb -i out.as -l vhdl --mmio64 --mmio-offset 64 -e primmap.ext.yml --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 primmap.mmio.yml
You can now exit
the container and inspect the generated files.