Merge remote-tracking branch 'origin/estdelay' into redist_slack
Conflicts: ecp5/arch.cc generic/arch.cc ice40/arch.cc
This commit is contained in:
commit
2d75053744
@ -93,7 +93,9 @@ delay_t Context::getNetinfoRouteDelay(NetInfo *net_info, int user_idx) const
|
|||||||
WireId src_wire = getNetinfoSourceWire(net_info);
|
WireId src_wire = getNetinfoSourceWire(net_info);
|
||||||
if (src_wire == WireId())
|
if (src_wire == WireId())
|
||||||
return 0;
|
return 0;
|
||||||
WireId cursor = getNetinfoSinkWire(net_info, user_idx);
|
|
||||||
|
WireId dst_wire = getNetinfoSinkWire(net_info, user_idx);
|
||||||
|
WireId cursor = dst_wire;
|
||||||
delay_t delay = 0;
|
delay_t delay = 0;
|
||||||
|
|
||||||
while (cursor != WireId() && cursor != src_wire) {
|
while (cursor != WireId() && cursor != src_wire) {
|
||||||
@ -107,11 +109,9 @@ delay_t Context::getNetinfoRouteDelay(NetInfo *net_info, int user_idx) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cursor == src_wire)
|
if (cursor == src_wire)
|
||||||
delay += getWireDelay(src_wire).maxDelay();
|
return delay + getWireDelay(src_wire).maxDelay();
|
||||||
else
|
|
||||||
delay += estimateDelay(src_wire, cursor);
|
|
||||||
|
|
||||||
return delay;
|
return predictDelay(net_info, net_info->users[user_idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t xorshift32(uint32_t x)
|
static uint32_t xorshift32(uint32_t x)
|
||||||
|
@ -37,10 +37,9 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type
|
|||||||
return 0;
|
return 0;
|
||||||
driver_gb = ctx->getBelGlobalBuf(driver_cell->bel);
|
driver_gb = ctx->getBelGlobalBuf(driver_cell->bel);
|
||||||
driver_loc = ctx->getBelLocation(driver_cell->bel);
|
driver_loc = ctx->getBelLocation(driver_cell->bel);
|
||||||
WireId drv_wire = ctx->getBelPinWire(driver_cell->bel, ctx->portPinFromId(net->driver.port));
|
|
||||||
if (driver_gb)
|
if (driver_gb)
|
||||||
return 0;
|
return 0;
|
||||||
float worst_slack = 1000;
|
delay_t worst_slack = std::numeric_limits<delay_t>::max();
|
||||||
int xmin = driver_loc.x, xmax = driver_loc.x, ymin = driver_loc.y, ymax = driver_loc.y;
|
int xmin = driver_loc.x, xmax = driver_loc.x, ymin = driver_loc.y, ymax = driver_loc.y;
|
||||||
for (auto load : net->users) {
|
for (auto load : net->users) {
|
||||||
if (load.cell == nullptr)
|
if (load.cell == nullptr)
|
||||||
@ -49,9 +48,8 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type
|
|||||||
if (load_cell->bel == BelId())
|
if (load_cell->bel == BelId())
|
||||||
continue;
|
continue;
|
||||||
if (ctx->timing_driven && type == MetricType::COST) {
|
if (ctx->timing_driven && type == MetricType::COST) {
|
||||||
WireId user_wire = ctx->getBelPinWire(load_cell->bel, ctx->portPinFromId(load.port));
|
delay_t net_delay = ctx->predictDelay(net, load);
|
||||||
delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire);
|
auto slack = load.budget - net_delay;
|
||||||
float slack = ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl);
|
|
||||||
if (slack < 0)
|
if (slack < 0)
|
||||||
tns += slack;
|
tns += slack;
|
||||||
worst_slack = std::min(slack, worst_slack);
|
worst_slack = std::min(slack, worst_slack);
|
||||||
@ -72,6 +70,7 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type
|
|||||||
wirelength = wirelen_t((ymax - ymin) + (xmax - xmin));
|
wirelength = wirelen_t((ymax - ymin) + (xmax - xmin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tns = ctx->getDelayNS(tns);
|
||||||
return wirelength;
|
return wirelength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,6 +413,15 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
|
|||||||
return 200 * (abs(src.location.x - dst.location.x) + abs(src.location.y - dst.location.y));
|
return 200 * (abs(src.location.x - dst.location.x) + abs(src.location.y - dst.location.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||||
|
{
|
||||||
|
const auto& driver = net_info->driver;
|
||||||
|
auto driver_loc = getBelLocation(driver.cell->bel);
|
||||||
|
auto sink_loc = getBelLocation(sink.cell->bel);
|
||||||
|
|
||||||
|
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 Arch::getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const { return budget; }
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
@ -776,6 +776,7 @@ struct Arch : BaseCtx
|
|||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
delay_t estimateDelay(WireId src, WireId dst) const;
|
delay_t estimateDelay(WireId src, WireId dst) const;
|
||||||
|
delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||||
delay_t getDelayEpsilon() const { return 20; }
|
delay_t getDelayEpsilon() const { return 20; }
|
||||||
delay_t getRipupDelayPenalty() const { return 200; }
|
delay_t getRipupDelayPenalty() const { return 200; }
|
||||||
float getDelayNS(delay_t v) const { return v * 0.001; }
|
float getDelayNS(delay_t v) const { return v * 0.001; }
|
||||||
|
@ -403,6 +403,17 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
|
|||||||
return (dx + dy) * grid_distance_to_delay;
|
return (dx + dy) * grid_distance_to_delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||||
|
{
|
||||||
|
const auto& driver = net_info->driver;
|
||||||
|
auto driver_loc = getBelLocation(driver.cell->bel);
|
||||||
|
auto sink_loc = getBelLocation(sink.cell->bel);
|
||||||
|
|
||||||
|
int dx = abs(driver_loc.x - driver_loc.x);
|
||||||
|
int dy = abs(sink_loc.y - sink_locy);
|
||||||
|
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 Arch::getBudgetOverride(NetInfo *net_info, int user_idx, delay_t budget) const { return budget; }
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
@ -194,6 +194,7 @@ struct Arch : BaseCtx
|
|||||||
const std::vector<GroupId> &getGroupGroups(GroupId group) const;
|
const std::vector<GroupId> &getGroupGroups(GroupId group) const;
|
||||||
|
|
||||||
delay_t estimateDelay(WireId src, WireId dst) const;
|
delay_t estimateDelay(WireId src, WireId dst) const;
|
||||||
|
delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||||
delay_t getDelayEpsilon() const { return 0.01; }
|
delay_t getDelayEpsilon() const { return 0.01; }
|
||||||
delay_t getRipupDelayPenalty() const { return 1.0; }
|
delay_t getRipupDelayPenalty() const { return 1.0; }
|
||||||
float getDelayNS(delay_t v) const { return v; }
|
float getDelayNS(delay_t v) const { return v; }
|
||||||
|
@ -613,27 +613,31 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
|
|||||||
int xd = x2 - x1, yd = y2 - y1;
|
int xd = x2 - x1, yd = y2 - y1;
|
||||||
int xscale = 120, yscale = 120, offset = 0;
|
int xscale = 120, yscale = 120, offset = 0;
|
||||||
|
|
||||||
|
return xscale * abs(xd) + yscale * abs(yd) + offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const
|
||||||
|
{
|
||||||
|
const auto& driver = net_info->driver;
|
||||||
|
auto driver_loc = getBelLocation(driver.cell->bel);
|
||||||
|
auto sink_loc = getBelLocation(sink.cell->bel);
|
||||||
|
|
||||||
|
if (driver.port == id_cout) {
|
||||||
|
if (driver_loc.y == sink_loc.y)
|
||||||
|
return 0;
|
||||||
|
return 250;
|
||||||
|
}
|
||||||
|
|
||||||
|
int xd = sink_loc.x - driver_loc.x, yd = sink_loc.y - driver_loc.y;
|
||||||
|
int xscale = 120, yscale = 120, offset = 0;
|
||||||
|
|
||||||
// if (chip_info->wire_data[src.index].type == WIRE_TYPE_SP4_VERT) {
|
// if (chip_info->wire_data[src.index].type == WIRE_TYPE_SP4_VERT) {
|
||||||
// yd = yd < -4 ? yd + 4 : (yd < 0 ? 0 : yd);
|
// yd = yd < -4 ? yd + 4 : (yd < 0 ? 0 : yd);
|
||||||
// offset = 500;
|
// offset = 500;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Estimate for output mux
|
if (driver.port == id_o) offset += 330;
|
||||||
for (const auto &bp : getWireBelPins(src)) {
|
if (sink.port == id_i0 || sink.port == id_i1 || sink.port == id_i2 || sink.port == id_i3) offset += 260;
|
||||||
if (bp.pin == PIN_O && getBelType(bp.bel) == TYPE_ICESTORM_LC) {
|
|
||||||
offset += 330;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Estimate for input mux
|
|
||||||
for (const auto &bp : getWireBelPins(dst)) {
|
|
||||||
if ((bp.pin == PIN_I0 || bp.pin == PIN_I1 || bp.pin == PIN_I2 || bp.pin == PIN_I3) &&
|
|
||||||
getBelType(bp.bel) == TYPE_ICESTORM_LC) {
|
|
||||||
offset += 260;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return xscale * abs(xd) + yscale * abs(yd) + offset;
|
return xscale * abs(xd) + yscale * abs(yd) + offset;
|
||||||
}
|
}
|
||||||
|
@ -697,6 +697,7 @@ struct Arch : BaseCtx
|
|||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
delay_t estimateDelay(WireId src, WireId dst) const;
|
delay_t estimateDelay(WireId src, WireId dst) const;
|
||||||
|
delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||||
delay_t getDelayEpsilon() const { return 20; }
|
delay_t getDelayEpsilon() const { return 20; }
|
||||||
delay_t getRipupDelayPenalty() const { return 200; }
|
delay_t getRipupDelayPenalty() const { return 200; }
|
||||||
float getDelayNS(delay_t v) const { return v * 0.001; }
|
float getDelayNS(delay_t v) const { return v * 0.001; }
|
||||||
|
Loading…
Reference in New Issue
Block a user