Modify the getNetinfo*() functions and getBudgetOverride() to not use
user_idx and to take a PortRef& instead
This commit is contained in:
parent
720e815865
commit
f646ec790a
@ -51,7 +51,7 @@ void IdString::initialize_add(const BaseCtx *ctx, const char *s, int idx)
|
||||
ctx->idstring_idx_to_str->push_back(&insert_rc.first->first);
|
||||
}
|
||||
|
||||
WireId Context::getNetinfoSourceWire(NetInfo *net_info) const
|
||||
WireId Context::getNetinfoSourceWire(const NetInfo *net_info) const
|
||||
{
|
||||
if (net_info->driver.cell == nullptr)
|
||||
return WireId();
|
||||
@ -70,9 +70,8 @@ WireId Context::getNetinfoSourceWire(NetInfo *net_info) const
|
||||
return getBelPinWire(src_bel, portPinFromId(driver_port));
|
||||
}
|
||||
|
||||
WireId Context::getNetinfoSinkWire(NetInfo *net_info, int user_idx) const
|
||||
WireId Context::getNetinfoSinkWire(const NetInfo *net_info, const PortRef& user_info) const
|
||||
{
|
||||
auto &user_info = net_info->users[user_idx];
|
||||
auto dst_bel = user_info.cell->bel;
|
||||
|
||||
if (dst_bel == BelId())
|
||||
@ -88,13 +87,13 @@ WireId Context::getNetinfoSinkWire(NetInfo *net_info, int user_idx) const
|
||||
return getBelPinWire(dst_bel, portPinFromId(user_port));
|
||||
}
|
||||
|
||||
delay_t Context::getNetinfoRouteDelay(NetInfo *net_info, int user_idx) const
|
||||
delay_t Context::getNetinfoRouteDelay(const NetInfo *net_info, const PortRef& user_info) const
|
||||
{
|
||||
WireId src_wire = getNetinfoSourceWire(net_info);
|
||||
if (src_wire == WireId())
|
||||
return 0;
|
||||
|
||||
WireId dst_wire = getNetinfoSinkWire(net_info, user_idx);
|
||||
WireId dst_wire = getNetinfoSinkWire(net_info, user_info);
|
||||
WireId cursor = dst_wire;
|
||||
delay_t delay = 0;
|
||||
|
||||
@ -111,7 +110,7 @@ delay_t Context::getNetinfoRouteDelay(NetInfo *net_info, int user_idx) const
|
||||
if (cursor == src_wire)
|
||||
return delay + getWireDelay(src_wire).maxDelay();
|
||||
|
||||
return predictDelay(net_info, net_info->users[user_idx]);
|
||||
return predictDelay(net_info, user_info);
|
||||
}
|
||||
|
||||
static uint32_t xorshift32(uint32_t x)
|
||||
|
@ -482,9 +482,9 @@ struct Context : Arch, DeterministicRNG
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
WireId getNetinfoSourceWire(NetInfo *net_info) const;
|
||||
WireId getNetinfoSinkWire(NetInfo *net_info, int user_idx) const;
|
||||
delay_t getNetinfoRouteDelay(NetInfo *net_info, int user_idx) const;
|
||||
WireId getNetinfoSourceWire(const NetInfo *net_info) const;
|
||||
WireId getNetinfoSinkWire(const NetInfo *net_info, const PortRef& sink) const;
|
||||
delay_t getNetinfoRouteDelay(const NetInfo *net_info, const PortRef& sink) const;
|
||||
|
||||
// provided by router1.cc
|
||||
bool getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay);
|
||||
|
@ -298,7 +298,7 @@ struct Router
|
||||
src_wires[src_wire] = ctx->getWireDelay(src_wire).maxDelay();
|
||||
|
||||
for (int user_idx = 0; user_idx < int(net_info->users.size()); user_idx++) {
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, user_idx);
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx]);
|
||||
|
||||
if (dst_wire == WireId())
|
||||
log_error("No wire found for port %s on destination cell %s.\n",
|
||||
@ -352,7 +352,7 @@ struct Router
|
||||
log(" Route to: %s.%s.\n", net_info->users[user_idx].cell->name.c_str(ctx),
|
||||
net_info->users[user_idx].port.c_str(ctx));
|
||||
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, user_idx);
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx]);
|
||||
|
||||
if (dst_wire == WireId())
|
||||
log_error("No wire found for port %s on destination cell %s.\n",
|
||||
@ -483,7 +483,7 @@ void addFullNetRouteJob(Context *ctx, IdString net_name, std::unordered_map<IdSt
|
||||
if (net_cache[user_idx])
|
||||
continue;
|
||||
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, user_idx);
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx]);
|
||||
|
||||
if (dst_wire == WireId())
|
||||
log_error("No wire found for port %s on destination cell %s.\n", net_info->users[user_idx].port.c_str(ctx),
|
||||
@ -540,7 +540,7 @@ void addNetRouteJobs(Context *ctx, IdString net_name, std::unordered_map<IdStrin
|
||||
if (net_cache[user_idx])
|
||||
continue;
|
||||
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, user_idx);
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx]);
|
||||
|
||||
if (dst_wire == WireId())
|
||||
log_error("No wire found for port %s on destination cell %s.\n", net_info->users[user_idx].port.c_str(ctx),
|
||||
@ -767,7 +767,7 @@ bool router1(Context *ctx)
|
||||
bool got_negative_slack = false;
|
||||
NetInfo *net_info = ctx->nets.at(net_it.first).get();
|
||||
for (int user_idx = 0; user_idx < int(net_info->users.size()); user_idx++) {
|
||||
delay_t arc_delay = ctx->getNetinfoRouteDelay(net_info, user_idx);
|
||||
delay_t arc_delay = ctx->getNetinfoRouteDelay(net_info, net_info->users[user_idx]);
|
||||
delay_t arc_budget = net_info->users[user_idx].budget;
|
||||
delay_t arc_slack = arc_budget - arc_delay;
|
||||
if (arc_slack < 0) {
|
||||
@ -779,7 +779,7 @@ bool router1(Context *ctx)
|
||||
if (ctx->verbose)
|
||||
log_info(" arc %s -> %s has %f ns slack (delay %f, budget %f)\n",
|
||||
ctx->getWireName(ctx->getNetinfoSourceWire(net_info)).c_str(ctx),
|
||||
ctx->getWireName(ctx->getNetinfoSinkWire(net_info, user_idx)).c_str(ctx),
|
||||
ctx->getWireName(ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx])).c_str(ctx),
|
||||
ctx->getDelayNS(arc_slack), ctx->getDelayNS(arc_delay),
|
||||
ctx->getDelayNS(arc_budget));
|
||||
tns += ctx->getDelayNS(arc_slack);
|
||||
|
@ -72,18 +72,17 @@ static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t s
|
||||
PortRefList *current_path, PortRefList *crit_path)
|
||||
{
|
||||
delay_t net_budget = slack / (path_length + 1);
|
||||
for (unsigned i = 0; i < net->users.size(); ++i) {
|
||||
auto &usr = net->users[i];
|
||||
for (auto &usr : net->users) {
|
||||
if (crit_path)
|
||||
current_path->push_back(&usr);
|
||||
// If budget override is less than existing budget, then do not increment path length
|
||||
int pl = path_length + 1;
|
||||
auto budget = ctx->getBudgetOverride(net, i, net_budget);
|
||||
auto budget = ctx->getBudgetOverride(net, usr, net_budget);
|
||||
if (budget < net_budget) {
|
||||
net_budget = budget;
|
||||
pl = std::max(1, path_length);
|
||||
}
|
||||
auto delay = ctx->getNetinfoRouteDelay(net, i);
|
||||
auto delay = ctx->getNetinfoRouteDelay(net, usr);
|
||||
net_budget = std::min(
|
||||
net_budget, follow_user_port(ctx, usr, pl, slack - delay, update, min_slack, current_path, crit_path));
|
||||
if (update)
|
||||
@ -189,12 +188,6 @@ delay_t timing_analysis(Context *ctx, bool print_fmax, bool print_path)
|
||||
auto sink_cell = sink->cell;
|
||||
auto &port = sink_cell->ports.at(sink->port);
|
||||
auto net = port.net;
|
||||
unsigned i = 0;
|
||||
for (auto &usr : net->users)
|
||||
if (&usr == sink)
|
||||
break;
|
||||
else
|
||||
++i;
|
||||
auto &driver = net->driver;
|
||||
auto driver_cell = driver.cell;
|
||||
DelayInfo comb_delay;
|
||||
@ -202,7 +195,7 @@ delay_t timing_analysis(Context *ctx, bool print_fmax, bool print_path)
|
||||
total += comb_delay.maxDelay();
|
||||
log_info("%4d %4d Source %s.%s\n", comb_delay.maxDelay(), total, driver_cell->name.c_str(ctx),
|
||||
driver.port.c_str(ctx));
|
||||
auto net_delay = ctx->getNetinfoRouteDelay(net, i);
|
||||
auto net_delay = ctx->getNetinfoRouteDelay(net, *sink);
|
||||
total += net_delay;
|
||||
auto driver_loc = ctx->getBelLocation(driver_cell->bel);
|
||||
auto sink_loc = ctx->getBelLocation(sink_cell->bel);
|
||||
|
@ -422,7 +422,7 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||
return 200 * (abs(driver_loc.x - sink_loc.x) + abs(driver_loc.y - sink_loc.y));
|
||||
}
|
||||
|
||||
delay_t Arch::getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const { return budget; }
|
||||
delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const { return budget; }
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
@ -781,7 +781,7 @@ struct Arch : BaseCtx
|
||||
delay_t getRipupDelayPenalty() const { return 200; }
|
||||
float getDelayNS(delay_t v) const { return v * 0.001; }
|
||||
uint32_t getDelayChecksum(delay_t v) const { return v; }
|
||||
delay_t getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const;
|
||||
delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const;
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
|
@ -414,7 +414,7 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||
return (dx + dy) * grid_distance_to_delay;
|
||||
}
|
||||
|
||||
delay_t Arch::getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const { return budget; }
|
||||
delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const { return budget; }
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
@ -199,7 +199,7 @@ struct Arch : BaseCtx
|
||||
delay_t getRipupDelayPenalty() const { return 1.0; }
|
||||
float getDelayNS(delay_t v) const { return v; }
|
||||
uint32_t getDelayChecksum(delay_t v) const { return 0; }
|
||||
delay_t getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const;
|
||||
delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const;
|
||||
|
||||
bool pack() { return true; }
|
||||
bool place();
|
||||
|
@ -642,11 +642,10 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const
|
||||
return xscale * abs(xd) + yscale * abs(yd) + offset;
|
||||
}
|
||||
|
||||
delay_t Arch::getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const
|
||||
delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef& sink, delay_t budget) const
|
||||
{
|
||||
const auto &driver = net_info->driver;
|
||||
if (driver.port == id_cout) {
|
||||
const auto &sink = net_info->users[user_idx];
|
||||
auto driver_loc = getBelLocation(driver.cell->bel);
|
||||
auto sink_loc = getBelLocation(sink.cell->bel);
|
||||
if (driver_loc.y == sink_loc.y)
|
||||
|
@ -702,7 +702,7 @@ struct Arch : BaseCtx
|
||||
delay_t getRipupDelayPenalty() const { return 200; }
|
||||
float getDelayNS(delay_t v) const { return v * 0.001; }
|
||||
uint32_t getDelayChecksum(delay_t v) const { return v; }
|
||||
delay_t getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const;
|
||||
delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const;
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user