ecp5: Allow disabling of global promotion (#1367)

This commit is contained in:
Rowan Goemans 2024-09-12 20:16:17 +02:00 committed by GitHub
parent 50bd8d09b0
commit 2627d4e0ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -48,7 +48,7 @@ static std::string get_quad_name(GlobalQuadrant quad)
class Ecp5GlobalRouter
{
public:
Ecp5GlobalRouter(Context *ctx) : ctx(ctx){};
Ecp5GlobalRouter(Context *ctx) : ctx(ctx) {};
private:
bool is_clock_port(const PortRef &user)
@ -512,11 +512,12 @@ class Ecp5GlobalRouter
public:
void promote_globals()
{
bool disable_promotion = bool_or_default(ctx->settings, ctx->id("arch.no-promote-globals"));
bool is_ooc = bool_or_default(ctx->settings, ctx->id("arch.ooc"));
log_info("Promoting globals...\n");
auto clocks = get_clocks();
for (auto clock : clocks) {
bool is_noglobal = bool_or_default(clock->attrs, id_noglobal, false) ||
bool is_noglobal = disable_promotion || bool_or_default(clock->attrs, id_noglobal, false) ||
bool_or_default(clock->attrs, id_ECP5_IS_GLOBAL, false);
if (is_noglobal)
continue;

View File

@ -33,9 +33,9 @@ class ECP5CommandHandler : public CommandHandler
{
public:
ECP5CommandHandler(int argc, char **argv);
virtual ~ECP5CommandHandler(){};
virtual ~ECP5CommandHandler() {};
std::unique_ptr<Context> createContext(dict<std::string, Property> &values) override;
void setupArchContext(Context *ctx) override{};
void setupArchContext(Context *ctx) override {};
void customAfterLoad(Context *ctx) override;
void validate() override;
void customBitstream(Context *ctx) override;
@ -82,6 +82,7 @@ po::options_description ECP5CommandHandler::getArchOptions()
specific.add_options()("lpf", po::value<std::vector<std::string>>(), "LPF pin constraint file(s)");
specific.add_options()("lpf-allow-unconstrained", "don't require LPF file(s) to constrain all IO");
specific.add_options()("no-promote-globals", "disable all global promotion");
specific.add_options()(
"out-of-context",
"disable IO buffer insertion and global promotion/routing, for building pre-routed blocks (experimental)");
@ -253,6 +254,8 @@ std::unique_ptr<Context> ECP5CommandHandler::createContext(dict<std::string, Pro
ctx->settings[ctx->id(val.first)] = val.second;
ctx->settings[ctx->id("arch.package")] = ctx->archArgs().package;
ctx->settings[ctx->id("arch.speed")] = speedString(ctx->archArgs().speed);
if (vm.count("no-promote-globals"))
ctx->settings[ctx->id("arch.no-promote-globals")] = 1;
if (vm.count("out-of-context"))
ctx->settings[ctx->id("arch.ooc")] = 1;
if (vm.count("disable-router-lutperm"))