YosysHQ / nextpnr

nextpnr portable FPGA place and route tool
ISC License
1.32k stars 245 forks source link

Add timing exception support #1372

Open rowanG077 opened 2 months ago

rowanG077 commented 2 months ago

Still an early work in progress. Based of https://github.com/YosysHQ/nextpnr/pull/1360

This PR aims to add support for the following timing exceptions:

Disclaimer: Below are my thoughts on how to implement it. This is subject to change while I'm writing the code and hit any roadblocks.

We augment the initial forwards and backwards passes during the setup of the timing analyzer. We will essentially have a set of timing exceptions where each timing exception has a set of start- and endpoints.

When finding a startpoint we check if any exception exists on this startpoint, if so we add this exception to the port. If no exception exists we add a special unit exception. When walking forwards we propagate the timing exception through combinational arcs and routing, the same way that is done for the port domains.

When walking backwards we do something very similar. On an endpoint add the timing exceptions that apply to the endpoint or the unit exception. And then propagate the exceptions backwards when traversing.

After this process we know for every port whether a specific timing exception applies. Since only the ports that lie between a timing exception start- and endpoint will have that timing exception set during both the forwards and backwards pass.

This means we do not need any extra traversal of the netlist to add the constraints which is nice because hopefully it won't make stuff much slower.

Now later on when setting the slack/criticalities we can easily check what timing exception, if any, apply to a port. Here it is crucial to have the unit timing exception. A single port may lie on the path of arbitrary many timing exceptions. It may also lie on a non-exception path. To distinguish whether a path is "fully owned by an exception" for a lack of better term we can check whether the unit exception is not set on a port. "fully owned by an exception" means that only the paths given by the start and endpoints given by a constraint are using that particular path.

Given a port we need to resolve what to actually do with the slack and criticality: