aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/site_routing_cache.cc
diff options
context:
space:
mode:
authorKeith Rothman <537074+litghost@users.noreply.github.com>2021-03-22 17:38:15 -0700
committerKeith Rothman <537074+litghost@users.noreply.github.com>2021-03-23 09:03:07 -0700
commit831b94cdac7af66e11d0e3d67fa3bbff29678d05 (patch)
treef87d796b133ad79be4602f4436a4cfc6c0bb4001 /fpga_interchange/site_routing_cache.cc
parentae71206e1f9522542b919b0dd5b3e634a680dc03 (diff)
downloadnextpnr-831b94cdac7af66e11d0e3d67fa3bbff29678d05.tar.gz
nextpnr-831b94cdac7af66e11d0e3d67fa3bbff29678d05.tar.bz2
nextpnr-831b94cdac7af66e11d0e3d67fa3bbff29678d05.zip
Initial version of inverter logic.
For now just implements some inspection capabilities, and the site router (for now) avoids inverted paths. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'fpga_interchange/site_routing_cache.cc')
-rw-r--r--fpga_interchange/site_routing_cache.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/fpga_interchange/site_routing_cache.cc b/fpga_interchange/site_routing_cache.cc
index f7321a46..e6f4dc70 100644
--- a/fpga_interchange/site_routing_cache.cc
+++ b/fpga_interchange/site_routing_cache.cc
@@ -31,14 +31,27 @@ void SiteRoutingSolution::store_solution(const SiteArch *ctx, const RouteNodeSto
clear();
solution_sinks.reserve(solutions.size());
+ inverted.reserve(solutions.size());
+ can_invert.reserve(solutions.size());
for (size_t route : solutions) {
+ bool sol_inverted = false;
+ bool sol_can_invert = false;
+
SiteWire wire = node_storage->get_node(route)->wire;
solution_sinks.push_back(wire);
solution_offsets.push_back(solution_storage.size());
Node cursor = node_storage->get_node(route);
while (cursor.has_parent()) {
+ if (ctx->isInverting(cursor->pip) && !sol_can_invert) {
+ sol_inverted = !sol_inverted;
+ }
+ if (ctx->canInvert(cursor->pip)) {
+ sol_inverted = false;
+ sol_can_invert = true;
+ }
+
solution_storage.push_back(cursor->pip);
Node parent = cursor.parent();
NPNR_ASSERT(ctx->getPipDstWire(cursor->pip) == cursor->wire);
@@ -46,6 +59,9 @@ void SiteRoutingSolution::store_solution(const SiteArch *ctx, const RouteNodeSto
cursor = parent;
}
+ inverted.push_back(sol_inverted);
+ can_invert.push_back(sol_can_invert);
+
NPNR_ASSERT(cursor->wire == driver);
}