aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/place_sa.cc24
-rw-r--r--common/route.cc16
2 files changed, 22 insertions, 18 deletions
diff --git a/common/place_sa.cc b/common/place_sa.cc
index 442559b0..0a60adc8 100644
--- a/common/place_sa.cc
+++ b/common/place_sa.cc
@@ -51,7 +51,8 @@ class SAPlacer
int num_bel_types = 0;
for (auto bel : ctx->getBels()) {
int x, y;
- ctx->estimatePosition(bel, x, y);
+ bool gb;
+ ctx->estimatePosition(bel, x, y, gb);
BelType type = ctx->getBelType(bel);
int type_idx;
if (bel_types.find(type) == bel_types.end()) {
@@ -290,18 +291,17 @@ class SAPlacer
float get_wirelength(NetInfo *net)
{
float wirelength = 0;
- int driver_x = 0, driver_y = 0;
- bool consider_driver = false;
+ int driver_x, driver_y;
+ bool driver_gb;
CellInfo *driver_cell = net->driver.cell;
if (!driver_cell)
return 0;
if (driver_cell->bel == BelId())
return 0;
- consider_driver =
- ctx->estimatePosition(driver_cell->bel, driver_x, driver_y);
+ ctx->estimatePosition(driver_cell->bel, driver_x, driver_y, driver_gb);
WireId drv_wire = ctx->getWireBelPin(
driver_cell->bel, ctx->portPinFromId(net->driver.port));
- if (!consider_driver)
+ if (driver_gb)
return 0;
for (auto load : net->users) {
if (load.cell == nullptr)
@@ -309,7 +309,7 @@ class SAPlacer
CellInfo *load_cell = load.cell;
if (load_cell->bel == BelId())
continue;
- // ctx->estimatePosition(load_cell->bel, load_x, load_y);
+ // ctx->estimatePosition(load_cell->bel, load_x, load_y, load_gb);
WireId user_wire = ctx->getWireBelPin(
load_cell->bel, ctx->portPinFromId(load.port));
// wirelength += std::abs(load_x - driver_x) + std::abs(load_y -
@@ -376,8 +376,9 @@ class SAPlacer
delta = new_wirelength - curr_wirelength;
n_move++;
// SA acceptance criterea
- if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <=
- std::exp(-delta / temp))) {
+ if (delta < 0 ||
+ (temp > 1e-6 &&
+ (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
n_accept++;
if (delta < 0)
improved = true;
@@ -407,8 +408,9 @@ class SAPlacer
BelId random_bel_for_cell(CellInfo *cell)
{
BelType targetType = ctx->belTypeFromId(cell->type);
- int x = 0, y = 0;
- ctx->estimatePosition(cell->bel, x, y);
+ int x, y;
+ bool gb;
+ ctx->estimatePosition(cell->bel, x, y, gb);
while (true) {
int nx = ctx->rng(2 * diameter + 1) + std::max(x - diameter, 0);
int ny = ctx->rng(2 * diameter + 1) + std::max(y - diameter, 0);
diff --git a/common/route.cc b/common/route.cc
index b031237c..42a705a1 100644
--- a/common/route.cc
+++ b/common/route.cc
@@ -206,15 +206,16 @@ struct Router
assert(next_delay >= 0);
if (visited.count(next_wire)) {
- if (visited.at(next_wire).delay <= next_delay + 1e-3)
+ if (visited.at(next_wire).delay <=
+ next_delay + ctx->getDelayEpsilon())
continue;
#if 0 // FIXME
if (ctx->verbose)
log("Found better route to %s. Old vs new delay "
- "estimate: %.2f %.2f\n",
+ "estimate: %.3f %.3f\n",
ctx->getWireName(next_wire).c_str(),
- float(visited.at(next_wire).delay),
- float(next_delay));
+ ctx->getDelayNS(visited.at(next_wire).delay),
+ ctx->getDelayNS(next_delay));
#endif
revisitCnt++;
}
@@ -246,8 +247,8 @@ struct Router
}
if (ctx->verbose)
- log(" Final path delay: %.2f\n",
- float(visited[dst_wire].delay));
+ log(" Final path delay: %.3f\n",
+ ctx->getDelayNS(visited[dst_wire].delay));
maxDelay = fmaxf(maxDelay, visited[dst_wire].delay);
if (ctx->verbose)
@@ -257,7 +258,8 @@ struct Router
while (1) {
if (ctx->verbose)
- log(" %8.2f %s\n", float(visited[cursor].delay),
+ log(" %8.3f %s\n",
+ ctx->getDelayNS(visited[cursor].delay),
ctx->getWireName(cursor).c_str(ctx));
if (src_wires.count(cursor))