From a06fa4862e3c01f7440e952a8001bfaf84619a8a Mon Sep 17 00:00:00 2001 From: gatecat Date: Mon, 27 Jul 2026 10:58:27 +0200 Subject: [PATCH] ice40: Allow disablement of CE global promotion Signed-off-by: gatecat --- ice40/constids.inc | 1 + ice40/main.cc | 3 +++ ice40/pack.cc | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ice40/constids.inc b/ice40/constids.inc index 89b3bacd..2911b6ae 100644 --- a/ice40/constids.inc +++ b/ice40/constids.inc @@ -616,3 +616,4 @@ X(u4k) X(up3k) X(up5k) X(noglobal) +X(no_promote_ce) diff --git a/ice40/main.cc b/ice40/main.cc index 0d645604..82526b8c 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -79,6 +79,7 @@ po::options_description Ice40CommandHandler::getArchOptions() 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()("no-promote-ce", "disable promotion of 'ce' globals"); specific.add_options()("opt-timing", "run post-placement timing optimisation pass (experimental)"); specific.add_options()("tmfuzz", "run path delay estimate fuzzer"); specific.add_options()("pcf-allow-unconstrained", "don't require PCF to constrain all IO"); @@ -266,6 +267,8 @@ std::unique_ptr Ice40CommandHandler::createContext(dictsettings[id_promote_logic] = Property::State::S1; if (vm.count("no-promote-globals")) ctx->settings[id_no_promote_globals] = Property::State::S1; + if (vm.count("no-promote-ce")) + ctx->settings[id_no_promote_ce] = Property::State::S1; if (vm.count("opt-timing")) ctx->settings[id_opt_timing] = Property::State::S1; if (vm.count("pcf-allow-unconstrained")) diff --git a/ice40/pack.cc b/ice40/pack.cc index 119568f5..16eb5a11 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -774,8 +774,9 @@ static void promote_globals(Context *ctx) reset_count.erase(rstnet->name); cen_count.erase(rstnet->name); logic_count.erase(rstnet->name); - } else if (global_cen->second > global_clock->second && prom_cens < cens_available && - global_cen->second > enable_fanout_thresh) { + } else if ((global_cen->second > global_clock->second && prom_cens < cens_available && + global_cen->second > enable_fanout_thresh) && + !bool_or_default(ctx->settings, id_no_promote_ce, false)) { NetInfo *cennet = ctx->nets[global_cen->first].get(); insert_global(ctx, cennet, false, true, false, global_cen->second); ++prom_globals;