From 565d5eed17897d048941beba37db3e19b733949d Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 12 Feb 2019 10:56:17 +0000 Subject: ecp5: Fix global routing performance Signed-off-by: David Shah --- ecp5/arch.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'ecp5/arch.cc') diff --git a/ecp5/arch.cc b/ecp5/arch.cc index a2036033..b71e877d 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -400,7 +400,28 @@ BelId Arch::getBelByLocation(Loc loc) const delay_t Arch::estimateDelay(WireId src, WireId dst) const { - return (240 - 20 * args.speed) * (abs(src.location.x - dst.location.x) + abs(src.location.y - dst.location.y)); + auto est_location = [&](WireId w) -> std::pair { + if (w.location.x == 0 && w.location.y == 0) { + // Global wires + const auto &wire = locInfo(w)->wire_data[w.index]; + // Use location of first downhill bel or pip, if available + if (wire.num_bel_pins > 0) { + return std::make_pair(wire.bel_pins[0].rel_bel_loc.x, wire.bel_pins[0].rel_bel_loc.y); + } else if (wire.num_downhill > 0) { + return std::make_pair(wire.pips_downhill[0].rel_loc.x, wire.pips_downhill[0].rel_loc.y); + } else if (wire.num_uphill > 0) { + return std::make_pair(wire.pips_uphill[0].rel_loc.x, wire.pips_uphill[0].rel_loc.y); + } else { + return std::make_pair(0, 0); + } + } else { + return std::make_pair(w.location.x, w.location.y); + } + }; + + auto src_loc = est_location(src), dst_loc = est_location(dst); + + return (240 - 20 * args.speed) * (abs(src_loc.first - dst_loc.first) + abs(src_loc.second - dst_loc.second)); } delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const -- cgit v1.2.3