nextpnr/fpga_interchange
Alessandro Comodi 658dadaa70 fpga_interchange: use higher java heap space
Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
2021-03-23 20:36:23 +01:00
..
examples fpga_interchange: use higher java heap space 2021-03-23 20:36:23 +01:00
arch_iterators.h Refactor header structures in FPGA interchange Arch. 2021-03-19 21:36:06 -07:00
arch_pack_io.cc Fix assorted bugs in FPGA interchange. 2021-02-23 14:09:28 -08:00
arch_pybindings.cc Remove isValidBelForCell 2021-02-16 13:31:36 +00:00
arch_pybindings.h Update APIs to conform to style guide. 2021-02-04 16:38:34 -08:00
arch.cc Merge pull request #643 from litghost/id_constants 2021-03-23 17:33:40 +00:00
arch.h Merge pull request #644 from litghost/add_global_buffers 2021-03-23 17:33:55 +00:00
archdefs.h Rework FPGA interchange site router. 2021-03-22 09:54:49 -07:00
cell_parameters.cc Use new parameter definition data in FPGA interchange processing. 2021-03-23 09:01:43 -07:00
cell_parameters.h Use new parameter definition data in FPGA interchange processing. 2021-03-23 09:01:43 -07:00
chipdb.h [FPGA interchange] Add support for global buffers from chipdb. 2021-03-23 09:41:45 -07:00
cost_map.cc Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
cost_map.h Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
dedicated_interconnect.cc Fix compiler warnings introduced by -Wextra 2021-02-25 15:15:25 +00:00
dedicated_interconnect.h Split nextpnr.h to allow for linear inclusion. 2021-03-15 09:05:23 -07:00
family.cmake fpga_interchange: use higher java heap space 2021-03-23 20:36:23 +01:00
flat_wire_map.h Rework FPGA interchange site router. 2021-03-22 09:54:49 -07:00
fpga_interchange.cpp Correct some bugs in writing of physical netlist w.r.t. site sources. 2021-03-22 09:46:43 -07:00
fpga_interchange.h Add FPGA interchange frontend and backend. 2021-02-15 09:54:58 -08:00
lookahead.capnp Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
lookahead.cc Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
lookahead.h Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
luts.cc Refactor header structures in FPGA interchange Arch. 2021-03-19 21:36:06 -07:00
luts.h Use NEXTPNR_NAMESPACE macro's now that headers are seperated. 2021-03-15 18:49:12 +00:00
main.cc Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
README.md Update FPGA interchange README. 2021-02-26 11:01:22 -08:00
sampler.cc Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
sampler.h Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
site_arch.cc Rework FPGA interchange site router. 2021-03-22 09:54:49 -07:00
site_arch.h Initial version of inverter logic. 2021-03-23 09:03:07 -07:00
site_arch.impl.h Initial version of inverter logic. 2021-03-23 09:03:07 -07:00
site_router.cc Merge pull request #640 from litghost/inversion_logic 2021-03-23 16:59:35 +00:00
site_router.h Rework FPGA interchange site router. 2021-03-22 09:54:49 -07:00
site_routing_cache.cc Initial version of inverter logic. 2021-03-23 09:03:07 -07:00
site_routing_cache.h Initial version of inverter logic. 2021-03-23 09:03:07 -07:00
site_routing_storage.h Rework FPGA interchange site router. 2021-03-22 09:54:49 -07:00
type_wire.cc Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
type_wire.h Initial lookahead for FPGA interchange. 2021-03-23 08:16:50 -07:00
xdc.cc Refactor header structures in FPGA interchange Arch. 2021-03-19 21:36:06 -07:00
xdc.h Refactor header structures in FPGA interchange Arch. 2021-03-19 21:36:06 -07:00

FPGA interchange nextpnr architecture

This nextpnr architecture is a meta architecture that in theory will implement any architecture that emits a complete FPGA interchange device database.

FPGA interchange

The FPGA interchange is a set of file formats intended to describe any modern island based FPGA. It consists of three primary file formats:

  • Device database

    • This is a description of a particular FPGA fabric. This description includes placement locations, placement constraints and a complete description of the routing fabric.
    • This file will also include timing information once added.
  • Logical netlist

    • This is the output of a synthesis tool. This is equivalent to the Yosys JSON format, EDIF, or eblif.
    • As part of future nextpnr development, a frontend will be added that takes this format as input.
  • Physical netlist

    • This is the output of a place and route tool. It can describe a clustered design, a partially or fully placed design, and a partially or fully routed design.

Current status

This architecture implementation can be compiled in conjunction with a FPGA interchange device database, and the outputs from fpga_interchange.nextpnr_emit, which is part of the python-fpga-interchange library.

