aboutsummaryrefslogtreecommitdiffstats
path: root/nexus
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-09-24 19:12:01 +0100
committergatecat <gatecat@ds0.me>2021-09-24 19:19:26 +0100
commit718ee441a0dcf7328692c67d143f2b26b8ebc61c (patch)
treeadfb3dde2e6a46f5a9907f7aee66b017c8608a1f /nexus
parentab6990f908c9f25c6116ca8f1a4f98242e8b6175 (diff)
downloadnextpnr-718ee441a0dcf7328692c67d143f2b26b8ebc61c.tar.gz
nextpnr-718ee441a0dcf7328692c67d143f2b26b8ebc61c.tar.bz2
nextpnr-718ee441a0dcf7328692c67d143f2b26b8ebc61c.zip
nexus: Add resource cost overrides
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'nexus')
-rw-r--r--nexus/arch.cc21
-rw-r--r--nexus/arch.h2
2 files changed, 21 insertions, 2 deletions
diff --git a/nexus/arch.cc b/nexus/arch.cc
index 95474800..ee7f6304 100644
--- a/nexus/arch.cc
+++ b/nexus/arch.cc
@@ -705,6 +705,21 @@ void Arch::pre_routing()
}
}
}
+namespace {
+float router2_base_cost(Context *ctx, WireId wire, PipId pip, float crit_weight)
+{
+ (void)crit_weight; // unused
+ if (pip != PipId()) {
+ auto &data = ctx->pip_data(pip);
+ if (data.flags & PIP_ZERO_RR_COST)
+ return 1e-12;
+ if (data.flags & PIP_DRMUX_C)
+ return 1e15;
+ }
+ return ctx->getDelayNS(ctx->getPipDelay(pip).maxDelay() + ctx->getWireDelay(wire).maxDelay() +
+ ctx->getDelayEpsilon());
+}
+} // namespace
bool Arch::route()
{
@@ -719,7 +734,9 @@ bool Arch::route()
if (router == "router1") {
result = router1(getCtx(), Router1Cfg(getCtx()));
} else if (router == "router2") {
- router2(getCtx(), Router2Cfg(getCtx()));
+ Router2Cfg cfg(getCtx());
+ cfg.get_base_cost = router2_base_cost;
+ router2(getCtx(), cfg);
result = true;
} else {
log_error("Nexus architecture does not support router '%s'\n", router.c_str());
@@ -1030,7 +1047,7 @@ const std::vector<std::string> Arch::availablePlacers = {"sa",
};
-const std::string Arch::defaultRouter = "router1";
+const std::string Arch::defaultRouter = "router2";
const std::vector<std::string> Arch::availableRouters = {"router1", "router2"};
NEXTPNR_NAMESPACE_END
diff --git a/nexus/arch.h b/nexus/arch.h
index 300c3760..3e718e78 100644
--- a/nexus/arch.h
+++ b/nexus/arch.h
@@ -87,6 +87,8 @@ enum PipFlags
{
PIP_FIXED_CONN = 0x8000,
PIP_LUT_PERM = 0x4000,
+ PIP_ZERO_RR_COST = 0x2000,
+ PIP_DRMUX_C = 0x1000,
};
NPNR_PACKED_STRUCT(struct PipInfoPOD {