From 80f7ef4b4b5a632e73c077da5810b218969132bc Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 27 Nov 2018 19:06:55 +0000 Subject: ice40: Finer-grained control of global promotion Signed-off-by: David Shah --- ice40/main.cc | 11 ++++++++++- ice40/pack.cc | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ice40/main.cc b/ice40/main.cc index fcc56d04..4b6a9e42 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -65,6 +65,9 @@ po::options_description Ice40CommandHandler::getArchOptions() specific.add_options()("pcf", po::value(), "PCF constraints file to ingest"); specific.add_options()("asc", po::value(), "asc bitstream file to write"); specific.add_options()("read", po::value(), "asc bitstream file to read"); + specific.add_options()("promote-logic", + "enable promotion of 'logic' globals (in addition to clk/ce/sr by default)"); + specific.add_options()("no-promote-globals", "disable all global promotion"); specific.add_options()("tmfuzz", "run path delay estimate fuzzer"); return specific; } @@ -152,7 +155,13 @@ std::unique_ptr Ice40CommandHandler::createContext() if (vm.count("package")) chipArgs.package = vm["package"].as(); - return std::unique_ptr(new Context(chipArgs)); + auto ctx = std::unique_ptr(new Context(chipArgs)); + + if (vm.count("promote-logic")) + ctx->settings[ctx->id("promote_logic")] = "1"; + if (vm.count("no-promote-globals")) + ctx->settings[ctx->id("no_promote_globals")] = "1"; + return ctx; } int main(int argc, char *argv[]) diff --git a/ice40/pack.cc b/ice40/pack.cc index fc28121e..60464230 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -637,7 +637,8 @@ static void promote_globals(Context *ctx) }); if (global_clock->second == 0 && prom_logics < 4 && global_logic->second > logic_fanout_thresh && (global_logic->second > global_cen->second || prom_cens >= cens_available) && - (global_logic->second > global_reset->second || prom_resets >= resets_available)) { + (global_logic->second > global_reset->second || prom_resets >= resets_available) && + bool_or_default(ctx->settings, ctx->id("promote_logic"), false)) { NetInfo *logicnet = ctx->nets[global_logic->first].get(); insert_global(ctx, logicnet, false, false, true); ++prom_globals; @@ -1119,7 +1120,8 @@ bool Arch::pack() pack_carries(ctx); pack_ram(ctx); pack_special(ctx); - promote_globals(ctx); + if (!bool_or_default(ctx->settings, ctx->id("no_promote_globals"), false)) + promote_globals(ctx); ctx->assignArchInfo(); constrain_chains(ctx); ctx->assignArchInfo(); -- cgit v1.2.3