aboutsummaryrefslogtreecommitdiffstats
path: root/common/route/router2.h
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-04-08 13:42:54 +0100
committergatecat <gatecat@ds0.me>2022-04-08 13:42:54 +0100
commit49f178ed94b5fad00d25dbd12adea0bf4732f803 (patch)
treeea642e20bc07441a800944390e1f904e6ce5b113 /common/route/router2.h
parente42e22575f20b59634f88b5cf694efdb413ff0a0 (diff)
downloadnextpnr-49f178ed94b5fad00d25dbd12adea0bf4732f803.tar.gz
nextpnr-49f178ed94b5fad00d25dbd12adea0bf4732f803.tar.bz2
nextpnr-49f178ed94b5fad00d25dbd12adea0bf4732f803.zip
Split up common into kernel,place,route
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'common/route/router2.h')
-rw-r--r--common/route/router2.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/common/route/router2.h b/common/route/router2.h
new file mode 100644
index 00000000..629453c6
--- /dev/null
+++ b/common/route/router2.h
@@ -0,0 +1,66 @@
+/*
+ * nextpnr -- Next Generation Place and Route
+ *
+ * Copyright (C) 2019 gatecat <gatecat@ds0.me>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "nextpnr.h"
+
+NEXTPNR_NAMESPACE_BEGIN
+
+inline float default_base_cost(Context *ctx, WireId wire, PipId pip, float crit_weight)
+{
+ (void)crit_weight; // unused
+ return ctx->getDelayNS(ctx->getPipDelay(pip).maxDelay() + ctx->getWireDelay(wire).maxDelay() +
+ ctx->getDelayEpsilon());
+}
+
+struct Router2Cfg
+{
+ Router2Cfg(Context *ctx);
+
+ // Maximum iterations for backwards routing attempt
+ int backwards_max_iter;
+ // Maximum iterations for backwards routing attempt for global nets
+ int global_backwards_max_iter;
+ // Padding added to bounding boxes to account for imperfect routing,
+ // congestion, etc
+ int bb_margin_x, bb_margin_y;
+ // Cost factor added to input pin wires; effectively reduces the
+ // benefit of sharing interconnect
+ float ipin_cost_adder;
+ // Cost factor for "bias" towards center location of net
+ float bias_cost_factor;
+ // Starting current and historical congestion cost factor
+ float init_curr_cong_weight, hist_cong_weight;
+ // Current congestion cost multiplier
+ float curr_cong_mult;
+
+ // Weight given to delay estimate in A*. Higher values
+ // mean faster and more directed routing, at the risk
+ // of choosing a less congestion/delay-optimal route
+ float estimate_weight;
+
+ // Print additional performance profiling information
+ bool perf_profile = false;
+
+ std::string heatmap;
+ std::function<float(Context *ctx, WireId wire, PipId pip, float crit_weight)> get_base_cost = default_base_cost;
+};
+
+void router2(Context *ctx, const Router2Cfg &cfg);
+
+NEXTPNR_NAMESPACE_END