Installation

Warning

The following instructions are a work-in-progress and may not be entirely up to date.

System requirements

Torii requires Python >= 3.9, and Yosys >= 0.20. Torii has been tested with CPython, but might possibly run under PyPy.

Simulating Torii code requires no additional software. However, a waveform viewer like GTKWave is invaluable for debugging.

Synthesizing, placing and routing an Torii design for an FPGA requires the FPGA family specific toolchain. See the platform specific documentation for more information regarding vendor toolchains.

Installing Prerequisites

Prior to installing Torii, you must install all of its prerequisites and requirements.

Installing Python

First off, install python and pip onto your system if the’re not there already.

Arch Linux

$ sudo pacman -S python python-pip

Other Linux

Warning

These instructions may be incorrect or incomplete!

For Debian based systems, use apt to install python3 and python3-pip

$ sudo apt install python3 python3-pip

For Fedora and other dnf based systems,

$ sudo dnf install python3 python3-pip

macOS

Install Homebrew if not done already, then install the requirements.

$ brew install python

Windows

Warning

These instructions may be incorrect or incomplete!

Download the latest Python installer from the python downloads page.

Follow the instructions and ensure that the installer installs pip and puts the python executable in your %PATH%

Installing Yosys and GTKWave

Arch Linux

On Arch Linux and Arch-likes, you can install nightly Yosys packages which are located in the AUR with an AUR helper or using makepkg directly.

Via an AUR helper like yay

$ yay -S yosys-nightly

Via makepkg directly

$ git clone https://aur.archlinux.org/yosys-nightly.git
$ (cd yosys-nightly && makepkg -sic)

And to install GTKWave you can just install it like any normal package

$ pacman -S gtkwave

Other Linux

Warning

These instructions may be incorrect or incomplete!

With other Linux distributions, it is recommended to use the OSS Cad Suite nightly build. It provides a full environment of all the tools needed built on a nightly basis. This includes Yosys and GTKWave

Simply download the latest release for your architecture, extract it to a good home, and then add it to your $PATH

$ curl -LOJ https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2022-04-26/oss-cad-suite-linux-x64-20220426.tgz
$ tar xfv oss-cad-suite-linux-x64-20220426.tgz
$ export PATH="`pwd`/oss-cad-suite/bin:$PATH"

macOS

For macOS systems, it is recommended to use the YoWASP distribution of the toolchain. However if you want to use the native tools, and you are using an Intel based Mac, then the OSS Cad Suite has nightly builds for x86_64 versions of Darwin. This includes Yosys and GTKWave

Simply download the latest release for your architecture, extract it to a good home, and then add it to your $PATH

$ curl -LOJ https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2022-04-26/oss-cad-suite-darwin-x64-20220426.tgz
$ tar xfv oss-cad-suite-darwin-x64-20220426.tgz
$ export PATH="`pwd`/oss-cad-suite/bin:$PATH"

Windows

Warning

These instructions may be incorrect or incomplete!

The OSS Cad Suite has nightly builds for x86_64 versions of Windows. This includes Yosys and GTKWave

Simply download the latest release for your architecture, extract it to a good home, and then add it to your %PATH%

$ call %cd%\oss-cad-suite\environment.bat

Installing Torii

The latest release of Torii is recommended for any new projects planning to use Torii. It provides the most up-to-date stable version of the API. However, if needed, you can also install a development snapshot to get access to the bleeding-edge, however the API may be unstable.

Latest release

Linux

$ pip3 install --user --upgrade torii

macOS

$ pip install --user --upgrade torii

Windows

> pip install --upgrade torii

Development snapshot

Linux

$ pip3 install --user 'torii @ git+https://github.com/shrine-maiden-heavy-industries/torii-hdl.git'

macOS

$ pip install --user 'torii @ git+https://github.com/shrine-maiden-heavy-industries/torii-hdl.git'

Windows

> pip install "torii @ git+https://github.com/shrine-maiden-heavy-industries/torii-hdl.git"

Editable development snapshot

Linux

To install an editable development snapshot of Torii for the first time, run:

$ git clone https://github.com/shrine-maiden-heavy-industries/torii-hdl
$ cd torii-hdl
$ pip3 install --user --editable '.'

Any changes made to the torii-hdl directory will immediately affect any code that uses Torii. To update the snapshot, run:

$ cd torii-hdl
$ git pull --ff-only origin main
$ pip3 install --user --editable '.'

Run the pip3 install --editable . command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using Torii may misbehave or crash with an ImportError.

macOS

To install an editable development snapshot of Torii for the first time, run:

$ git clone https://github.com/shrine-maiden-heavy-industries/torii-hdl
$ cd torii-hdl
$ pip install --user --editable '.'

Any changes made to the torii-hdl directory will immediately affect any code that uses Torii. To update the snapshot, run:

$ cd torii-hdl
$ git pull --ff-only origin main
$ pip install --user --editable '.'

Run the pip install --editable . command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using Torii may misbehave or crash with an ImportError.

Windows

To install an editable development snapshot of Torii for the first time, run:

> git clone https://github.com/shrine-maiden-heavy-industries/torii-hdl
> cd torii-hdl
> pip install --editable .

Any changes made to the torii-hdl directory will immediately affect any code that uses Torii. To update the snapshot, run:

> cd torii-hdl
> git pull --ff-only origin main
> pip install --editable .

Run the pip install --editable . command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using Torii may misbehave or crash with an ImportError.

Installing board definitions

This section assumes you have already installed Torii to your system.

Installing the Torii Development Board definitions is much the same as installing Torii.

Latest release

Linux

$ pip3 install --user --upgrade torii-boards

macOS

$ pip install --user --upgrade torii-boards

Windows

> pip install --upgrade torii-boards

Development snapshot

Linux

$ pip3 install --user 'git+https://github.com/shrine-maiden-heavy-industries/torii-boards.git#egg=torii-boards'

macOS

$ pip install --user 'git+https://github.com/shrine-maiden-heavy-industries/torii-boards.git#egg=torii-boards'

Windows

> pip install git+https://github.com/shrine-maiden-heavy-industries/torii-boards.git#egg=torii-boards

Editable development snapshot

Linux

To install an editable development snapshot of torii-boards for the first time, run:

$ git clone https://github.com/shrine-maiden-heavy-industries/torii-boards
$ cd torii-boards
$ pip3 install --user --editable '.'

Any changes made to the torii-boards directory will immediately affect any code that uses Torii. To update the snapshot, run:

$ cd torii-boards
$ git pull --ff-only origin main
$ pip3 install --user --editable '.'

Run the pip3 install --editable . command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using Torii may misbehave or crash with an ImportError.

macOS

To install an editable development snapshot of torii-boards for the first time, run:

$ git clone https://github.com/shrine-maiden-heavy-industries/torii-boards
$ cd torii-boards
$ pip install --user --editable '.'

Any changes made to the torii-boards directory will immediately affect any code that uses Torii. To update the snapshot, run:

$ cd torii-boards
$ git pull --ff-only origin main
$ pip install --user --editable '.'

Run the pip install --editable . command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using Torii may misbehave or crash with an ImportError.

Windows

To install an editable development snapshot of torii-boards for the first time, run:

> git clone https://github.com/shrine-maiden-heavy-industries/torii-boards
> cd torii-boards
> pip install --editable .

Any changes made to the torii-boards directory will immediately affect any code that uses Torii. To update the snapshot, run:

> cd torii-boards
> git pull --ff-only origin main
> pip install --editable .

Run the pip install --editable . command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using Torii may misbehave or crash with an ImportError.