7 nMigen requires Python 3.6; it works on CPython_ 3.6 (or newer), and works faster on PyPy3.6_ 7.2 (or newer).
9 For most workflows, nMigen requires Yosys_ 0.9 (or newer). A compatible version of Yosys is distributed via PyPI_ for most popular platforms.
11 Simulating nMigen code requires no additional software. However, a waveform viewer like GTKWave_ is invaluable for debugging.
13 Synthesizing, placing and routing an nMigen design for an FPGA requires the FPGA family specific toolchain.
15 .. TODO: Link to FPGA family docs here
17 .. _CPython: https://www.python.org/
18 .. _PyPy3.6: https://www.pypy.org/
19 .. _Yosys: http://www.clifford.at/yosys/
20 .. _PyPI: https://pypi.org/
21 .. _GTKWave: http://gtkwave.sourceforge.net/
26 Installing prerequisites
27 ========================
29 .. |builtin-yosys-architectures| replace:: x86_64 and AArch64
33 .. platform-choice:: windows
36 :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.
38 `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.
40 .. _Download GTKWave: https://sourceforge.net/projects/gtkwave/files/
42 .. platform-choice:: macos
45 Install Homebrew_. Then, install Python and GTKWave by running:
47 .. code-block:: console
49 $ brew install python gtkwave
51 .. _Homebrew: https://brew.sh
53 .. platform-choice:: debian
57 Install Python and GTKWave by running:
59 .. code-block:: console
61 $ sudo apt-get install python3-pip gtkwave
63 On architectures other than |builtin-yosys-architectures|, install Yosys by running:
65 .. code-block:: console
67 $ sudo apt-get install yosys
69 If Yosys 0.9 (or newer) is not available, `build Yosys from source`_.
71 .. platform-choice:: arch
75 Install Python, pip, GTKWave and Yosys by running:
77 .. code-block:: console
79 $ sudo pacman -S python python-pip gtkwave yosys
81 .. platform-choice:: linux
84 Install Python and GTKWave from the package repository of your distribution.
86 On architectures other than |builtin-yosys-architectures|, install Yosys from the package repository of your distribution.
88 If Yosys 0.9 (or newer) is not available, `build Yosys from source`_.
90 .. _build Yosys from source: https://github.com/YosysHQ/yosys/#setup
98 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.
106 .. |release:install| replace:: To install the latest release of nMigen, run:
110 .. platform-choice:: windows
115 .. code-block:: doscon
117 > pip install --upgrade nmigen[builtin-yosys]
119 .. platform-choice:: macos
124 .. code-block:: console
126 $ pip install --user --upgrade 'nmigen[builtin-yosys]'
128 .. platform-choice:: linux
131 If you **did not** install Yosys manually in the :ref:`previous step <install-deps>`, to install the latest release of nMigen, run:
133 .. code-block:: console
135 $ pip3 install --user --upgrade 'nmigen[builtin-yosys]'
137 If you **did** install Yosys manually in the previous step, run:
139 .. code-block:: console
141 $ pip3 install --user --upgrade nmigen
143 .. platform-choice:: arch
149 .. code-block:: console
151 $ sudo pacman -S python-nmigen
154 .. _install-snapshot:
159 .. |snapshot:install| replace:: To install the latest development snapshot of nMigen, run:
163 .. platform-choice:: windows
168 .. code-block:: doscon
170 > pip install git+https://github.com/nmigen/nmigen.git#egg=nmigen[builtin-yosys]
172 .. platform-choice:: macos
177 .. code-block:: console
179 $ pip install --user 'git+https://github.com/nmigen/nmigen.git#egg=nmigen[builtin-yosys]'
181 .. platform-choice:: linux
184 If you **did not** install Yosys manually in the :ref:`previous step <install-deps>`, to install the latest release of nMigen, run:
186 .. code-block:: console
188 $ pip3 install --user 'git+https://github.com/nmigen/nmigen.git#egg=nmigen[builtin-yosys]'
190 If you **did** install Yosys manually in the previous step, run:
192 .. code-block:: console
194 $ pip3 install --user 'git+https://github.com/nmigen/nmigen.git#egg=nmigen'
199 Editable development snapshot
200 -----------------------------
202 .. |develop:first-time| replace:: To install an editable development snapshot of nMigen for the first time, run:
203 .. |develop:update| replace:: Any changes made to the ``nmigen`` directory will immediately affect any code that uses nMigen. To update the snapshot, run:
204 .. |develop:reinstall| replace:: 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``.
208 .. platform-choice:: windows
213 .. code-block:: doscon
215 > git clone https://github.com/nmigen/nmigen
217 > pip install --editable .[builtin-yosys]
221 .. code-block:: doscon
224 > git pull --ff-only origin master
225 > pip install --editable .[builtin-yosys]
227 Run the ``pip install --editable .[builtin-yosys]`` command |develop:reinstall|
229 .. platform-choice:: macos
234 .. code-block:: console
236 $ git clone https://github.com/nmigen/nmigen
238 $ pip install --user --editable '.[builtin-yosys]'
242 .. code-block:: console
245 $ git pull --ff-only origin master
246 $ pip install --user --editable '.[builtin-yosys]'
248 Run the ``pip install --editable .[builtin-yosys]`` command |develop:reinstall|
250 .. platform-choice:: linux
253 If you **did** install Yosys manually in the :ref:`previous step <install-deps>`, omit ``[builtin-yosys]`` from the following commands.
257 .. code-block:: console
259 $ git clone https://github.com/nmigen/nmigen
261 $ pip3 install --user --editable '.[builtin-yosys]'
265 .. code-block:: console
268 $ git pull --ff-only origin master
269 $ pip3 install --user --editable '.[builtin-yosys]'
271 Run the ``pip3 install --editable .[builtin-yosys]`` command |develop:reinstall|
274 Installing board definitions
275 =============================
279 Explain how to install `<https://github.com/nmigen/nmigen-boards>`_.