Fletchgen
The Fletcher Design Generator
|
Fletchgen is a command-line utility that generates the upper layers of a hardware design, including simulation and platform-specific top-levels, based on Arrow Schemas and Recordbatches.
This can also be shown schematically as follows:
Fletchgen does not generate the kernel itself.
It currently supports only two top-level platforms.
--sim
flag.--axi
flag.Fletchgen is under heavy development, so for now we'd recommend to make a debug build using CMake as follows:
An example how to use Fletchgen can be found here.
A very gentle tutorial / introduction to Fletcher including how to use Fletchgen and how to generate input files for Fletchgen can be found here.
Fletchgen derives how to use an Arrow Schema from attached key-value metadata that is stored in Arrow Schemas. You can use this to, for example, prevent the generation of hardware structures for fields that you're not going to use in your kernel implementation.
Key | Possible values | Default | Description |
---|---|---|---|
fletcher_name | any string | none | The name of the schema. This is required for the schema to be identifiable after hardware generation. |
fletcher_mode | read / write | read | Determines whether a RecordBatch of this schema will be read or written by the kernel. |
fletcher_bus_spec | aw,dw,lw,bs,bm | 64,512,8,1,16 | Key to set the bus specification of the RecordBatchReader/Writer resulting from this schema. aw: address width, dw: data width, lw: burst length width, bs: minimum burst size, bm: maximum burst size. |
Key | Possible values | Default | Description |
---|---|---|---|
fletcher_ignore | true / false | false | If set to true, ignore a specific schema field, preventing generation of hardware to read/write from/to it. |
fletcher_epc | 1 / 2 / 4 / ... | 1 | Number of elements per cycle for this field. For List<X> fields where X is a fixed-width type, this applies to the values stream. |
fletcher_lepc | 1 / 2 / 4 / ... | 1 | For List<primitive> fields only. Number of elements per cycle on the length stream. |
fletcher_profile | true / false | false | If set to true, mark this field for profiling. The hardware streams resulting from this field will have a profiler attached to them. |
fletcher_tag_width | 1 / 2 / 3 / ... | 1 | Width of the tag field of commands and unlock streams of RecordBatchReaders/Writers. Can be used to identify commands. |
You can add custom MMIO registers to your kernel using --reg
. More information can be found here.
Sometimes, your kernel requires other I/O signals than just Arrow data streams in and out, and MMIO registers. There may be some other type of data source or sink in your design, there may be some platform-specific things you want to use, or etcetera.
You can supply Fletchgen with a YAML file describing what signals you want to draw between the kernel and the top-level. An example is shown below, where we want to handshake completion from the platform top-level with a req
and ack
bit.
This will result in the following signals appearing at the top-level:
std_logic_vector
instead of std_logic
by using:You can generate a simulation top level and provide a Flatbuffer file with a RecordBatch to the simulation environment. You can use this to debug your designs in simulation, independent of an FPGA platform specific simulation environment. An example is shown here..