The current implementation is missing essential features for place and route. As these features are added, this implementation will become more useful.

  • The router lookahead is missing, meaning that router runtime performance will be terrible.
  • Pseudo pips (e.g. pips that consume BELs and or site resources) should block their respective resources. This effects designs that have some routing in place before placement.
  • Pseudo site pips (e.g. site pips that route through BELs) should block their respective resources. Without this, using some pseudo site pips could result in invalid placements.
  • Implemented site router lacks important features for tight packing. Also the current site router is relatively untested, so legal configurations may be rejected and illegal configurations may be accepted.
  • Logical netlist macro expansion is not implemented, meaning that any macro primitives are unplaceable. Common macro primitives examples are differential IO buffers (IBUFDS) and some LUT RAM (e.g. RAM64X1D).
  • Timing information is missing from the FPGA interchange device database, so it is also currently missing from the FPGA interchange architecture. Once timing information is added to the device database schema, it needs to be added to the architecture.

FPGA interchange fabrics

Currently only Xilinx 7-series, UltraScale and UltraScale+ fabrics have a device database generator, via RapidWright.

Artix 35T example

Install capnproto if not already installed:

# Or equivalent for your local system.
sudo apt-get install capnproto libcapnp-dev

Install capnproto-java if not already installed:

git clone https://github.com/capnproto/capnproto-java.git
cd capnproto-java
make
sudo make install
Makefile-driven BBA creation

In ${NEXTPNR_DIR}/fpga_interchange/examples/create_bba is a Makefile that should compile nextpnr and create a Xilinx A35 chipdb if java, capnproto and capnproto-java are installed.

Instructions:

cd ${NEXTPNR_DIR}/fpga_interchange/examples/create_bba
make

This will create a virtual env in ${NEXTPNR_DIR}/fpga_interchange/examples/create_bba/build/env that has the python-fpga-interchange library installed. Before running the design examples, enter the virtual env, e.g.:

source ${NEXTPNR_DIR}/fpga_interchange/examples/create_bba/build/env/bin/activate

The chipdb will be written to ${NEXTPNR_DIR}/fpga_interchange/examples/create_bba/build/xc7a35.bin once completed.

Manual BBA creation

This covers the manual set of steps to create a Xilinx A35 chipdb.

Download RapidWright and generate the device database.

# FIXME: Use main branch once interchange branch is merged.
git clone -b interchange https://github.com/Xilinx/RapidWright.git
cd RapidWright
make update_jars

# FIXME: Current RapidWright jars generate database with duplicate PIPs
# https://github.com/Xilinx/RapidWright/issues/127
# Remove this wget once the latest RapidWright JAR is published.
wget https://github.com/Xilinx/RapidWright/releases/download/v2020.2.1-beta/rapidwright-api-lib-2020.2.1_update1.jar
mv rapidwright-api-lib-2020.2.1_update1.jar jars/rapidwright-api-lib-2020.2.0.jar

./scripts/invoke_rapidwright.sh com.xilinx.rapidwright.interchange.DeviceResourcesExample xc7a35tcpg236-1
export RAPIDWRIGHT_PATH=$(pwd)

Set INTERCHANGE_DIR to point to 3rdparty/fpga-interchange-schema:

export INTERCHANGE_DIR=$(NEXTPNR_DIR)/3rdparty/fpga-interchange-schema/interchange

Install python FPGA interchange library.

git clone https://github.com/SymbiFlow/python-fpga-interchange.git
cd python-fpga-interchange
pip install -r requirements.txt

Patch device database with cell constraints and LUT annotations:

python3 -mfpga_interchange.patch \
  --schema_dir ${INTERCHANGE_DIR} \
  --schema device \
  --patch_path constraints \
  --patch_format yaml \
  ${RAPIDWRIGHT_PATH}/xc7a35tcpg236-1.device \
  test_data/series7_constraints.yaml \
  xc7a35tcpg236-1_constraints.device
python3 -mfpga_interchange.patch \
  --schema_dir ${INTERCHANGE_DIR} \
  --schema device \
  --patch_path lutDefinitions \
  --patch_format yaml \
  xc7a35tcpg236-1_constraints.device \
  test_data/series7_luts.yaml \
  xc7a35tcpg236-1_constraints_luts.device

Generate nextpnr BBA and constids.inc from device database:

python3 -mfpga_interchange.nextpnr_emit \
    --schema_dir ${INTERCHANGE_DIR} \
    --output_dir ${NEXTPNR_DIR}/fpga_interchange/ \
    --bel_bucket_seeds test_data/series7_bel_buckets.yaml \
    --device xc7a35tcpg236-1_constraints_luts.device \

Build nextpnr:

cd ${NEXTPNR_DIR}
cmake -DARCH=fpga_interchange .
make -j

Compile generated BBA:

bba/bbasm -l fpga_interchange/chipdb.bba fpga_interchange/chipdb.bin

Run nextpnr archcheck:

./nextpnr-fpga_interchange --chipdb fpga_interchange/chipdb.bin --test

Once nextpnr can complete the place and route task and output the physical netlist, RapidWright can be used to generate a DCP suitable for bitstream output and DRC checks.

${RAPIDWRIGHT_PATH}/scripts/invoke_rapidwright.sh \
    com.xilinx.rapidwright.interchange.PhysicalNetlistToDcp \
    <logical netlist file> <physical netlist file> <XDC file> <output DCP>