aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/site_routing_cache.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-03-23 16:59:35 +0000
committerGitHub <noreply@github.com>2021-03-23 16:59:35 +0000
commit2300d81c3c3874801176121b1a97446146ec6efd (patch)
treecd4fb58c4a239a360c65f45972e621381b908e42 /fpga_interchange/site_routing_cache.cc
parent8c85e648dfdb73d69d4adbc6420e706d21d61f93 (diff)
parent831b94cdac7af66e11d0e3d67fa3bbff29678d05 (diff)
downloadnextpnr-2300d81c3c3874801176121b1a97446146ec6efd.tar.gz
nextpnr-2300d81c3c3874801176121b1a97446146ec6efd.tar.bz2
nextpnr-2300d81c3c3874801176121b1a97446146ec6efd.zip
Merge pull request #640 from litghost/inversion_logic
Initial inverter logic for FPGA interchange
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);
}