Skip to content

Commit

Permalink
ecp5: Allow disabling of global promotion (YosysHQ#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanG077 authored Sep 12, 2024
1 parent 50bd8d0 commit 2627d4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ecp5/globals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions ecp5/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)");
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit 2627d4e

Please sign in to comment.