Need help with nextpnr?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

809 Stars 158 Forks ISC License 4.0K Commits 112 Opened issues


nextpnr portable FPGA place and route tool

Services available


Need anything else?

Contributors list

nextpnr -- a portable FPGA place and route tool

nextpnr aims to be a vendor neutral, timing driven, FOSS FPGA place and route tool.

Currently nextpnr supports: * Lattice iCE40 devices supported by Project IceStorm * Lattice ECP5 devices supported by Project Trellis * Lattice Nexus devices supported by Project Oxide * Gowin LittleBee devices supported by Project Apicula * (experimental) Cyclone V devices supported by Mistral * (experimental) Lattice MachXO2 devices supported by Project Trellis * (experimental) a "generic" back-end for user-defined architectures

There is some work in progress towards support for Xilinx devices but it is not upstream and not intended for end users at the present time. We hope to see more FPGA families supported in the future. We would love your help in developing this awesome new project!

A brief (academic) paper describing the Yosys+nextpnr flow can be found on arXiv.

Here is a screenshot of nextpnr for iCE40. Build instructions and getting started notes can be found below.

See also: - F.A.Q. - Architecture API


The following packages need to be installed for building nextpnr, independent of the selected architecture:

  • CMake 3.3 or later
  • Modern C++14 compiler (
    required for development)
  • Python 3.5 or later, including development libraries (
    for Ubuntu)
    • on Windows make sure to install same version as supported by vcpkg
  • Boost libraries (
    libboost-dev libboost-filesystem-dev libboost-thread-dev libboost-program-options-dev libboost-iostreams-dev libboost-dev
    for Ubuntu)
  • Eigen3 (
    for Ubuntu) is required to build the analytic placer
  • Latest git Yosys is required to synthesise the demo design
  • For building on Windows with MSVC, usage of vcpkg is advised for dependency installation.
    • For 32 bit builds:
      vcpkg install boost-filesystem boost-program-options boost-thread eigen3
    • For 64 bit builds:
      vcpkg install boost-filesystem:x64-windows boost-program-options:x64-windows boost-thread:x64-windows eigen3:x64-windows
    • For static builds, add
      to each of the package names. For example, change
    • A copy of Python that matches the version in vcpkg (currently Python 3.6.4). You can download the Embeddable Zip File and extract it. You may need to extract
      within the embeddable zip file to a new directory called "Lib".
  • For building on macOS, brew utility is needed.
    • Install all needed packages
      brew install cmake python boost eigen

Getting started


For iCE40 support, install Project IceStorm to

or another location, which should be passed as
to CMake. Then build and install
using the following commands:
cmake . -DARCH=ice40
make -j$(nproc)
sudo make install

On Windows, you may specify paths explicitly:

cmake . -DARCH=ice40 -DICESTORM_INSTALL_PREFIX=C:/ProgramData/icestorm -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 15 2017 Win64" -DPYTHON_EXECUTABLE=C:/Python364/python.exe -DPYTHON_LIBRARY=C:/vcpkg/packages/python3_x64-windows/lib/python36.lib -DPYTHON_INCLUDE_DIR=C:/vcpkg/packages/python3_x64-windows/include/python3.6 .
cmake --build . --config Release

To build a static release, change the target triplet from

and add

A simple example that runs on the iCEstick dev board can be found in

. Usage example:
cd ice40/examples/blinky
yosys -p 'synth_ice40 -top blinky -json blinky.json' blinky.v               # synthesize into blinky.json
nextpnr-ice40 --hx1k --json blinky.json --pcf blinky.pcf --asc blinky.asc   # run place and route
icepack blinky.asc blinky.bin                                               # generate binary bitstream file
iceprog blinky.bin                                                          # upload design to iCEstick

Running nextpnr in GUI mode (see below for instructions on building nextpnr with GUI support):

nextpnr-ice40 --json blinky.json --pcf blinky.pcf --asc blinky.asc --gui

