2020-04-28 07:28:12 -04:00
# SymbiFlow examples
2020-06-09 15:51:04 -04:00
This repository provides example FPGA designs that can be built using the SymbiFlow open source toolchain.
2020-06-09 17:16:40 -04:00
The examples target the Xilinx Artix-7 and the QuickLogic EOS S3 devices.
2020-04-28 07:28:12 -04:00
The repository includes:
2020-06-09 15:51:04 -04:00
* [examples ](./examples ) - Example FPGA designs including:
2020-04-28 07:28:12 -04:00
* Verilog code
* Pin constraints files
* Timing constraints files
2020-05-21 09:26:07 -04:00
* Makefiles for running the SymbiFlow toolchain
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
* [.travis.yml ](.travis.yml ) - Travis CI configuration file
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
## Toolchain installation
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
This section describes how to install the toolchain. This procedure is divided in two steps:
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
- Installing the Conda package manager
- Downloading the architecture definitions and installing the toolchain
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
1. Conda
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
```bash
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda_installer.sh
```
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
2. Toolchain
2020-04-28 07:28:12 -04:00
2020-06-09 15:51:04 -04:00
For the Artix-7 devices:
2020-04-28 07:28:12 -04:00
```bash
2020-06-09 15:51:04 -04:00
INSTALL_DIR="/opt/symbiflow/xc7"
bash conda_installer.sh -b -p $INSTALL_DIR/conda & & rm conda_installer.sh
source "$INSTALL_DIR/conda/etc/profile.d/conda.sh"
2020-06-22 03:19:21 -04:00
conda env create -f examples/xc7/environment.yml
2020-06-12 06:58:33 -04:00
conda activate xc7
2020-07-15 04:46:24 -04:00
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/477/20200714-082108/symbiflow-arch-defs-install-8eb88e76.tar.xz | tar -xJ --one-top-level=$INSTALL_DIR/install
2020-05-21 09:26:07 -04:00
conda deactivate
```
2020-06-09 17:16:40 -04:00
For the EOS S3 devices:
```bash
2020-07-13 08:44:55 -04:00
export INSTALL_DIR="/opt/symbiflow/eos-s3"
2020-07-16 15:47:22 -04:00
wget 'https://github.com/QuickLogic-Corp/quicklogic-fpga-toolchain/releases/download/v1.1.0/Symbiflow_v1.1.0.gz.run'
2020-07-13 08:44:55 -04:00
bash Symbiflow_v1.1.0.gz.run
2020-06-09 17:16:40 -04:00
```
2020-05-21 09:26:07 -04:00
## Build Example Designs
With the toolchain installed, you can build the example designs.
The example designs are provided in separate directories:
2020-06-09 15:51:04 -04:00
* `examples/xc7` directory for the Artix-7 devices
2020-06-09 17:16:40 -04:00
* `examples/eos-s3` directory for the EOS S3 devices
2020-06-09 15:51:04 -04:00
### Example designs for the Artix-7 devices:
2020-06-09 17:16:40 -04:00
1. `counter` - simple 4-bit counter driving LEDs. The design targets the [Basys3 board ](https://store.digilentinc.com/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users/ ) and the [Arty board ](https://store.digilentinc.com/arty-a7-artix-7-fpga-development-board-for-makers-and-hobbyists/ ).
2020-05-21 09:26:07 -04:00
1. `picosoc` - [picorv32 ](https://github.com/cliffordwolf/picorv32 ) based SoC. The design targets the [Basys3 board ](https://store.digilentinc.com/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users/ ).
1. `linux_litex` - [LiteX ](https://github.com/enjoy-digital/litex ) based system with Linux capable [VexRiscv core ](https://github.com/SpinalHDL/VexRiscv ). The design includes [DDR ](https://github.com/enjoy-digital/litedram ) and [Ethernet ](https://github.com/enjoy-digital/liteeth ) controllers. The design targets the [Arty board ](https://store.digilentinc.com/arty-a7-artix-7-fpga-development-board-for-makers-and-hobbyists/ ).
2020-06-09 15:51:04 -04:00
The Linux images for the `linux_litex` example can be built following the [linux on litex vexriscv ](https://github.com/litex-hub/linux-on-litex-vexriscv ) instructions.
2020-05-21 09:26:07 -04:00
The `linux_litex` example is already provided with working Linux images.
2020-06-09 15:51:04 -04:00
To build the examples, run the following commands:
2020-05-21 09:26:07 -04:00
```bash
2020-06-09 15:51:04 -04:00
export INSTALL_DIR="/opt/symbiflow/xc7"
2020-05-21 09:26:07 -04:00
# adding symbiflow toolchain binaries to PATH
2020-06-09 15:51:04 -04:00
export PATH="$INSTALL_DIR/install/bin:$PATH"
source "$INSTALL_DIR/conda/etc/profile.d/conda.sh"
2020-06-12 06:58:33 -04:00
conda activate xc7
2020-05-27 03:43:43 -04:00
git clone https://github.com/SymbiFlow/symbiflow-examples & & cd symbiflow-examples
2020-04-28 07:28:12 -04:00
# counter example
2020-07-15 08:27:45 -04:00
pushd examples/xc7/counter_test & & TARGET="arty_50" make & & popd
pushd examples/xc7/counter_test & & TARGET="arty_100" make & & popd
2020-06-10 04:06:34 -04:00
pushd examples/xc7/counter_test & & make clean & & TARGET="basys3" make & & popd
2020-04-28 07:28:12 -04:00
# picosoc example
2020-06-09 15:51:04 -04:00
pushd examples/xc7/picosoc_demo & & make & & popd
2020-04-28 07:28:12 -04:00
# litex example
2020-06-12 06:24:24 -04:00
wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
chmod +x litex_setup.py
./litex_setup.py init
./litex_setup.py install
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz
tar -xf riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz
export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/
pushd litex/litex/boards/targets & & ./arty.py --toolchain symbiflow --cpu-type vexriscv --build & & popd
# linux litex example
2020-06-09 15:51:04 -04:00
pushd examples/xc7/linux_litex_demo & & make & & popd
2020-04-28 07:28:12 -04:00
```
2020-06-09 17:16:40 -04:00
### Example design for the EOS S3 devices:
1. `btn_counter` - simple 4-bit counter driving LEDs. The design targets the [EOS S3 FPGA ](https://www.quicklogic.com/products/eos-s3/ ).
To build the example, run the following commands:
```bash
export INSTALL_DIR="/opt/symbiflow/eos-s3"
2020-07-13 08:44:55 -04:00
export PATH="$INSTALL_DIR/install/bin:$INSTALL_DIR/install/bin/python:$PATH"
2020-06-09 17:16:40 -04:00
source "$INSTALL_DIR/conda/etc/profile.d/conda.sh"
2020-07-13 08:44:55 -04:00
conda activate
2020-06-09 17:16:40 -04:00
git clone https://github.com/SymbiFlow/symbiflow-examples & & cd symbiflow-examples
pushd examples/eos-s3 & & make & & popd
```