Supported devices
See the vendor directory for supported devices and toolchain details.
Devices supported as of 18 JUL 2021:
Device | Platform | Toolchain required |
---|---|---|
Lattice iCE40 | Yosys+nextpnr, LSE-iCECube2, Synplify-iCECube2 | |
Lattice MachXO2 | Diamond | |
Lattice ECP5 | Yosys+nextpnr, Diamond | |
Xilinx Spartan 3A | Xilinx | ISE |
Xilinx Spartan 6 | Xilinx | ISE |
Xilinx 7-series (Arty, Spartan, Kintex, Virtex) | Xilinx | Vivado |
Xilinx UltraScale | XilinxUltraScalePlatform | Vivado |
Intel | IntelPlatform | Quartus |
Defining your board
Many boards are defined for you at nmigen_boards.
You can copy one from there and modify it to suit you needs, or create a new class subclassed from one of the above supported device platform classes. For example, I am using Xilinx-KC705 for my development.
Class properties
device
: a string. See the base platform class for which one to choose. This affects options passed to the toolchain so that it compiles for the correct chip.package
: a string. See the base platform class for which one to choose. This affects options passed to the toolchain so that it compiles for the correct package of the chip.resources
: a list ofResource
. This names the pins you want to use, and configuration options for each such pin.default_clk
: the name of the resource that is the clock for the default clock domain.default_rst
: the name of the resource that is the reset for the default clock domain.connectors
: optional, a list ofConnector
. It isn’t obvious what purpose this serves. It may have something to do with certain toolchains.
Resources
A Resource
is a structure that contains a name, a number, and one or more configuration items for the resource. Adding a Resource
to a board does two things:
- configures pin on the device
- allows you to request a resource’s
pin
by name from the platform in yourelaborate
function.Such apin
has severalsignal
associated with it, such asi
for input ando
for output, which you can then use in your module.
For example, by including this Resource
into the platform’s resource
list:
Resource("abc", 0, Pins("J3", dir="i"))
Then pin J3
on the device will be configured as an input, and you can request the abc
resource’s input Signal
like this
platform.request("abc").i
Resource configuration items
Pins
: specifies the space-separated pin names associated with resource, their direction type, and whether the signal should be automativally inverted when crossing the pin(for, e.g., active low signals). Direction types are:
i
: input only. Signal for the pin is.i
o
: output only. Signal for the pin is.o
io
: bidirectional. Signals for the pin are.o
for the output, and.oe
is the direction for the pin: 0 for input, 1 for output.oe
: tristate. Signals for the pin.o
for the output, and.oe
to enable output: 0 for disable, 1 for enable.
PinsN
: shorthand forPins
, where all pins are active low.DiffPairs
: specifies the space-separated pin names for one or more differential pairs (positive and negative pins)Clock
: specifies that the resource is a clock with the given frequency in Hz.Attrs
: platform-specific attributes such as voltage standard to select.
A full resource specification for a clock pin used on a Lattice ICE40 board could be as follows:
Resource("clk", 0, Pins("J3",dir="i"), Clock(12e6),Attrs(GLOBAL=True, IO_STANDARD="SB_LVCMOS"))
This example says that the clk
resource is at pin J3
on the FPGA. J3
is defined by vender of your FPGA. For example, KC705 pin map can be found at here. clk
has a frequency of 12MHz, is a “global” signal, and uses the LVCMOS voltage standard. Without knowing about the toolchain for the platform, you will not know what attributes are required.
Example for the Xilinx-KC705.
|
|
You can see that it is not well define yet. Let’s take a look into arty-a7 board.
|
|
Building
|
|
This will result in a directory, build
, containing the output files:
top.il
: The ilang output for yosys.top.bin
: The bitstream to send to the device (e.g. via iceprog)top.rpt
: Statistics from nextpnr. The most useful is the cell and LUTtop.tim
: Timing analysis. Shows how fast you can go. Probably.