From 2f01ec51571db02ff1f1fb5b9d6bf47b8ab5f35d Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 14 Jun 2018 15:21:00 +0200 Subject: [PATCH] Update basic placer to use new API Signed-off-by: David Shah --- common/place.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/common/place.cc b/common/place.cc index d28d7ce9..7573e061 100644 --- a/common/place.cc +++ b/common/place.cc @@ -18,6 +18,7 @@ */ #include "place.h" +#include #include #include #include @@ -134,13 +135,18 @@ static void place_cell(Design *design, CellInfo *cell) if (chip.getBelType(bel) == targetType && chip.checkBelAvail(bel) && isValidBelForCell(design, cell, bel)) { float distance = 0; - PosInfo belPosition = chip.getBelPosition(bel); + float belx, bely; + chip.estimatePosition(bel, belx, bely); for (auto port : cell->ports) { const PortInfo &pi = port.second; - if(pi.net != nullptr && pi.type == PORT_IN) { + if (pi.net != nullptr && pi.type == PORT_IN) { CellInfo *drv = pi.net->driver.cell; - if (drv != nullptr && drv->bel != BelId()) - distance += chip.estimateDelay(chip.getBelPosition(drv->bel), belPosition); + if (drv != nullptr && drv->bel != BelId()) { + float otherx, othery; + chip.estimatePosition(drv->bel, otherx, othery); + distance += std::pow(belx - otherx, 2) + + std::pow(bely - othery, 2); + } } } if (distance < best_distance) {