diff options
author | David Shah <dave@ds0.me> | 2020-02-03 12:00:05 +0000 |
---|---|---|
committer | David Shah <dave@ds0.me> | 2020-02-03 12:00:05 +0000 |
commit | ce144addb3644dcb4790b5861bd028d40fc6f15d (patch) | |
tree | 127905af05fa19264358c3233fb80d066de75d21 | |
parent | 7123209324c93297efab6c2b2fc92286196be3fb (diff) | |
download | nextpnr-ce144addb3644dcb4790b5861bd028d40fc6f15d.tar.gz nextpnr-ce144addb3644dcb4790b5861bd028d40fc6f15d.tar.bz2 nextpnr-ce144addb3644dcb4790b5861bd028d40fc6f15d.zip |
ice40: Implement getRouteBoundingBox for router2
Signed-off-by: David Shah <dave@ds0.me>
-rw-r--r-- | ice40/arch.cc | 24 | ||||
-rw-r--r-- | ice40/arch.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc index edc104f0..b429a1cd 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -1255,6 +1255,30 @@ void Arch::assignCellInfo(CellInfo *cell) } } +ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const +{ + ArcBounds bb; + + int src_x = chip_info->wire_data[src.index].x; + int src_y = chip_info->wire_data[src.index].y; + int dst_x = chip_info->wire_data[dst.index].x; + int dst_y = chip_info->wire_data[dst.index].y; + + bb.x0 = src_x; + bb.y0 = src_y; + bb.x1 = src_x; + bb.y1 = src_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); + }; + extend(dst_x, dst_y); + return bb; +} + #ifdef WITH_HEAP const std::string Arch::defaultPlacer = "heap"; #else diff --git a/ice40/arch.h b/ice40/arch.h index a6a3cd70..f2f9069a 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -826,6 +826,8 @@ struct Arch : BaseCtx uint32_t getDelayChecksum(delay_t v) const { return v; } bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const; + ArcBounds getRouteBoundingBox(WireId src, WireId dst) const; + // ------------------------------------------------- bool pack(); |