Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

nextpnr portable FPGA place and route tool

License

NotificationsYou must be signed in to change notification settings

YosysHQ/nextpnr

Repository files navigation

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

Currently nextpnr supports:

There is some work in progress towardssupport 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 foundonarXiv.

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

See also:

Prerequisites

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

  • CMake 3.13 or later
  • Modern C++17 compiler (clang-format required for development)
  • Python 3.5 or later, including development libraries (python3-dev for Ubuntu)
    • Python 3.9 or later is required fornextpnr-himbaechel
    • on Windows make sure to install same version as supported byvcpkg
  • Boost libraries (libboost-dev libboost-filesystem-dev libboost-thread-dev libboost-program-options-dev libboost-iostreams-dev libboost-dev orlibboost-all-dev for Ubuntu)
  • Eigen3 (libeigen3-dev 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-static to each of the package names. For example, changeeigen3:x64-windows toeigen3:x64-windows-static
    • A copy of Python that matches the version in vcpkg (currently Python 3.6.4). You can download theEmbeddable Zip File and extract it. You may need to extractpython36.zip within the embeddable zip file to a new directory called "Lib".
  • For building on macOS, brew utility is needed.
    • Install all needed packagesbrew install cmake python boost eigen

Getting started

First of all, run:

git submodule update --init --recursive

nextpnr-ice40

For iCE40 support, installProject IceStorm to/usr/local or another location, which should be passed as-DICESTORM_INSTALL_PREFIX=/usr to CMake. Then build and installnextpnr-ice40 using the following commands:

mkdir -p build && cd buildcmake .. -DARCH=ice40make -j$(nproc)sudo make install

On Windows, you may specify paths explicitly:

cmake . -B build -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" -DPython3_EXECUTABLE=C:/Python364/python.exe -DPython3_LIBRARY=C:/vcpkg/packages/python3_x64-windows/lib/python36.lib -DPython3_INCLUDE_DIR=C:/vcpkg/packages/python3_x64-windows/include/python3.6cmake --build build --config Release

To build a static release, change the target triplet fromx64-windows tox64-windows-static and add-DBUILD_STATIC=ON.

A simple example that runs on the iCEstick dev board can be found inice40/examples/blinky/blinky.*.Usage example:

cd ice40/examples/blinkyyosys -p 'synth_ice40 -top blinky -json blinky.json' blinky.v               # synthesize into blinky.jsonnextpnr-ice40 --hx1k --json blinky.json --pcf blinky.pcf --asc blinky.asc   # run place and routeicepack blinky.asc blinky.bin                                               # generate binary bitstream fileiceprog 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 actionssuch as pack, place, route, and write output files.)

nextpnr-ecp5

For ECP5 support, installProject Trellis to/usr/local or another location, which should be passed as-DTRELLIS_INSTALL_PREFIX=/usr/local to CMake. Then build and installnextpnr-ecp5 using the following commands:

mkdir -p build && cd buildcmake .. -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/localmake -j$(nproc)sudo make install

nextpnr-nexus

For Nexus support, installProject Oxide to$HOME/.cargo or another location, which should be passed as-DOXIDE_INSTALL_PREFIX=$HOME/.cargo to CMake. Then build and installnextpnr-nexus using the following commands:

mkdir -p build && cd buildcmake .. -DARCH=nexus -DOXIDE_INSTALL_PREFIX=$HOME/.cargomake -j$(nproc)sudo make install

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

nextpnr-generic

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

mkdir -p build && cd buildcmake .. -DARCH=genericmake -j$(nproc)sudo make install

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

nextpnr-himbaechel

The himbaechel target allows running placement and routing for larger architectures that share a common structure.

gowin

For Gowin support, installProject Apicula

mkdir -p build && cd buildcmake .. -DARCH="himbaechel" -DHIMBAECHEL_UARCH="gowin"make -j$(nproc)sudo make install

ng-ultra

For NanoXplore NG-Ultra support, cloneProject Beyond DB repo

mkdir -p build && cd buildcmake .. -DARCH="himbaechel" -DHIMBAECHEL_UARCH="ng-ultra" -DHIMBAECHEL_PRJBEYOND_DB=/path/to/prjbeyond-db -DHIMBAECHEL_NGULTRA_DEVICES=ng-ultramake -j$(nproc)sudo make install

Please note that binary bitstream creation requires Impulse tool from NanoXplore.

GUI

The nextpnr GUI is not built by default, to reduce the number of dependencies for a standard headless build. To enable it, add-DBUILD_GUI=ON to the CMake command line and ensure that Qt5 and OpenGL are available:

  • On Ubuntu 22.04 LTS, installqtcreator qtbase5-dev qt5-qmake
  • On other Ubuntu versions, installqt5-default
  • For MSVC vcpkg, installqt5-base (32-bit) orqt5-base:x64-windows (64-bit)
  • For Homebrew, installqt5 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-DARCH.

mkdir -p build && cd buildcmake .. -DARCH="ice40;ecp5"make -j$(nproc)sudo make install

To build every available stable architecture, use-DARCH=all. To include experimental arches (currently nexus), use-DARCH=all+alpha.

Per-microarchitecture Himbächel

To build a single nextpnr-himbachel executable for each of the supported microarchitectures, use-DHIMBAECHEL_SPLIT.

mkdir -p build && cd buildcmake .. -DARCH="himbaechel" -DHIMBAECHEL_UARCH="gowin;ng-ultra"make -j$(nproc)sudo make install

In such a build, instead of a singlenextpnr-himbaechel binary, two binariesnextpnr-himbaechel-gowin andnextpnr-himbaechel-ng-ultra are built. Although they are installed together, each microarchitecture is completely independent of the other, and only needs its corresponding.../share/himbaechel/<microarchitecture>/ chip database directory to run. Split build reduces the size of individual distributed artifacts (although the total size increases), and allows co-installation of artifacts of different versions.

Cross-compilation

Apart from chip databases, nextpnr requires thebba tool to be compiled for the build system. This tool can be compiled as a separate project:

cd bbacmake .make

This will create abba-export.cmake file. Provide the path to this file when cross-building nextpnr by using-DBBA_IMPORT=/path/to/bba-export.cmake.

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:

mkdir -p build && cd buildcmake .. -DARCH=ice40 -DCMAKE_BUILD_TYPE=Debug -DBUILD_PYTHON=OFF -DICE40_DEVICES=1kmake -j$(nproc)

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

mkdir -p build && cd buildcmake .. -DARCH=ice40 -DBUILD_PYTHON=OFF -DSTATIC_BUILD=ONmake -j$(nproc)

The HeAP placer's solver can optionally use OpenMP for a speedup on very large designs. Enable this by passing-DUSE_OPENMP=yes to cmake (compiler support may vary).

You can change the location where nextpnr will be installed (this will usually default to/usr/local) by using-DCMAKE_INSTALL_PREFIX=/install/prefix.

Notes for developers

  • All code is formatted usingclang-format according to the style rules in.clang-format (LLVM based withincreased indent widths and brace wraps after classes).
  • To automatically format all source code, runmake 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 directorywhere 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 executeffmpeg -f image2 -r 1 -i movie_%05d.png -c:v libx264 nextpnr.mp4

Testing

  • To build test binaries as well, use-DBUILD_TESTS=ON and aftermake runmake test to run them, or you can run separate binaries.
  • To use code sanitizers use thecmake options:
    • -DSANITIZE_ADDRESS=ON
    • -DSANITIZE_MEMORY=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
    • -DSANITIZE_THREAD=ON
    • -DSANITIZE_UNDEFINED=ON
  • Running valgrind examplevalgrind --leak-check=yes --tool=memcheck ./nextpnr-ice40 --json ice40/blinky.json
  • Running tests with code coverage use-DBUILD_TESTS=ON -DCOVERAGE and aftermake runmake ice40-coverage
  • After that openice40-coverage/index.html in your browser to view the coverage report
  • Note thatlcov 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


[8]ページ先頭

©2009-2025 Movatter.jp