2021-02-06 18:46:56 -06:00
.. _tutorial_compile:
2020-03-09 18:40:33 -05:00
2023-02-03 17:22:38 -06:00
Installation
------------
Compiling Source
~~~~~~~~~~~~~~~~
2020-03-09 14:58:24 -05:00
2021-02-07 11:35:20 -06:00
.. note :: We recommend you to watch a tutorial `video <https://youtu.be/F9sMRmDewM0> `_ about how-to-compile before getting started
2021-02-06 20:45:41 -06:00
2021-02-07 11:35:20 -06:00
.. only :: html
.. youtube :: F9sMRmDewM0
2021-02-06 18:16:15 -06:00
2022-12-06 16:07:29 -06:00
Supported Operating Systems
2023-02-03 17:22:38 -06:00
^^^^^^^^^^^^^^^^^^^^^^^^^^^
2022-12-06 16:07:29 -06:00
2023-02-03 17:22:38 -06:00
OpenFPGA is continously tested with Ubuntu 20.04 and partially on Ubuntu 22.04
2022-12-06 16:07:29 -06:00
It might work with earlier versions and other distributions.
In addition to continous integration, our community users have tested OpenFPGA on their local machines using the following operating systems:
- CentOS 7.8
- CentOS 8
- Ubuntu 18.04
- Ubuntu 21.04
2022-12-28 14:36:51 -06:00
- Ubuntu 22.04
2022-12-06 16:07:29 -06:00
Build Steps
2023-02-03 17:22:38 -06:00
^^^^^^^^^^^
2021-04-24 03:31:52 -05:00
OpenFPGA uses CMake to generate the Makefile scripts.
2020-03-09 14:58:24 -05:00
In general, please follow the steps to compile
2020-05-25 01:31:01 -05:00
.. code-block :: shell
2020-03-09 14:58:24 -05:00
git clone https://github.com/LNIS-Projects/OpenFPGA.git
cd OpenFPGA
2020-12-13 23:04:10 -06:00
make all
2020-03-09 14:58:24 -05:00
2022-12-06 16:07:29 -06:00
.. note :: OpenFPGA requires gcc/g++ version > 7 and clang version > 6.
2020-03-09 14:58:24 -05:00
.. note :: cmake3.12+ is recommended to compile OpenFPGA with GUI
2021-06-16 15:00:31 -05:00
.. note :: Recommend using `` make -j<int> `` to accelerate the compilation, where `` <int> `` denotes the number of cores to be used in compilation.
2020-03-09 14:58:24 -05:00
2022-12-06 16:07:29 -06:00
.. note :: VPR's GUI requires gtk-3, and can be enabled with `` make .. CMAKE_FLAGS="-DVPR_USE_EZGL=on" ``
2020-10-05 15:27:08 -05:00
2020-05-24 19:22:45 -05:00
**Quick Compilation Verification**
2022-07-21 19:52:21 -05:00
.. note :: Ensure that you install python dependences in :ref: `tutorial_compile_dependencies` .
2021-06-14 15:51:19 -05:00
To quickly verify the tool is well compiled, users can run the following command from OpenFPGA root repository
2020-03-09 14:58:24 -05:00
2020-05-25 01:31:01 -05:00
.. code-block :: shell
2020-03-09 14:58:24 -05:00
python3 openfpga_flow/scripts/run_fpga_task.py compilation_verification --debug --show_thread_logs
2022-09-26 18:22:40 -05:00
.. _tutorial_compile_build_options:
Build Options
2023-02-03 17:22:38 -06:00
^^^^^^^^^^^^^
2022-09-26 18:22:40 -05:00
General build targets are available in the top-level makefile. Call help desk to see details
.. code-block :: shell
make help
The following options are available for a custom build
.. option :: BUILD_TYPE=<string>
Specify the type of build. Can be either `` release `` or `` debug `` . By default, release mode is selected (full optimization on runtime)
.. option :: CMAKE_FLAGS=<string>
Force build flags to CMake. The following flags are available
- `` DOPENFPGA_WITH_TEST=[ON|OFF] `` : Enable/Disable the test build
- `` DOPENFPGA_WITH_YOSYS=[ON|OFF] `` : Enable/Disable the build of yosys. Note that when disabled, the build of yosys-plugin is also disabled
- `` DOPENFPGA_WITH_YOSYS_PLUGIN=[ON|OFF] `` : Enable/Disable the build of yosys-plugin.
2022-12-06 16:07:29 -06:00
- `` DOPENFPGA_WITH_VERSION=[ON|OFF] `` : Enable/Disable the build of version number. When disabled, version number will be displayed as an empty string.
- `` DOPENFPGA_WITH_SWIG=[ON|OFF] `` : Enable/Disable the build of SWIG, which is required for integrating to high-level interface.
2023-01-31 14:57:02 -06:00
- `` OPENFPGA_ENABLE_STRICT_COMPILE=[ON|OFF] `` : Specifies whether compiler warnings should be treated as errors (e.g. -Werror)
2022-09-26 18:22:40 -05:00
2023-02-03 17:22:38 -06:00
.. warning :: By default, only required modules in *Verilog-to-Routing* (VTR) is enabled. On other words, `` abc `` , `` odin `` , `` yosys `` and other add-ons inside VTR are not built. If you want to enable them, please look into the dedicated options of CMake scripts.
2022-09-26 18:22:40 -05:00
2022-12-30 13:00:17 -06:00
.. option :: CMAKE_GOALS=<string>
2023-02-03 17:22:38 -06:00
Specify the build target for CMake system. For example, `` cmake_goals=openfpga `` indicates that only openfpga binary will be compiled. For a detailed list of targets, use `` make list_cmake_targets `` to show. By default, all the build targets will be included.
2022-12-30 13:00:17 -06:00
2022-07-21 19:52:21 -05:00
.. _tutorial_compile_dependencies:
2020-03-09 14:58:24 -05:00
Dependencies
2023-02-03 17:22:38 -06:00
^^^^^^^^^^^^
2022-12-28 14:36:51 -06:00
Dependencies can be installed upon the use of OpenFPGA on different systems
In general, OpenFPGA requires specific versions for the following dependencies:
2020-03-09 14:58:24 -05:00
:cmake:
version >3.12 for graphical interface
:iverilog:
2022-12-06 16:07:29 -06:00
version 10.3+ is required to run Verilog-to-Verification flow
2023-02-03 17:22:38 -06:00
2022-12-28 14:36:51 -06:00
Ubuntu 20.04
^^^^^^^^^^^^
- Dependencies required to build the code base
.. include :: ubuntu20p04_dependencies.sh
:code: shell
- Dependencies required to run regression tests
.. include :: regtest_dependencies.sh
:code: shell
2023-02-03 17:22:38 -06:00
2022-12-28 20:46:10 -06:00
.. note :: Python packages are also required
2023-02-03 17:22:38 -06:00
2022-07-21 19:52:21 -05:00
.. code-block ::
2021-08-17 11:18:51 -05:00
python3 -m pip install -r requirements.txt
2020-03-09 14:58:24 -05:00
2022-12-28 14:36:51 -06:00
- Dependencies required to build documentation
.. include :: doc_dependencies.sh
:code: shell
Ubuntu 22.04
^^^^^^^^^^^^
- Dependencies required to build the code base
.. include :: ubuntu22p04_dependencies.sh
:code: shell
- Dependencies required to run regression tests
.. include :: regtest_dependencies.sh
:code: shell
2023-02-03 17:22:38 -06:00
2022-12-28 20:46:10 -06:00
.. note :: Python packages are also required
2023-02-03 17:22:38 -06:00
2022-12-28 14:36:51 -06:00
.. code-block ::
python3 -m pip install -r requirements.txt
- Dependencies required to build documentation
.. include :: doc_dependencies.sh
:code: shell
2020-03-09 14:58:24 -05:00
2023-02-03 17:22:38 -06:00
Running Docker Image
~~~~~~~~~~~~~~~~~~~~
2020-03-09 14:58:24 -05:00
2021-06-14 15:51:19 -05:00
Users can skip the traditional installation process by using the Dockerized version
2023-02-03 17:22:38 -06:00
of the OpenFPGA tool. T
he OpenFPGA project maintains the docker image/Github package of every commit pushed to the `master` branch.
You can find full list of avaialble packages
2021-02-08 00:33:25 -06:00
`openfpga-master <https://github.com/orgs/lnis-uofu/packages/container/package/openfpga-master> `_ .
2023-02-03 17:22:38 -06:00
To use most recent version please use :latest tag (as shown in the following source) or you can pin to specific version by using tag `ghcr.io/lnis-uofu/openfpga-master:v1.1.541` or to specific master commit using short first 8 characters of commit SHA `ghcr.io/lnis-uofu/openfpga-master:62ec82c1` .
This image contains precompiled OpenFPGA binaries with all prerequisites already installed.
2020-03-09 14:58:24 -05:00
2021-02-08 00:33:25 -06:00
.. code-block :: bash
2020-03-09 14:58:24 -05:00
2023-02-03 17:22:38 -06:00
# To get the docker image from the repository,
2022-05-08 14:03:16 -05:00
docker pull ghcr.io/lnis-uofu/openfpga-master:latest
2020-03-09 14:58:24 -05:00
2021-02-08 00:33:25 -06:00
# To invoke openfpga_shell
2022-05-08 14:03:16 -05:00
docker run -it ghcr.io/lnis-uofu/openfpga-master:latest openfpga/openfpga bash
2020-03-09 14:58:24 -05:00
2021-02-08 00:33:25 -06:00
# To run the task that already exists in the repository.
docker run -it ghcr.io/lnis-uofu/openfpga-master:latest bash -c "source openfpga.sh && run-task compilation_verification"
2020-03-09 14:58:24 -05:00
2022-05-08 14:03:16 -05:00
# To link the local directory wihth docker
mkdir work
docker run -it -v work:/opt/openfpga/ ghcr.io/lnis-uofu/openfpga-master:latest bash
2023-02-03 17:22:38 -06:00
# Inside container
2022-05-08 14:03:16 -05:00
source openfpga.sh
2023-02-03 17:22:38 -06:00
cd work
2022-05-08 14:03:16 -05:00
create_task _my_task yosys_vpr
2020-03-09 14:58:24 -05:00
2023-02-03 17:22:38 -06:00
Running on Binder
~~~~~~~~~~~~~~~~~
If user want to quickly evaluate the OpenFPGA functionality without any local installation, you can use the Binder service to quickly provision a low-end compute unit with docker and visual studio code.
Please click the following link to launch the Binder instance.
.. image :: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/lnis-uofu/OpenFPGA/master?urlpath=vscode
.. note :: The storage on Binder session is not permanent and the session is completely removed if inactive. Make sure yopu download or commit files if there are any important changes.