ecp5: Improve bounding box accuracy

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2020-01-16 12:00:52 +00:00
parent f82e133c7c
commit 5e1aac67db
2 changed files with 34 additions and 10 deletions

View File

@ -496,6 +496,19 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const
{
ArcBounds bb;
bb.x0 = src.location.x;
bb.y0 = src.location.y;
bb.x1 = src.location.x;
bb.y1 = src.location.y;
auto extend = [&](int x, int y) {
bb.x0 = std::min(bb.x0, x);
bb.x1 = std::max(bb.x1, x);
bb.y0 = std::min(bb.y0, y);
bb.y1 = std::max(bb.y1, y);
};
auto est_location = [&](WireId w) -> std::pair<int, int> {
const auto &wire = locInfo(w)->wire_data[w.index];
if (w == gsrclk_wire) {
@ -516,16 +529,18 @@ ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const
};
auto src_loc = est_location(src);
extend(src_loc.first, src_loc.second);
if (wire_loc_overrides.count(src)) {
extend(wire_loc_overrides.at(src).first, wire_loc_overrides.at(src).second);
}
std::pair<int, int> dst_loc;
extend(dst.location.x, dst.location.y);
if (wire_loc_overrides.count(dst)) {
dst_loc = wire_loc_overrides.at(dst);
} else {
dst_loc = est_location(dst);
}
bb.x0 = std::min(src_loc.first, dst_loc.first);
bb.y0 = std::min(src_loc.second, dst_loc.second);
bb.x1 = std::max(src_loc.first, dst_loc.first);
bb.y1 = std::max(src_loc.second, dst_loc.second);
extend(dst_loc.first, dst_loc.second);
return bb;
}

View File

@ -203,17 +203,26 @@ void Arch::setupWireLocations()
CellInfo *ci = cell.second;
if (ci->bel == BelId())
continue;
if (ci->type == id_MULT18X18D || ci->type == id_DCUA) {
if (ci->type == id_MULT18X18D || ci->type == id_DCUA || ci->type == id_DDRDLL || ci->type == id_DQSBUFM ||
ci->type == id_EHXPLLL) {
for (auto &port : ci->ports) {
if (port.second.type != PORT_IN || port.second.net == nullptr)
if (port.second.net == nullptr)
continue;
WireId pw = getBelPinWire(ci->bel, port.first);
if (pw == WireId())
continue;
for (auto uh : getPipsUphill(pw)) {
WireId pip_src = getPipSrcWire(uh);
wire_loc_overrides[pw] = std::make_pair(pip_src.location.x, pip_src.location.y);
break;
if (port.second.type == PORT_OUT) {
for (auto dh : getPipsDownhill(pw)) {
WireId pip_dst = getPipDstWire(dh);
wire_loc_overrides[pw] = std::make_pair(pip_dst.location.x, pip_dst.location.y);
break;
}
} else {
for (auto uh : getPipsUphill(pw)) {
WireId pip_src = getPipSrcWire(uh);
wire_loc_overrides[pw] = std::make_pair(pip_src.location.x, pip_src.location.y);
break;
}
}
}
}