diff options
author | myrtle <gatecat@ds0.me> | 2022-05-08 13:37:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 13:37:53 +0100 |
commit | 769a1f263a6514ee6ac215241e80c311cf81db4c (patch) | |
tree | edd529ffb4511d00d7b221a708f5e25be4914d5d | |
parent | a4949826465fdc5fde89a0f52cc4078fae319cf3 (diff) | |
parent | 27966f101f52415b671cc794b3926a0fc9e667d7 (diff) | |
download | nextpnr-769a1f263a6514ee6ac215241e80c311cf81db4c.tar.gz nextpnr-769a1f263a6514ee6ac215241e80c311cf81db4c.tar.bz2 nextpnr-769a1f263a6514ee6ac215241e80c311cf81db4c.zip |
Merge pull request #982 from YosysHQ/gatecat/ice40-gb-constr-fix
ice40: Fix propagation of constraints through SB_GB
-rw-r--r-- | ice40/pack.cc | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index 92297e8e..9eff053e 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -671,13 +671,6 @@ static void insert_global(Context *ctx, NetInfo *net, bool is_reset, bool is_cen for (auto &user : keep_users) user.cell->ports[user.port].user_idx = net->users.add(user); - if (net->clkconstr) { - glbnet->clkconstr = std::unique_ptr<ClockConstraint>(new ClockConstraint()); - glbnet->clkconstr->low = net->clkconstr->low; - glbnet->clkconstr->high = net->clkconstr->high; - glbnet->clkconstr->period = net->clkconstr->period; - } - ctx->cells[gb->name] = std::move(gb); } @@ -803,6 +796,29 @@ static void promote_globals(Context *ctx) } } +static void copy_gb_constraints(Context *ctx) +{ + // Copy constraints through GBs and PLLs + bool did_something = false; + do { + did_something = false; + for (auto &cell : ctx->cells) { + CellInfo *ci = cell.second.get(); + if (!is_gbuf(ctx, ci)) + continue; + NetInfo *in = ci->getPort(id_USER_SIGNAL_TO_GLOBAL_BUFFER); + NetInfo *out = ci->getPort(id_GLOBAL_BUFFER_OUTPUT); + if (in && out && in->clkconstr && !out->clkconstr) { + out->clkconstr = std::unique_ptr<ClockConstraint>(new ClockConstraint()); + out->clkconstr->low = in->clkconstr->low; + out->clkconstr->high = in->clkconstr->high; + out->clkconstr->period = in->clkconstr->period; + did_something = true; + } + } + } while (did_something); +} + // Figure out where to place PLLs static void place_plls(Context *ctx) { @@ -1711,6 +1727,7 @@ bool Arch::pack() pack_plls(ctx); if (!bool_or_default(ctx->settings, id_no_promote_globals, false)) promote_globals(ctx); + copy_gb_constraints(ctx); ctx->assignArchInfo(); constrain_chains(ctx); ctx->fixupHierarchy(); |