2022-02-13 15:35:16 -05:00
.. _Getting:
2022-02-18 12:15:44 -05:00
Getting F4PGA
2022-02-13 15:35:16 -05:00
#############
2020-12-08 07:11:13 -05:00
2022-02-18 12:15:44 -05:00
This section describes how to install F4PGA and set up a fully working
2021-01-09 15:09:46 -05:00
environment to later build example designs.
2020-12-08 07:11:13 -05:00
Prerequisites
2022-02-13 15:35:16 -05:00
=============
2020-12-08 07:11:13 -05:00
To be able to follow through this tutorial, install the following software:
.. tabs ::
.. group-tab :: Ubuntu
.. code-block :: bash
:name: install-reqs-ubuntu
2020-12-10 08:48:18 -05:00
apt update -y
apt install -y git wget xz-utils
2020-12-08 07:11:13 -05:00
2020-12-11 07:07:14 -05:00
.. group-tab :: Debian
.. code-block :: bash
:name: install-reqs-debian
apt update -y
apt install -y git wget xz-utils
2020-12-08 07:11:13 -05:00
.. group-tab :: CentOS
.. code-block :: bash
:name: install-reqs-centos
2020-12-10 08:48:18 -05:00
yum update -y
yum install -y git wget which xz
2020-12-08 07:11:13 -05:00
2021-12-14 17:35:14 -05:00
.. group-tab :: Fedora
.. code-block :: bash
:name: install-reqs-fedora
dnf install -y findutils git wget which xz
2020-12-08 07:11:13 -05:00
2022-02-18 12:15:44 -05:00
Next, clone the F4PGA examples repository and enter it:
2020-12-08 07:11:13 -05:00
.. code-block :: bash
2022-02-18 12:15:44 -05:00
:name: get-f4pga
2020-12-08 07:11:13 -05:00
2022-03-01 14:43:43 -05:00
git clone https://github.com/chipsalliance/f4pga-examples
2022-02-18 12:15:44 -05:00
cd f4pga-examples
2020-12-08 07:11:13 -05:00
Toolchain installation
2022-02-13 15:35:16 -05:00
======================
2020-12-08 07:11:13 -05:00
2022-02-18 12:15:44 -05:00
Now we are able to install the F4PGA toolchain. This procedure is divided
2020-12-08 07:11:13 -05:00
into three steps:
- installing the Conda package manager,
- choosing an installation directory,
- downloading the architecture definitions and installing the toolchain.
Conda
2022-02-13 15:35:16 -05:00
-----
2020-12-08 07:11:13 -05:00
2022-02-18 12:15:44 -05:00
Download Conda installer script into the f4pga-examples directory:
2020-12-08 07:11:13 -05:00
.. code-block :: bash
:name: wget-conda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda_installer.sh
Choose the install directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The install directory can either be in your home directory
2022-02-18 12:15:44 -05:00
such as `` ~/opt/f4pga `` or in a system directory such as `` /opt/f4pga `` .
2020-12-08 07:11:13 -05:00
If you choose a system directory, you will need root permission to perform the installation,
and so you will need to add some `` sudo `` commands to the instructions below.
.. code-block :: bash
:name: conda-install-dir
2022-05-26 05:42:34 -04:00
export F4PGA_INSTALL_DIR=~/opt/f4pga
2020-12-08 07:11:13 -05:00
2022-02-13 15:35:16 -05:00
Setup and download assets
~~~~~~~~~~~~~~~~~~~~~~~~~
2020-12-08 07:11:13 -05:00
Select your target FPGA family:
.. tabs ::
.. group-tab :: Artix-7
.. code-block :: bash
:name: fpga-fam-xc7
export FPGA_FAM=xc7
.. group-tab :: EOS S3
.. code-block :: bash
:name: fpga-fam-eos-s3
export FPGA_FAM=eos-s3
2021-01-09 15:09:46 -05:00
Next, setup Conda and your system's environment:
2020-12-08 07:11:13 -05:00
.. code-block :: bash
:name: conda-setup
2022-05-26 05:42:34 -04:00
bash conda_installer.sh -u -b -p $F4PGA_INSTALL_DIR/$FPGA_FAM/conda;
source "$F4PGA_INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh";
2020-12-08 07:11:13 -05:00
conda env create -f $FPGA_FAM/environment.yml
Download architecture definitions:
.. tabs ::
.. group-tab :: Artix-7
2022-05-20 14:03:28 -04:00
.. NOTE ::
The `` *-install-* `` package is required regardless of the target device, but you can avoid installing the
`` *-xc7*_test-* `` packages for architectures that you don't need.
2020-12-08 07:11:13 -05:00
.. code-block :: bash
:name: download-arch-def-xc7
2022-05-26 05:42:34 -04:00
mkdir -p $F4PGA_INSTALL_DIR/xc7/install
2022-03-24 06:45:46 -04:00
2022-07-18 09:04:51 -04:00
F4PGA_TIMESTAMP='20220714-173445'
F4PGA_HASH='f7afc12'
2022-05-24 09:16:52 -04:00
2022-05-19 05:23:04 -04:00
for PKG in install xc7a50t_test xc7a100t_test xc7a200t_test xc7z010_test; do
2022-05-26 05:42:34 -04:00
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/${F4PGA_TIMESTAMP}/symbiflow-arch-defs-${PKG}-${F4PGA_HASH}.tar.xz | tar -xJC $F4PGA_INSTALL_DIR/${FPGA_FAM}/install
2022-05-18 21:03:26 -04:00
done
2020-12-08 07:11:13 -05:00
.. group-tab :: EOS-S3
.. code-block :: bash
:name: download-arch-def-eos-s3
2022-06-07 08:53:04 -04:00
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs-install/quicklogic-arch-defs-qlf-fc5d8da.tar.gz | tar -xzC $F4PGA_INSTALL_DIR/$FPGA_FAM/
2020-12-08 07:11:13 -05:00
2021-01-09 15:09:46 -05:00
If the above commands exited without errors, you have successfully installed and configured your working environment.
2020-12-08 07:11:13 -05:00
2022-02-13 15:32:15 -05:00
.. IMPORTANT ::
With the toolchain installed, you are ready to build the example designs!
Examples are provided in separated directories:
2020-12-08 07:11:13 -05:00
2022-02-13 15:32:15 -05:00
* Subdir :ghsrc: `xc7` for the Artix-7 devices
* Subdir :ghsrc: `eos-s3` for the EOS S3 devices
2022-06-29 04:32:36 -04:00
Bumping specific tools
======================
Sometimes it may be preferable to get the latest versions of the tools even before the full Toolchain is validated and upgraded.
These tools **are not guaranteered to be bug free** , but they enable users to take advantage of the latest fixes available.
Updating Yosys SystemVerilog plugin
-----------------------------------
.. Warning ::
The expected usage of the plugin by using the `` read_systemverilog `` command (used by default in F4PGA flow) should work.
When using the plugin by calling `` read_uhdm `` command, take additional care to use the same Surelog and UHDM version for creating and reading the UHDM file - updating only the plugin can create a mismatch in this case.
Make sure `` curl `` , `` jq `` , `` tar `` and `` wget `` are installed (used to automatically download newest version):
.. code-block :: bash
:name: activate-xc7
apt install curl jq tar wget
Activate the conda repository for the correct family:
.. code-block :: bash
:name: activate-xc7
conda activate xc7
Obtain the latest release of the plugin from `here <https://github.com/antmicro/yosys-uhdm-plugin-integration/releases> `_ :
.. code-block :: bash
:name: get-plugin
curl https://api.github.com/repos/antmicro/yosys-uhdm-plugin-integration/releases/latest | jq .assets[1] | grep "browser_download_url" | grep -Eo 'https://[^\"]*' | xargs wget -O - | tar -xz
Install the plugin using provided installation script.
It will use the `` yosys-config `` from conda, so it will install into the conda environment.
.. code-block :: bash
:name: install-plugin
./install-plugin.sh