2020-04-27 01:21:31 -06:00
Installation
############
System requirements
===================
nMigen requires Python 3.6; it works on CPython_ 3.6 (or newer), and works faster on PyPy3.6_ 7.2 (or newer).
2020-06-30 21:32:17 -06:00
For most workflows, nMigen requires Yosys_ 0.9 (or newer). A compatible version of Yosys is distributed via PyPI_ for most popular platforms.
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
Simulating nMigen code requires no additional software. However, a waveform viewer like GTKWave_ is invaluable for debugging.
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
Synthesizing, placing and routing an nMigen design for an FPGA requires the FPGA family specific toolchain.
2020-04-27 01:21:31 -06:00
.. TODO: Link to FPGA family docs here
.. _CPython: https://www.python.org/
.. _PyPy3.6: https://www.pypy.org/
.. _Yosys: http://www.clifford.at/yosys/
2020-06-30 21:32:17 -06:00
.. _PyPI: https://pypi.org/
2020-04-27 01:21:31 -06:00
.. _GTKWave: http://gtkwave.sourceforge.net/
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
2020-06-30 21:32:17 -06:00
.. content-tabs ::
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. tab-container :: windows
:title: Windows
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
`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
2020-06-30 21:46:59 -06:00
`Download GTKWave`_ , either win32 or win64 binaries. GTKWave does not need to be installed; it can be unpacked to any convenient location and run from there.
2020-04-27 01:21:31 -06:00
2020-06-30 21:46:59 -06:00
.. _Download GTKWave: https://sourceforge.net/projects/gtkwave/files/
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. tab-container :: macos
:title: macOS
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
Install Homebrew_. Then, install Python and GTKWave 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
$ brew install python gtkwave
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
2020-06-30 21:32:17 -06:00
.. tab-container :: linux
:title: Linux
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. rubric :: Debian-based distributions
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
Install Python and GTKWave 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 python3-pip gtkwave
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
2020-06-30 21:32:17 -06:00
If Yosys 0.9 (or newer) is not available, `build Yosys from source`_ .
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. rubric :: Other distributions
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
Install Python and GTKWave 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
2020-06-30 21:32:17 -06:00
If Yosys 0.9 (or newer) is not available, `build Yosys from source`_ .
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. _build Yosys from source: https://github.com/YosysHQ/yosys/#setup
2020-04-27 01:21:31 -06:00
2020-06-30 21:32:17 -06:00
.. _install:
2020-04-27 01:21:31 -06:00
Installing nMigen
=================
The latest release of nMigen should work well for most applications. A development snapshot---any commit from the `` master `` branch of nMigen---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-06-30 21:32:17 -06:00
.. _install-release:
2020-04-27 01:21:31 -06:00
Latest release
--------------
2020-06-30 21:32:17 -06:00
.. |release:install| replace :: To install the latest release of nMigen, run:
.. content-tabs ::
.. tab-container :: windows
:title: Windows
|release:install|
.. code-block :: doscon
> pip install --upgrade nmigen[builtin-yosys]
.. tab-container :: macos
:title: macOS
|release:install|
.. code-block :: console
2020-07-01 00:32:15 -06:00
$ pip install --user --upgrade 'nmigen[builtin-yosys]'
2020-06-30 21:32:17 -06:00
.. tab-container :: linux
:title: Linux
If you **did not** install Yosys manually in the :ref: `previous step <install-deps>` , to install the latest release of nMigen, run:
.. code-block :: console
2020-07-01 00:32:15 -06:00
$ pip3 install --user --upgrade 'nmigen[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
2020-06-30 23:06:20 -06:00
$ pip3 install --user --upgrade nmigen
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
--------------------
2020-07-01 00:15:16 -06:00
.. |snapshot:install| replace :: To install the latest development snapshot of nMigen, run:
.. content-tabs ::
.. tab-container :: windows
:title: Windows
|snapshot:install|
.. code-block :: doscon
> pip install git+https://github.com/nmigen/nmigen.git#egg=nmigen[builtin-yosys]
.. tab-container :: macos
:title: macOS
|snapshot:install|
.. code-block :: console
2020-07-01 00:32:15 -06:00
$ pip install --user 'git+https://github.com/nmigen/nmigen.git#egg=nmigen[builtin-yosys]'
2020-07-01 00:15:16 -06:00
.. tab-container :: linux
:title: Linux
If you **did not** install Yosys manually in the :ref: `previous step <install-deps>` , to install the latest release of nMigen, run:
.. code-block :: console
2020-07-01 00:32:15 -06:00
$ pip3 install --user 'git+https://github.com/nmigen/nmigen.git#egg=nmigen[builtin-yosys]'
2020-07-01 00:15:16 -06:00
If you **did** install Yosys manually in the previous step, run:
.. code-block :: console
2020-07-01 00:32:15 -06:00
$ pip3 install --user 'git+https://github.com/nmigen/nmigen.git#egg=nmigen'
2020-07-01 00:15:16 -06:00
.. _install-develop:
Editable development snapshot
-----------------------------
.. |develop:first-time| replace :: To install an editable development snapshot of nMigen for the first time, run:
.. |develop:update| replace :: Any changes made to the `` nmigen `` directory will immediately affect any code that uses nMigen. To update the snapshot, run:
.. |develop:reinstall| replace :: It is important to run the `` pip3 install --editable .[builtin-yosys] `` command each time the editable development snapshot is updated in case package dependencies have been added or changed. Otherwise, code using nMigen may misbehave or crash with an `` ImportError `` .
2020-06-30 21:32:17 -06:00
.. content-tabs ::
.. tab-container :: windows
:title: Windows
2020-07-01 00:15:16 -06:00
|develop:first-time|
2020-06-30 21:32:17 -06:00
.. code-block :: doscon
> git clone https://github.com/nmigen/nmigen
> cd nmigen
> 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
> cd nmigen
> git pull --ff-only origin master
> pip install --editable .[builtin-yosys]
2020-07-01 00:15:16 -06:00
|develop:reinstall|
2020-06-30 21:32:17 -06:00
.. tab-container :: macos
:title: macOS
2020-07-01 00:15:16 -06:00
|develop:first-time|
2020-06-30 21:32:17 -06:00
.. code-block :: console
$ git clone https://github.com/nmigen/nmigen
$ cd nmigen
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
$ cd nmigen
$ git pull --ff-only origin master
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:reinstall|
2020-06-30 21:32:17 -06:00
.. tab-container :: linux
: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
2020-06-30 21:32:17 -06:00
$ git clone https://github.com/nmigen/nmigen
$ cd nmigen
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
2020-06-30 21:32:17 -06:00
$ cd nmigen
$ git pull --ff-only origin master
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 00:15:16 -06:00
|develop:reinstall|
2020-04-27 01:21:31 -06:00
Installing board definitions
=============================
.. todo ::
Explain how to install `<https://github.com/nmigen/nmigen-boards>`_ .