2018-08-01 16:24:55 +08:00
FAQ
===
2018-08-01 16:25:44 +08:00
Terminology
-----------
For nextpnr we are using the following terminology.
### Design Database Terminology
- **Cell**: an instantiation of a physical block inside the netlist. The packer may combine or otherwise modify cells; and the placer places them onto Bels.
- **Port**: an input or output of a Cell, can be connected to a single net.
- **Net**: a connection between cell ports inside the netlist. One net will be routed using one or more wires inside the chip. Nets are always one bit in size, multibit nets are always split.
- **Source**: The cell output port driving a given net
- **Sink**: A cell input port driven by a given net
- **Arc**: A source-sink-pair on a net
### Architecture Database Terminology
- **Bel**: Basic Element, the functional blocks of an FPGA such as logic cells, IO cells, blockrams, etc. Up to one cell may be placed at each Bel.
- **Pin**: an input or output of a Bel, permanently connected to a single wire.
- **Pip**: Programmable Interconnect Point, a configurable connection in one direction between two wires
- **Wire**: a fixed physical connection inside the FPGA between Pips and/or Bel pins.
- **Alias**: a special automatic-on Pip to represent a permanent connection between two wires
2018-08-01 17:30:00 +08:00
- **Group**: a collection of bels, pips, wires, and/or other groups
2021-02-01 23:27:35 +08:00
- **BelBucket**: a collection of bels and cell types. All of the bel buckets form a set cover of bels and cell types.
2018-08-01 16:25:44 +08:00
### Flow Terminology
- **Packing**: The action of grouping cells in synthesis output into larger (logic) cells
2018-08-01 16:40:32 +08:00
- **Placing**: The action of binding packed cells to Bels
2018-08-01 16:25:44 +08:00
- **Routing**: The action of binding nets to wires
### Other Terminology
2018-08-01 16:40:32 +08:00
- **Binding**: Assigning nets to wires and cells to Bels
2018-08-01 16:25:44 +08:00
- **Path**: All the arcs connecting a FF output (or primary input) to a FF input (or primary output)
Adding new architectures to nextpnr
-----------------------------------
2018-11-13 23:08:04 +08:00
### Implementing new architectures
Each nextpnr architecture must implement the *nextpnr architecture API* .
See [archapi.md ](archapi.md ) for a complete reference of the architecture API.
### Delay Estimates
Each architecture must implement a `estimateDelay()` method that estimates the expected delay for a path from given `src` to `dst` wires.
2018-11-14 00:30:49 +08:00
*It is very important that this method slightly overestimates the expected delay.* Furthermore, it should overestimate the expected delay
by a slightly larger margin for longer paths than for shorter paths. Otherwise there will be performance issues with the router.
2018-11-13 23:08:04 +08:00
The delays estimates returned by that method should also be as fine-grain as possible. It definitely pays off to spend some time improving the `estimateDelay()`
for your architecture once implementing small designs work.
### Ripup Information
The `getConflictingWireWire()` , `getConflictingWireNet()` , `getConflictingPipWire()` , and `getConflictingPipNet()` methods are used by the router
to determine which resources to rip up in order to make a given routing resource (wire or pip) available.
2021-01-28 23:19:06 +08:00
The architecture must guarantee that the following invariants hold.
2018-11-13 23:08:04 +08:00
**Invariant 1:**
```
if (!ctx->checkWireAvail(wire)) {
WireId w = getConflictingWireWire(wire);
if (w != WireId()) {
ctx->unbindWire(w);
assert(ctx->checkWireAvail(wire));
}
}
```
**Invariant 2:**
```
if (!ctx->checkWireAvail(wire)) {
NetInfo *n = getConflictingWireNet(wire);
if (n != nullptr) {
for (auto & it : n->wires)
ctx->unbindWire(it.first);
assert(ctx->checkWireAvail(wire));
}
}
```
**Invariant 3:**
```
if (!ctx->checkPipAvail(pip)) {
WireId w = getConflictingPipWire(pip);
if (w != WireId()) {
ctx->unbindWire(w);
assert(ctx->checkPipAvail(pip));
}
}
```
**Invariant 4:**
```
if (!ctx->checkPipAvail(pip)) {
NetInfo *n = getConflictingPipNet(pip);
if (n != nullptr) {
for (auto & it : n->wires)
ctx->unbindWire(it.first);
assert(ctx->checkPipAvail(pip));
}
}
```
**Invariant 5:**
```
if (ctx->checkWireAvail(wire)) {
// bind is guaranteed to succeed
ctx->bindWire(wire, net, strength);
}
```
**Invariant 6:**
```
if (ctx->checkPipAvail(pip) & & ctx->checkWireAvail(ctx->getPipDstWire(pip))) {
// bind is guaranteed to succeed
ctx->bindPip(pip, net, strength);
}
```
2018-08-01 16:25:44 +08:00
2018-08-01 16:24:55 +08:00
Nextpnr and other tools
-----------------------
2018-08-01 16:40:32 +08:00
### Which toolchain should I use and why?
2018-08-01 16:24:55 +08:00
2019-11-27 05:47:20 +08:00
* If you wish to do new **research** into FPGA architectures, or other similar topics, we suggest you look at using
[Verilog to Routing ](https://verilogtorouting.org ). If you want to use nextpnr, you might also be able to use the [Generic Arch ](generic.md ).
2018-08-01 16:24:55 +08:00
* If you are developing FPGA code in **Verilog** for a **Lattice iCE40** and
2021-06-09 20:13:50 +08:00
need an open source toolchain, we suggest you use [Yosys ](https://yosyshq.net/yosys/ ) and nextpnr.
2018-08-01 16:24:55 +08:00
* If you are developing FPGA code in **Verilog** for a **Lattice iCE40** with
2018-08-01 16:51:32 +08:00
Yosys and the **existing arachne-pnr toolchain** , we suggest you start thinking about
2018-08-01 16:24:55 +08:00
migrating to nextpnr.
* If you are developing Verilog FPGA code targeted at the Lattice ECP5 and
2019-11-27 00:10:07 +08:00
need an open source toolchain, there is also stable ECP5 support in Yosys and nextpnr.
2018-08-01 16:24:55 +08:00
2019-11-27 05:47:20 +08:00
* If you are developing FPGA code in **VHDL** you may wish to look at the [ghdlsynth-beta ](https://github.com/tgingold/ghdlsynth-beta ) experimental VHDL frontend for Yosys.
2018-08-01 16:24:55 +08:00
2018-08-01 16:40:32 +08:00
### Why didn't you just improve [arachne-pnr](https://github.com/cseed/arachne-pnr)?
2018-08-01 16:24:55 +08:00
2018-08-01 16:40:32 +08:00
[arachne-pnr ](https://github.com/cseed/arachne-pnr ) was originally developed as
2021-06-09 20:13:50 +08:00
part of [Project IceStorm ](http://bygone.clairexen.net/icestorm/ ) to demonstrate it
2018-08-01 16:24:55 +08:00
was possible to create an open source place and route tool for the iCE40 FPGAs
that actually produced valid bitstreams.
2018-08-01 16:51:32 +08:00
For its original purpose, it has served the community extremely well. However,
it was never designed to support multiple different FPGA families, nor more
2019-11-27 05:47:20 +08:00
complicated timing driven placement and routing used by most commercial place and route tools.
2018-08-01 16:24:55 +08:00
2019-11-27 05:47:20 +08:00
It felt like extending arachne-pnr was not going to be the best path forward, so it was decided to build nextpnr as replacement.
2018-08-01 16:24:55 +08:00
2018-08-01 16:45:28 +08:00
### arachne-pnr does X better!
2018-08-01 16:24:55 +08:00
If you have a use case which prevents you from switching to nextpnr from
2018-08-01 16:40:32 +08:00
arachne, we want to hear about it! Please create an issue and we will do our best to solve the problem!
2018-08-01 16:24:55 +08:00
We want nextpnr to be a suitable replacement for anyone who is currently a user
2019-11-27 05:47:20 +08:00
of arachne-pnr, and it is important to bear in mind that arachne-pnr is no
longer in active development.
2018-08-01 16:24:55 +08:00
### Why are you not just contributing to [Verilog to Routing](https://verilogtorouting.org)?
We believe that [Verilog to Routing ](https://verilogtorouting.org ) is a great
2018-08-01 16:51:32 +08:00
toolchain and many of the nextpnr developers have made (and continue to make)
2018-08-01 16:24:55 +08:00
contributions to the project.
2018-08-01 16:40:32 +08:00
VtR is an extremely flexible toolchain but focuses on research around FPGA
2018-08-01 16:24:55 +08:00
architecture and algorithm development. If your goal is research, then we very
much encourage you to look into VtR further!
nextpnr takes a different approach by focusing on users developing FPGA code
for current FPGAs.
We also believe that support for real architectures will enable interesting new
2018-08-01 16:40:32 +08:00
research. nextpnr (like all place and route tools) depends heavily on
2019-11-27 05:47:20 +08:00
research groups like the VtR developers to investigate and push forward FPGA placement and routing algorithms in new and exciting ways.
2018-08-01 16:24:55 +08:00
#### What is VPR?
VPR is the "place and route" tool from Verilog To Routing. It has a similar
role in an FPGA development flow as nextpnr.
### What about [SymbiFlow](http://symbiflow.github.io)?
2018-08-01 16:25:44 +08:00
For the moment [SymbiFlow ](http://github.com/SymbiFlow ) is concentrating on
2018-08-01 16:40:32 +08:00
extending VPR to work with real world architectures.
2018-08-01 16:25:44 +08:00
nextpnr may or may not become a part of SymbiFlow in the future.
2018-08-01 16:24:55 +08:00
### What is [Project Trellis](https://github.com/SymbiFlow/prjtrellis)?
[Project Trellis ](https://github.com/SymbiFlow/prjtrellis ) is the effort to
document the bitstream format for the Lattice ECP5 series of FPGAs. It also
2018-08-01 16:40:32 +08:00
includes tools for ECP5 bitstream generation.
2018-08-01 16:24:55 +08:00
2018-08-01 16:40:32 +08:00
Project Trellis is used by nextpnr to build the ECP5 chip database and
enable support for creation of bitstreams for these parts.
2018-08-01 16:24:55 +08:00
### What is [Project X-Ray](https://github.com/SymbiFlow/prjxray)?
[Project X-Ray ](https://github.com/SymbiFlow/prjxray ) is the effort to document
the bitstream format for the Xilinx Series 7 series of FPGAs. It also includes
tooling around bitstream generation for these parts.
2019-11-27 05:47:20 +08:00
While upstream nextpnr currently does **not** support these Xilinx parts, we expect it might soon be using Project X-Ray in a similar manner to Project Trellis.
2018-08-01 16:24:55 +08:00
2021-06-09 20:13:50 +08:00
### What is [Project IceStorm](http://bygone.clairexen.net/icestorm/)?
2018-08-01 16:24:55 +08:00
2021-06-09 20:13:50 +08:00
[Project IceStorm ](http://bygone.clairexen.net/icestorm/ ) is both a project to
2018-08-01 16:24:55 +08:00
document the bitstream for the Lattice iCE40 series of parts **and** a full
2019-11-27 05:47:20 +08:00
flow including Yosys and arachne-pnr for converting Verilog into a bitstream
for these parts.
2018-08-01 16:24:55 +08:00
As the open source community now has support for multiple different FPGA parts,
2018-08-01 16:40:32 +08:00
in the nextpnr documentation we generally use Project IceStorm to mean the database and
2021-01-28 23:19:06 +08:00
tools that fulfill the same role as Project Trellis or Project X-Ray.