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](http://www.clifford.at/icestorm/) * *(experimental)* Lattice ECP5 devices supported by [Project Trellis](https://github.com/SymbiFlow/prjtrellis) * *(experimental)* a "generic" back-end for user-defined architectures We hope to see Xilinx 7 Series thanks to [Project X-Ray](https://github.com/SymbiFlow/prjxray) 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](#getting-started) can be found below. See also: - [F.A.Q.](docs/faq.md) - [Architecture API](docs/archapi.md) 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](https://github.com/Microsoft/vcpkg/blob/master/ports/python3/CONTROL) - 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](http://www.clifford.at/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](https://github.com/SymbiFlow/prjtrellis), 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 `yos
module example(CLK, LD);
  input CLK;
  output [15:0] LD;

  wire clock;
  reg [15:0] leds;

  BUFG CLK_BUF (.I(CLK), .O(clock));
  OBUF LD_BUF[15:0] (.I(leds), .O(LD));

  parameter COUNTBITS = 26;
  reg [COUNTBITS-1:0] counter;

  always @(posedge CLK) begin
    counter <= counter + 1;
    if (counter[COUNTBITS-1])
      leds <= 16'h8000 >> counter[COUNTBITS-2:COUNTBITS-5];
    else
      leds <= 16'h0001 << counter[COUNTBITS-2:COUNTBITS-5];
  end
endmodule