nextpnr portable FPGA place and route tool
Go to file
Clifford Wolf f6b3333a7d Add new iCE40 delay estimator and delay predictor
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2018-08-04 19:50:49 +02:00
3rdparty Add ability for multiple selection, enable for select only items that make sense 2018-07-25 19:10:45 +02:00
bba Fix bba typo 2018-07-26 18:02:50 +02:00
common Quick fix for router bug in unrouting a conflicting pip 2018-08-04 17:23:46 +02:00
docs Update archapi.md 2018-08-01 11:38:41 +02:00
ecp5 Merge branch 'master' into slack_redist_freq 2018-08-03 23:43:53 -07:00
generic Add constraint weight as a command line option 2018-08-03 18:31:54 +02:00
gui Moved to new signal slot syntax 2018-08-03 10:53:38 +02:00
ice40 Add new iCE40 delay estimator and delay predictor 2018-08-04 19:50:49 +02:00
json json: Fix message for 1'bx values 2018-08-01 20:11:36 +02:00
python python: Remove more dead files 2018-07-30 16:47:52 +02:00
tests gui: fix crash on ecp5 gui, fix quadtree tests to not get broken by clangformat 2018-08-01 04:42:41 +01:00
.clang-format Set clangformat column limit to 120 2018-06-23 15:26:07 +02:00
.gitignore Add bbasm target, use as passthru in iCE40 builder 2018-07-24 15:31:00 +02:00
CMakeLists.txt cmake: Remove nextpnrpy so modules 2018-07-30 15:20:50 +02:00
COPYING Add COPYING file 2018-08-01 14:45:09 +01:00
README.md ecp5: Remove libtrellis link for bitstream gen 2018-08-01 15:58:38 +02:00

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
  • (experimental) Lattice ECP5 devices supported by Project Trellis
  • (experimental) a "generic" back-end for user-defined architectures

We hope to see Xilinx 7 Series thanks to Project X-Ray and even more FPGA families supported in the future. We would love your help in developing this awesome new project!

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

See also:

Prerequisites

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

  • CMake 3.3 or later
  • Modern C++11 compiler (clang-format required for development)
  • Qt5 or later (qt5-default for Ubuntu 16.04)
  • Python 3.5 or later, including development libraries (python3-dev for Ubuntu)
    • on Windows make sure to install same version as supported by vcpkg
  • Boost libraries (libboost-dev or libboost-all-dev for Ubuntu)
  • 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 boost-python qt5-base
    • For 64 bit builds: vcpkg install boost-filesystem:x64-windows boost-program-options:x64-windows boost-thread:x64-windows boost-python:x64-windows qt5-base:x64-windows
  • For building on macOS, brew utility is needed.
    • Install all needed packages brew install cmake python boost boost-python3 qt5
    • Do not forget to add qt5 in path as well echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile

Getting started

nextpnr-ice40

To build the iCE40 version of nextpnr, install icestorm with chipdbs installed in /usr/local/share/icebox. Then build and install nextpnr-ice40 using the following commands:

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

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

cd ice40
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:

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.)

nextpnr-ecp5

For ECP5 support, you must download Project Trellis, then follow its instructions to download the latest database and build libtrellis.

cmake -DARCH=ecp5 -DTRELLIS_ROOT=/path/to/prjtrellis .
make -j$(nproc)
sudo make install
  • For an ECP5 blinky on the 45k ULX3S board, first synthesise using yosys blinky.ys in ecp5/synth.

  • Then run ECP5 place-and route using ./nextpnr-ecp5 --json ecp5/synth/blinky.json --basecfg ecp5/synth/ulx3s_empty.config --textcfg ecp5/synth/ulx3s_out.config

  • Create a bitstream using ecppack ulx3s_out.config ulx3s.bit

  • Note that ulx3s_empty.config contains fixed/unknown bits to be copied to the output bitstream

  • More examples of the ECP5 flow for a range of boards can be found in the Project Trellis Examples.

  • Currently the ECP5 flow supports LUTs, flipflops and IO. IO must be instantiated using TRELLIS_IO primitives and constraints specified using LOC and IO_TYPE attributes on those instances, as is used in the examples.

nextpnr-generic

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

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

TBD: Getting started example for generic target.

Additional notes for building nextpnr

Use cmake -D options to specify which version of nextpnr you want to build.

Use -DARCH=... to set the architecture. It is semicolon separated list. Use cmake . -DARCH=all to build all supported architectures.

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

cmake -DARCH=ice40 -DCMAKE_BUILD_TYPE=Debug -DBUILD_PYTHON=OFF -DBUILD_GUI=OFF -DICE40_HX1K_ONLY=1 .
make -j$(nproc)

Notes for developers

  • All code is formatted using clang-format according to the style rules in .clang-format (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.

Testing

  • To build test binaries as well, use -DBUILD_TESTS=ON and after make run make tests to run them, or you can run separate binaries.
  • To use code sanitizers use the cmake options:
    • -DSANITIZE_ADDRESS=ON
    • -DSANITIZE_MEMORY=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
    • -DSANITIZE_THREAD=ON
    • -DSANITIZE_UNDEFINED=ON
  • Running valgrind example valgrind --leak-check=yes --tool=memcheck ./nextpnr-ice40 --json ice40/blinky.json

Synthesis, simulation, and logic optimization

FPGA bitstream documentation (and tools) projects

Other FOSS FPGA place and route projects