(Use the toolbar buttons or the Python command console to perform actions such as pack, place, route, and write output files.)


For ECP5 support, install Project Trellis to

or another location, which should be passed as
to CMake. Then build and install
using the following commands:
cmake . -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install


For Nexus support, install Project Oxide to

or another location, which should be passed as
to CMake. Then build and install
using the following commands:
cmake . -DARCH=nexus -DOXIDE_INSTALL_PREFIX=$HOME/.cargo
make -j$(nproc)
sudo make install

Nexus support is currently experimental, and has only been tested with engineering sample silicon.


For Gowin support, install Project Apicula. If a virtualenv is used, the path to

needs to be provided as follows:
cmake . -DARCH=gowin -DGOWIN_BBA_EXECUTABLE=path
make -j$(nproc)
sudo make install


The generic target allows running placement and routing for arbitrary custom architectures.

cmake . -DARCH=generic
make -j$(nproc)
sudo make install

An example of how to use the generic flow is in generic/examples. See also the Generic Architecture docs.


The nextpnr GUI is not built by default, to reduce the number of dependencies for a standard headless build. To enable it, add

to the CMake command line and ensure that Qt5 and OpenGL are available:
  • On Ubuntu, install
  • For MSVC vcpkg, install
    (32-bit) or
  • For Homebrew, install
    and add qt5 in path:
    echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile
    ` - this change is effective in next terminal session, so please re-open terminal window before building

Multiple architectures

To build nextpnr for multiple architectures at once, a semicolon-separated list can be used with

cmake . -DARCH="ice40;ecp5"
make -j$(nproc)
sudo make install

To build every available stable architecture, use

. To include experimental arches (currently nexus), use

Pre-generating chip databases

It is possible to pre-generate chip databases (

files). This can come in handy when building on time-constrained cloud instances, or in situations where Python is unable to use modules. To do this, build the architecture as a standalone project, which will produce the chip database alone. For example, for iCE40:
cd ice40
cmake .

This will create a

directory with
files. Provide the path to this directory when building nextpnr by using


Apart from chip databases, nextpnr requires the

tool to be compiled for the build system. This tool can be compiled as a separate project:
cd bba
cmake .

This will create a

file. Provide the path to this file when cross-building nextpnr by using

Additional notes for building nextpnr

The following runs a debug build of the iCE40 architecture without GUI, without Python support, without the HeAP analytic placer and only HX1K support:

make -j$(nproc)

To make static build release for iCE40 architecture use the following:

make -j$(nproc)

The HeAP placer's solver can optionally use OpenMP for a speedup on very large designs. Enable this by passing

to cmake (compiler support may vary).

You can change the location where nextpnr will be installed (this will usually default to

) by using

Notes for developers

  • All code is formatted using
    according to the style rules in
    (LLVM based with increased indent widths and brace wraps after classes).
  • To automatically format all source code, run
    make clangformat
  • See the wiki for additional documentation on the architecture API.

Recording a movie

  • To save a movie recording of place-and-route click recording icon in toolbar and select empty directory where recording files will be stored and select frames to skip.
  • Manually start all PnR operations you wish
  • Click on recording icon again to stop recording
  • Go to directory containing files and execute
    ffmpeg -f image2 -r 1 -i movie_%05d.png -c:v libx264 nextpnr.mp4


  • To build test binaries as well, use
    and after
    make test
    to run them, or you can run separate binaries.
  • To use code sanitizers use the
  • Running valgrind example
    valgrind --leak-check=yes --tool=memcheck ./nextpnr-ice40 --json ice40/blinky.json
  • Running tests with code coverage use
    and after
    make ice40-coverage
  • After that open
    in your browser to view the coverage report
  • Note that
    is needed in order to generate reports

Links and references

Synthesis, simulation, and logic optimization

FPGA bitstream documentation (and tools) projects

Other FOSS FPGA place and route projects

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.