diff options
Diffstat (limited to 'ice40/arch.cc')
-rw-r--r-- | ice40/arch.cc | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc index 0f8e5969..a43c4c21 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -28,6 +28,7 @@ #include "placer1.h" #include "placer_heap.h" #include "router1.h" +#include "router2.h" #include "timing_opt.h" #include "util.h" NEXTPNR_NAMESPACE_BEGIN @@ -696,10 +697,19 @@ bool Arch::place() bool Arch::route() { - bool retVal = router1(getCtx(), Router1Cfg(getCtx())); + std::string router = str_or_default(settings, id("router"), defaultRouter); + bool result; + if (router == "router1") { + result = router1(getCtx(), Router1Cfg(getCtx())); + } else if (router == "router2") { + router2(getCtx(), Router2Cfg(getCtx())); + result = true; + } else { + log_error("iCE40 architecture does not support router '%s'\n", router.c_str()); + } getCtx()->settings[getCtx()->id("route")] = 1; archInfoToAttributes(); - return retVal; + return result; } // ----------------------------------------------------------------------- @@ -1245,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 @@ -1257,4 +1291,7 @@ const std::vector<std::string> Arch::availablePlacers = {"sa", #endif }; +const std::string Arch::defaultRouter = "router1"; +const std::vector<std::string> Arch::availableRouters = {"router1", "router2"}; + NEXTPNR_NAMESPACE_END |