2020-04-27 01:21:31 -06:00
Installation
############
2024-03-21 19:09:46 -06:00
.. _install-playground:
In-browser playground
=====================
You can try Amaranth out without installing anything by visiting the `Amaranth Playground`_. The playground webpage contains a `fully functional Python interpreter <Pyodide_> `_ and an Amaranth toolchain that can simulate a design, display waveforms, and generate Verilog code. It works on all modern browsers that support WebAssembly_, including Firefox, Chrome, and Edge.
.. _Amaranth Playground: https://amaranth-lang.org/play/
.. _Pyodide: https://pyodide.org/en/stable/
.. _WebAssembly: https://webassembly.org/
.. _install-sysreqs:
2020-04-27 01:21:31 -06:00
System requirements
===================
2024-03-21 18:57:48 -06:00
..
This version requirement needs to be synchronized with the one in pyproject.toml!
2024-04-10 15:48:12 -06:00
.. |yosys-version| replace :: 0.40 (or newer)
2021-12-11 01:52:14 -07:00
2023-06-07 08:04:23 -06:00
Amaranth HDL requires Python 3.8; it works on CPython_ 3.8 (or newer), and works faster on PyPy3.8_ 7.3.7 (or newer). Installation requires pip_ 23.0 (or newer).
2020-04-27 01:21:31 -06:00
2024-03-21 19:09:46 -06:00
For most workflows, Amaranth requires Yosys_ |yosys-version|. A `compatible version of Yosys <amaranth-yosys_> `_ is distributed via PyPI_ for most popular platforms, so it is usually not necessary to install Yosys separately.
2020-04-27 01:21:31 -06:00
2024-05-29 09:57:16 -06:00
Simulating Amaranth code requires no additional software. However, a waveform viewer like Surfer_ or GTKWave_ is invaluable for debugging. As an alternative, the `Amaranth Playground`_ can be used to display waveforms for simple designs.
2020-04-27 01:21:31 -06:00
2024-03-21 19:15:21 -06:00
Synthesizing, placing and routing an Amaranth design for an FPGA requires the FPGA family specific toolchain. The open source iCE40, ECP5, MachXO2/3, Nexus, and Gowin toolchains are distributed via PyPI_ for most popular platforms by the YoWASP_ project.
2020-04-27 01:21:31 -06:00
.. TODO: Link to FPGA family docs here
.. _CPython: https://www.python.org/
2023-06-07 08:04:23 -06:00
.. _PyPy3.8: https://www.pypy.org/
2024-02-15 12:35:21 -07:00
.. _pip: https://pip.pypa.io/en/stable/
2021-12-09 22:39:50 -07:00
.. _Yosys: https://yosyshq.net/yosys/
2024-03-21 19:09:46 -06:00
.. _amaranth-yosys: https://pypi.org/project/amaranth-yosys/
2020-06-30 21:32:17 -06:00
.. _PyPI: https://pypi.org/
2024-05-29 09:57:16 -06:00
.. _Surfer: https://surfer-project.org/
2024-02-15 12:35:21 -07:00
.. _GTKWave: https://gtkwave.sourceforge.net/
2024-03-21 19:15:21 -06:00
.. _YoWASP: https://yowasp.org/
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. _install-deps:
2020-04-27 01:21:31 -06:00
Installing prerequisites
========================
2020-06-30 22:11:51 -06:00
.. |builtin-yosys-architectures| replace :: x86_64 and AArch64
2023-02-16 15:09:14 -07:00
.. |upgrade-pip| replace :: Before continuing, make sure you have the latest version of pip_ installed by running:
2020-06-30 22:11:51 -06:00
2020-07-05 17:39:47 -06:00
.. platform-picker ::
2020-04-27 01:21:31 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: windows
2020-06-30 21:32:17 -06:00
:title: Windows
2020-04-27 01:21:31 -06:00
2020-07-01 00:33:03 -06:00
:ref: `Install Python <python:using-on-windows>` , either from Windows Store or using the full installer. If using the full installer, make sure to install a 64-bit version of Python.
2020-04-27 01:21:31 -06:00
2023-02-16 15:09:14 -07:00
|upgrade-pip|
.. code-block :: doscon
> pip install --upgrade pip
2020-07-05 17:39:47 -06:00
.. platform-choice :: macos
2020-06-30 21:32:17 -06:00
:title: macOS
2020-04-27 01:21:31 -06:00
2024-05-29 09:57:16 -06:00
Install Homebrew_. Then, install Python by running:
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. code-block :: console
2020-04-27 01:21:31 -06:00
2024-05-29 09:57:16 -06:00
$ brew install python
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. _Homebrew: https://brew.sh
2020-04-27 01:21:31 -06:00
2023-02-16 15:09:14 -07:00
|upgrade-pip|
.. code-block :: console
$ pip install --upgrade pip
2020-07-05 17:39:47 -06:00
.. platform-choice :: debian
:altname: linux
:title: Debian
2020-04-27 01:21:31 -06:00
2024-05-29 09:57:16 -06:00
Install Python by running:
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. code-block :: console
2020-04-27 01:21:31 -06:00
2024-05-29 09:57:16 -06:00
$ sudo apt-get install python3-pip
2020-04-27 01:21:31 -06:00
2020-06-30 22:11:51 -06:00
On architectures other than |builtin-yosys-architectures|, install Yosys by running:
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. code-block :: console
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
$ sudo apt-get install yosys
2020-04-27 01:21:31 -06:00
2021-12-11 01:52:14 -07:00
If Yosys |yosys-version| is not available, `build Yosys from source`_ .
2020-04-27 01:21:31 -06:00
2023-02-16 15:09:14 -07:00
|upgrade-pip|
.. code-block :: console
$ pip3 install --user --upgrade pip
2020-07-13 17:42:02 -06:00
.. platform-choice :: arch
:altname: linux
:title: Arch Linux
2024-05-29 09:57:16 -06:00
Install Python and pip by running:
2020-07-13 17:42:02 -06:00
.. code-block :: console
2024-05-29 09:57:16 -06:00
$ sudo pacman -S python python-pip
2020-07-13 17:42:02 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: linux
:title: Other Linux
2020-04-27 01:21:31 -06:00
2024-05-29 09:57:16 -06:00
Install Python from the package repository of your distribution.
2020-04-27 01:21:31 -06:00
2020-06-30 22:11:51 -06:00
On architectures other than |builtin-yosys-architectures|, install Yosys from the package repository of your distribution.
2020-04-27 01:21:31 -06:00
2021-12-11 01:52:14 -07:00
If Yosys |yosys-version| is not available, `build Yosys from source`_ .
2020-04-27 01:21:31 -06:00
2024-02-15 12:35:21 -07:00
.. _build Yosys from source: https://github.com/YosysHQ/yosys/#building-from-source
2020-04-27 01:21:31 -06:00
2023-02-16 15:09:14 -07:00
|upgrade-pip|
.. code-block :: console
$ pip3 install --user --upgrade pip
2020-04-27 01:21:31 -06:00
2024-03-21 19:09:46 -06:00
2020-06-30 21:32:17 -06:00
.. _install:
2020-04-27 01:21:31 -06:00
2021-12-09 22:39:50 -07:00
Installing Amaranth
===================
2020-04-27 01:21:31 -06:00
2021-12-09 22:39:50 -07:00
The latest release of Amaranth should work well for most applications. A development snapshot---any commit from the `` main `` branch of Amaranth---should be similarly reliable, but is likely to include experimental API changes that will be in flux until the next release. With that in mind, development snapshots can be used to try out new functionality or to avoid bugs fixed since the last release.
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. _install-release:
2020-04-27 01:21:31 -06:00
Latest release
--------------
2021-12-09 22:39:50 -07:00
.. |release:install| replace :: To install the latest release of Amaranth, run:
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-picker ::
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: windows
2020-06-30 21:32:17 -06:00
:title: Windows
|release:install|
.. code-block :: doscon
2021-12-09 22:39:50 -07:00
> pip install --upgrade amaranth[builtin-yosys]
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: macos
2020-06-30 21:32:17 -06:00
:title: macOS
|release:install|
.. code-block :: console
2021-12-09 22:39:50 -07:00
$ pip install --user --upgrade 'amaranth[builtin-yosys]'
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: linux
2020-06-30 21:32:17 -06:00
:title: Linux
2021-12-09 22:39:50 -07:00
If you **did not** install Yosys manually in the :ref: `previous step <install-deps>` , to install the latest release of Amaranth, run:
2020-06-30 21:32:17 -06:00
.. code-block :: console
2021-12-09 22:39:50 -07:00
$ pip3 install --user --upgrade 'amaranth[builtin-yosys]'
2020-06-30 21:32:17 -06:00
If you **did** install Yosys manually in the previous step, run:
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. code-block :: console
2020-04-27 01:21:31 -06:00
2021-12-09 22:39:50 -07:00
$ pip3 install --user --upgrade amaranth
2020-04-27 01:21:31 -06:00
2020-07-13 17:42:02 -06:00
.. platform-choice :: arch
:altname: linux
:title: Arch Linux
|release:install|
.. code-block :: console
2021-12-09 22:39:50 -07:00
$ sudo pacman -S python-amaranth
2020-07-13 17:42:02 -06:00
2020-04-27 01:21:31 -06:00
2020-07-01 00:15:16 -06:00
.. _install-snapshot:
2020-06-30 21:32:17 -06:00
2020-04-27 01:21:31 -06:00
Development snapshot
--------------------
2021-12-09 22:39:50 -07:00
.. |snapshot:install| replace :: To install the latest development snapshot of Amaranth, run:
2020-07-01 00:15:16 -06:00
2020-07-05 17:39:47 -06:00
.. platform-picker ::
2020-07-01 00:15:16 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: windows
2020-07-01 00:15:16 -06:00
:title: Windows
|snapshot:install|
.. code-block :: doscon
2023-02-16 13:41:21 -07:00
> pip install "amaranth[builtin-yosys] @ git+https://github.com/amaranth-lang/amaranth.git"
2020-07-01 00:15:16 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: macos
2020-07-01 00:15:16 -06:00
:title: macOS
|snapshot:install|
.. code-block :: console
2023-02-16 13:41:21 -07:00
$ pip install --user 'amaranth[builtin-yosys] @ git+https://github.com/amaranth-lang/amaranth.git'
2020-07-01 00:15:16 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: linux
2020-07-01 00:15:16 -06:00
:title: Linux
2021-12-09 22:39:50 -07:00
If you **did not** install Yosys manually in the :ref: `previous step <install-deps>` , to install the latest release of Amaranth, run:
2020-07-01 00:15:16 -06:00
.. code-block :: console
2023-02-16 13:41:21 -07:00
$ pip3 install --user 'amaranth[builtin-yosys] @ git+https://github.com/amaranth-lang/amaranth.git'
2020-07-01 00:15:16 -06:00
If you **did** install Yosys manually in the previous step, run:
.. code-block :: console
2023-02-16 13:41:21 -07:00
$ pip3 install --user 'amaranth @ git+https://github.com/amaranth-lang/amaranth.git'
2020-07-01 00:15:16 -06:00
.. _install-develop:
Editable development snapshot
-----------------------------
2021-12-09 22:39:50 -07:00
.. |develop:first-time| replace :: To install an editable development snapshot of Amaranth for the first time, run:
.. |develop:update| replace :: Any changes made to the `` amaranth `` directory will immediately affect any code that uses Amaranth. To update the snapshot, run:
2023-01-31 12:47:32 -07:00
.. |develop:reinstall| replace :: any time package dependencies may have been added or changed (notably after updating the snapshot with `` git `` ). Otherwise, code using Amaranth may crash because of a dependency version mismatch.
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-picker ::
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: windows
2020-06-30 21:32:17 -06:00
:title: Windows
2020-07-01 00:15:16 -06:00
|develop:first-time|
2020-06-30 21:32:17 -06:00
.. code-block :: doscon
2021-12-09 22:39:50 -07:00
> git clone https://github.com/amaranth-lang/amaranth
> cd amaranth
2020-06-30 21:32:17 -06:00
> pip install --editable .[builtin-yosys]
2020-07-01 00:15:16 -06:00
|develop:update|
2020-06-30 21:32:17 -06:00
.. code-block :: doscon
2021-12-09 22:39:50 -07:00
> cd amaranth
> git pull --ff-only origin main
2020-06-30 21:32:17 -06:00
> pip install --editable .[builtin-yosys]
2020-07-01 02:58:36 -06:00
Run the `` pip install --editable .[builtin-yosys] `` command |develop:reinstall|
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: macos
2020-06-30 21:32:17 -06:00
:title: macOS
2020-07-01 00:15:16 -06:00
|develop:first-time|
2020-06-30 21:32:17 -06:00
.. code-block :: console
2021-12-09 22:39:50 -07:00
$ git clone https://github.com/amaranth-lang/amaranth
$ cd amaranth
2020-07-01 00:32:15 -06:00
$ pip install --user --editable '.[builtin-yosys]'
2020-06-30 21:32:17 -06:00
2020-07-01 00:15:16 -06:00
|develop:update|
2020-06-30 21:32:17 -06:00
.. code-block :: console
2021-12-09 22:39:50 -07:00
$ cd amaranth
$ git pull --ff-only origin main
2020-07-01 00:32:15 -06:00
$ pip install --user --editable '.[builtin-yosys]'
2020-06-30 21:32:17 -06:00
2020-07-01 02:58:36 -06:00
Run the `` pip install --editable .[builtin-yosys] `` command |develop:reinstall|
2020-06-30 21:32:17 -06:00
2020-07-05 17:39:47 -06:00
.. platform-choice :: linux
2020-06-30 21:32:17 -06:00
:title: Linux
2020-07-01 00:15:16 -06:00
If you **did** install Yosys manually in the :ref: `previous step <install-deps>` , omit `` [builtin-yosys] `` from the following commands.
2020-06-30 21:32:17 -06:00
2020-07-01 00:15:16 -06:00
|develop:first-time|
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. code-block :: console
2020-04-27 01:21:31 -06:00
2021-12-09 22:39:50 -07:00
$ git clone https://github.com/amaranth-lang/amaranth
$ cd amaranth
2020-07-01 00:32:15 -06:00
$ pip3 install --user --editable '.[builtin-yosys]'
2020-04-27 01:21:31 -06:00
2020-07-01 00:15:16 -06:00
|develop:update|
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. code-block :: console
2020-04-27 01:21:31 -06:00
2021-12-09 22:39:50 -07:00
$ cd amaranth
$ git pull --ff-only origin main
2020-07-01 00:32:15 -06:00
$ pip3 install --user --editable '.[builtin-yosys]'
2020-06-30 16:26:54 -06:00
2020-07-01 02:58:36 -06:00
Run the `` pip3 install --editable .[builtin-yosys] `` command |develop:reinstall|
2020-04-27 01:21:31 -06:00
Installing board definitions
=============================
.. todo ::
2021-12-09 22:39:50 -07:00
Explain how to install `<https://github.com/amaranth-lang/amaranth-boards>`_ .