Add predictDelay Arch API

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-07-30 15:35:40 +02:00
parent b5f90d3814
commit 0daffec2a0
7 changed files with 38 additions and 5 deletions

View File

@ -93,7 +93,9 @@ delay_t Context::getNetinfoRouteDelay(NetInfo *net_info, int user_idx) const
WireId src_wire = getNetinfoSourceWire(net_info);
if (src_wire == WireId())
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;
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)
delay += getWireDelay(src_wire).maxDelay();
else
delay += estimateDelay(src_wire, cursor);
return delay + getWireDelay(src_wire).maxDelay();
return delay;
return predictDelay(src_wire, dst_wire);
}
static uint32_t xorshift32(uint32_t x)

View File

@ -413,6 +413,11 @@ 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));
}
delay_t Arch::predictDelay(WireId src, WireId dst) const
{
return 200 * (abs(src.location.x - dst.location.x) + abs(src.location.y - dst.location.y));
}
// -----------------------------------------------------------------------
bool Arch::place() { return placer1(getCtx()); }

View File

@ -776,6 +776,7 @@ struct Arch : BaseCtx
// -------------------------------------------------
delay_t estimateDelay(WireId src, WireId dst) const;
delay_t predictDelay(WireId src, WireId dst) const;
delay_t getDelayEpsilon() const { return 20; }
delay_t getRipupDelayPenalty() const { return 200; }
float getDelayNS(delay_t v) const { return v * 0.001; }

View File

@ -403,6 +403,15 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
return (dx + dy) * grid_distance_to_delay;
}
delay_t Arch::predictDelay(WireId src, WireId dst) const
{
const WireInfo &s = wires.at(src);
const WireInfo &d = wires.at(dst);
int dx = abs(s.x - d.x);
int dy = abs(s.y - d.y);
return (dx + dy) * grid_distance_to_delay;
}
// ---------------------------------------------------------------
bool Arch::place() { return placer1(getCtx()); }

View File

@ -194,6 +194,7 @@ struct Arch : BaseCtx
const std::vector<GroupId> &getGroupGroups(GroupId group) const;
delay_t estimateDelay(WireId src, WireId dst) const;
delay_t predictDelay(WireId src, WireId dst) const;
delay_t getDelayEpsilon() const { return 0.01; }
delay_t getRipupDelayPenalty() const { return 1.0; }
float getDelayNS(delay_t v) const { return v; }

View File

@ -579,6 +579,22 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
int xd = x2 - x1, yd = y2 - y1;
int xscale = 120, yscale = 120, offset = 0;
return xscale * abs(xd) + yscale * abs(yd) + offset;
}
delay_t Arch::predictDelay(WireId src, WireId dst) const
{
NPNR_ASSERT(src != WireId());
int x1 = chip_info->wire_data[src.index].x;
int y1 = chip_info->wire_data[src.index].y;
NPNR_ASSERT(dst != WireId());
int x2 = chip_info->wire_data[dst.index].x;
int y2 = chip_info->wire_data[dst.index].y;
int xd = x2 - x1, yd = y2 - y1;
int xscale = 120, yscale = 120, offset = 0;
// if (chip_info->wire_data[src.index].type == WIRE_TYPE_SP4_VERT) {
// yd = yd < -4 ? yd + 4 : (yd < 0 ? 0 : yd);
// offset = 500;

View File

@ -684,6 +684,7 @@ struct Arch : BaseCtx
// -------------------------------------------------
delay_t estimateDelay(WireId src, WireId dst) const;
delay_t predictDelay(WireId src, WireId dst) const;
delay_t getDelayEpsilon() const { return 20; }
delay_t getRipupDelayPenalty() const { return 200; }
float getDelayNS(delay_t v) const { return v * 0.001; }