diff options
author | David Shah <davey1576@gmail.com> | 2018-06-14 15:21:00 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-16 14:44:10 +0200 |
commit | 2f01ec51571db02ff1f1fb5b9d6bf47b8ab5f35d (patch) | |
tree | 8954a92f7315c766d5302acbd99671ec566b1d4c | |
parent | 3ef45d2a27416ee14239dde6a69b43c870ea07b7 (diff) | |
download | nextpnr-2f01ec51571db02ff1f1fb5b9d6bf47b8ab5f35d.tar.gz nextpnr-2f01ec51571db02ff1f1fb5b9d6bf47b8ab5f35d.tar.bz2 nextpnr-2f01ec51571db02ff1f1fb5b9d6bf47b8ab5f35d.zip |
Update basic placer to use new API
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | common/place.cc | 14 |
1 files 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 <cmath> #include <iostream> #include <limits> #include <list> @@ -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) { |