Skip to content
Ryan Johnson edited this page Aug 18, 2020 · 6 revisions

fpgaperf.py

fpgaperf.py takes a project, a board, and a toolchain as arguments, and uses the specified toolchain the generate a bitstream for the specified project. At the end of the bitstream generation, it prints the stats of the run, including runtimes, clock information, and resource utilization.

Below is an example output of the blinky project, using the vivado toolchain and the arty board:

$ python3 fpgaperf.py --toolchain vivado --project blinky --board arty
Writing to build/blinky_vivado_xc7_a35tcsg324-1_arty_xdc_carry-n

===============================
Setting
===============================

+-----------+-------------------------------------------------+
| Settings  | Value                                           |
+-----------+-------------------------------------------------+
| Design    | blinky_vivado_xc7_a35tcsg324-1_arty_xdc_carry-n |
| Family    | xc7                                             |
| Device    | a35t                                            |
| Package   | csg324-1                                        |
| Project   | blinky                                          |
| Toolchain | vivado                                          |
| Strategy  | None                                            |
| Carry     | False                                           |
| Seed      | default                                         |
+-----------+-------------------------------------------------+

===============================
Clocks
===============================

+--------------+-------------+----------------+------+-----------------+----------------+
| Clock domain | Actual freq | Requested freq | Met? | Setup violation | Hold violation |
+--------------+-------------+----------------+------+-----------------+----------------+
| clk_i        | 481.696 MHz | 100.000 MHz    | True | 0.000 ns        | 0.000 ns       |
+--------------+-------------+----------------+------+-----------------+----------------+

===============================
Toolchain Run-Times
===============================

+--------------+--------------------+
| Stage        | Run Time (seconds) |
+--------------+--------------------+
| prepare      | 1.373              |
| synthesis    | 41.000             |
| optimization | 22.000             |
| packing      | N/A                |
| placement    | N/A                |
| routing      | 31.000             |
| fasm         | N/A                |
| checkpoint   | N/A                |
| bitstream    | 24.000             |
| reports      | N/A                |
| total        | 327.179            |
| nop          | 0.030              |
| fasm2bels    | N/A                |
+--------------+--------------------+

===============================
FPGA resource utilization
===============================

+----------+------+
| Resource | Used |
+----------+------+
| BRAM     | 0    |
| CARRY    | 6    |
| DFF      | 32   |
| GLB      | N/A  |
| IOB      | 13   |
| LUT      | 20   |
| PLL      | 0    |
+----------+------+

So, running fpgaperf.py is pretty simple, but there are a few arguments you can give it to change things about the run.


Basic Arguments

--board - Which board will be used

--toolchain - Which toolchain will be used

--project - Which project will be built

Ex:

python3 fpgaperf.py --project oneblink --board basys3 --toolchain vpr

Extra Arguments

These arguments enhance/modify the normal run.

--verbose - Turns on a logger that prints messages during the run to help with debugging.

--overwrite - Deletes the build folder before the run, so that it can be built again from scratch.

--params_file - Sets parameters for the specified toolchain.

--params_string - Sets parameters for the specified toolchain.

--strategy - Sets a strategy, which is passed to the toolchain.

--carry - Sets the preference to carry, if the toolchain has the option.

--no-carry - Sets the preference to no-carry, if the toolchain has the option.

--seed - Specifies a seed for the random factors of the run for vpr. If you want a better picture of a project's runtime and stats, you could try running the same project multiple times with different seeds and take the averages. However, --seed does not work with every toolchain. (see --list-seedable)


Other Arguments

These are arguments you can use to do something other than the normal run, and each is pretty straightforward:

--check-env - Iterates through each toolchain and checks the environment to see if the toolchain is correctly installed and ready to run. To check just one, specify the toolchain with the --toolchain argument.

--list-projects - Lists all projects as found in the projects directory.

--list-toolchains - Lists all toolchains.

--list-boards - Lists all boards as found in the boards.json file.

--list-combinations - Lists all possible project/toolchain/board combinations and indicates whether or not the combo is "Supported" or "Missing". This argument can be combined with --project, --toolchain, and/or --board to shorten the listed combinations.

--list-seedable - Lists the toolchains that are compatible with --seed.

Ex:

python3 fpgaperf.py --check-env --toolchain vivado-yosys
python3 fpgaperf.py --list-toolchains
python3 fpgaperf.py --list-projects
python3 fpgaperf.py --list-seedable

Directory Arguments

--out-prefix - This argument changes the folder to which you save the build details. The default is the build directory. But if you put --out-prefix other, then it will save the project files to the other directory. This is a great way to split up project runs into organized categories.

--out-dir - Instead of changing just the folder to place the directory in, this argument becomes the entire path from the fpga-tool-perf directory.

Ex:

python3 fpgaperf.py --toolchain vivado --project oneblink --board basys3 --out-dir practice_builds/first_run

The above command will save your project files to /fpga-tool-perf/practice_builds/first_run.

The projects are usually built within the build directory and the name of the folder within build is generated by all the settings of the run and ends up being very long. However, these settings are easily accessed, so it might be better to name the folders with shorter titles using the --out-dir, for easier navigating.


Build Arguments

The two commands below allow you to keep multiple copies of the same build and compare them to one another. This is especially helpful if you were to update one of the symbiflow tools and could then compare your old build to a new build under a different name.

--build_type - gives the project a name

--build - gives the project a number (really just another name).

Ex:

python3 fpgaperf.py --toolchain vivado --project oneblink --board basys3 --build_type justforfun --build 2

saves the directory under the name:

oneblink_vivado_xc7_a35tcpg236-1_basys3_justforfun_2_xdc_carry-n

To add a new project to the project directory, follow the instructions on the NewProjectInsertion wiki page.


Initially created by Ryan Johnson, August 2020.

Clone this wiki locally