From 7142db28a8b828da557729a706c20c8f330ba129 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 25 Feb 2019 11:56:10 +0000 Subject: HeAP: Make HeAP placer optional A CMake option 'BUILD_HEAP' (default on) configures building of the HeAP placer and the associated Eigen3 dependency. Default for the iCE40 is SA placer, with --heap-placer to use HeAP Default for the ECP5 is HeAP placer, as SA placer can take 1hr+ for large ECP5 designs and HeAP tends to give better QoR. --sa-placer can be used to use SA instead, and auto-fallback to SA if HeAP not built. Signed-off-by: David Shah --- ecp5/arch.cc | 19 ++++++++++++++++++- ecp5/main.cc | 8 +++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'ecp5') diff --git a/ecp5/arch.cc b/ecp5/arch.cc index 5ea6a7c3..8385e57b 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -457,6 +457,7 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const auto src_loc = est_location(src), dst_loc = est_location(dst); int dx = abs(src_loc.first - dst_loc.first), dy = abs(src_loc.second - dst_loc.second); + return (130 - 25 * args.speed) * (6 + std::max(dx - 5, 0) + std::max(dy - 5, 0) + 2 * (std::min(dx, 5) + std::min(dy, 5))); @@ -486,6 +487,7 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const } int dx = abs(driver_loc.x - sink_loc.x), dy = abs(driver_loc.y - sink_loc.y); + return (130 - 25 * args.speed) * (6 + std::max(dx - 5, 0) + std::max(dy - 5, 0) + 2 * (std::min(dx, 5) + std::min(dy, 5))); } @@ -505,7 +507,22 @@ bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay // ----------------------------------------------------------------------- -bool Arch::place() { return placer_heap(getCtx()); } +bool Arch::place() +{ + // HeAP is the default unless overriden or not built +#ifdef WITH_HEAP + if (bool_or_default(settings, id("sa_placer"), false)) { +#endif + if (!placer1(getCtx(), Placer1Cfg(getCtx()))) + return false; +#ifdef WITH_HEAP + } else { + if (!placer_heap(getCtx())) + return false; + } +#endif + return true; +} bool Arch::route() { diff --git a/ecp5/main.cc b/ecp5/main.cc index 15027a5a..de279e63 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -59,6 +59,8 @@ po::options_description ECP5CommandHandler::getArchOptions() specific.add_options()("um5g-45k", "set device type to LFE5UM5G-45F"); specific.add_options()("um5g-85k", "set device type to LFE5UM5G-85F"); + specific.add_options()("sa-placer", "use pure simulated annealing placer instead of HeAP analytic placer"); + specific.add_options()("package", po::value(), "select device package (defaults to CABGA381)"); specific.add_options()("speed", po::value(), "select device speedgrade (6, 7 or 8)"); @@ -149,8 +151,12 @@ std::unique_ptr ECP5CommandHandler::createContext() chipArgs.speed = ArchArgs::SPEED_6; } } + auto ctx = std::unique_ptr(new Context(chipArgs)); + + if (vm.count("sa-placer")) + ctx->settings[ctx->id("sa_placer")] = "1"; - return std::unique_ptr(new Context(chipArgs)); + return ctx; } void ECP5CommandHandler::customAfterLoad(Context *ctx) -- cgit v1.2.3