chipsalliance / fpga-interchange-schema

https://fpga-interchange-schema.readthedocs.io/
Apache License 2.0
51 stars 20 forks source link

Macro (and similar) placement constraints #44

Open gatecat opened 3 years ago

gatecat commented 3 years ago

At the moment, there is no specific constraints on the placement of cells within macros. As nextpnr currently only requires a legal site routing and nothing more, this currently results in a rather 'quirky' placement of something like a RAM128X1D, where route-through LUTs are used to legalise the MUXF7 inputs.

Screenshot from 2021-04-26 11-33-29

The more usual placement of a RAM128X1D, as done by Vivado (and the existing open source Xilinx flows), is to have all the cells in one site and using dedicated paths:

Screenshot from 2021-04-26 14-09-47

It should definitely be possible to infer the placement constraints based on site routing patterns, however there are always edge cases and I think there are some philosophical questions here:

In general, I think there are three approaches possible here:

  1. device resources just describes routing and constraints; and leaves pattern discovery implicitly up to the place and route tool
  2. device resources is more explicit and includes explicit patterns, like whether a macro should be constrained to a site and which bels should be used
  3. device resources is implicit as in (1) but there is a documented set of patterns that a functionally complete place and route tool consuming the format should be able to recognise

In general, I think the pros and cons of (1), and to some extent (3) are:

whereas the pros and cons of (2) are:

I think these questions potentially affect a lot of other design decisions down the line, like clocking and advanced IO support, so I think it's worth having some discussions here and hearing what people think about this.

clavin-xlnx commented 3 years ago

If a macro placement is not quite correct, it will cause errors for Vivado. Perhaps in other flows/architectures, things can be more forgiving. However, in the context of Vivado, there probably has to be some sort of hint or direction provided in order to have a successful implementation with macros. However, I resonate with a simpler schema and less rigidity in specification. Ultimately, for the Interchange to succeed it has to find a careful balance here. Of the 3 approaches you suggested, I would more closely align with #3.

gatecat commented 3 years ago

I've created a Google doc with some discussion on this issue here: https://docs.google.com/document/d/1-0RF7cuNoZl2t0McTYgoXyxXa_8Tqu3JFw9ZL7bLF-I/edit?usp=sharing

Google Docs
FPGA Interchange macros & chains
Macro placement constraints Macros are an expansion of one logical cell into a small, finite number of physical cells. In many cases a specific placement of those cells is intended, or even required. Examples of typical macros are: Distributed RAM (e.g. RAM128X1D) Complex IO (e.g. IOBUFDS) Dual o...