aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-01-16 12:00:52 +0000
committerDavid Shah <dave@ds0.me>2020-02-03 11:38:31 +0000
commit5e1aac67db4bec579ca9e8075aa32e4183d1004f (patch)
tree71b512d61187d21226df8672070e148428fbda2e
parentf82e133c7c93b4589b2149631e6b72185148ada9 (diff)
downloadnextpnr-5e1aac67db4bec579ca9e8075aa32e4183d1004f.tar.gz
nextpnr-5e1aac67db4bec579ca9e8075aa32e4183d1004f.tar.bz2
nextpnr-5e1aac67db4bec579ca9e8075aa32e4183d1004f.zip
ecp5: Improve bounding box accuracy
Signed-off-by: David Shah <dave@ds0.me>
-rw-r--r--ecp5/arch.cc23
-rw-r--r--ecp5/arch_place.cc21
2 files changed, 34 insertions, 10 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index e620b3a3..a10be174 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -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;
}
diff --git a/ecp5/arch_place.cc b/ecp5/arch_place.cc
index 6057605b..c5330694 100644
--- a/ecp5/arch_place.cc
+++ b/ecp5/arch_place.cc
@@ -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;
+ }
}
}
}