From 7858663aa7f211cebde2d543f7d0094d84ca11b1 Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 24 Jul 2018 11:46:14 +0200 Subject: timing: Model clock to Q times Signed-off-by: David Shah --- common/timing.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common') diff --git a/common/timing.cc b/common/timing.cc index 3a48935f..d91dea20 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -88,6 +88,9 @@ void assign_budget(Context *ctx) IdString clock_domain = ctx->getPortClock(cell.second.get(), port.first); if (clock_domain != IdString()) { delay_t slack = delay_t(1.0e12 / ctx->target_freq); // TODO: clock constraints + delay_t clkToQ; + if (ctx->getCellDelay(cell.second.get(), clock_domain, port.first, clkToQ)) + slack -= clkToQ; if (port.second.net) follow_net(ctx, port.second.net, 0, slack); } -- cgit v1.2.3 From 9d38907e95dac76a6b9754562752c36e3f65b9ec Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Jul 2018 12:18:01 +0200 Subject: Add G_ARROW (for now same look as G_LINE) Signed-off-by: Clifford Wolf --- common/nextpnr.h | 1 + 1 file changed, 1 insertion(+) (limited to 'common') diff --git a/common/nextpnr.h b/common/nextpnr.h index 021772fe..3ba4f3b3 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -147,6 +147,7 @@ struct GraphicElement { G_NONE, G_LINE, + G_ARROW, G_BOX, G_CIRCLE, G_LABEL -- cgit v1.2.3 From 1538d26073911e6969bca8cbcff3da09891a846b Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Jul 2018 12:39:33 +0200 Subject: Add CellInfo data for placement constraints Signed-off-by: Clifford Wolf --- common/nextpnr.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common') diff --git a/common/nextpnr.h b/common/nextpnr.h index 3ba4f3b3..ca0854e5 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -273,6 +273,16 @@ struct CellInfo : ArchCellInfo // cell_port -> bel_pin std::unordered_map pins; + + // placement constraints + CellInfo *constr_parent; + stdL::vector constr_children; + const int UNCONSTR = INT_MIN; + int constr_x = UNCONSTR; // this.x - parent.x + int constr_y = UNCONSTR; // this.y - parent.y + int constr_z = UNCONSTR; // this.z - parent.z + bool constr_abs_z = false; // parent.z := 0 + // parent.[xyz] := 0 when (constr_parent == nullptr) }; struct DeterministicRNG -- cgit v1.2.3 From f86fc6e7fdf91341a1bd44415e578767fa0b13fb Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Jul 2018 12:41:08 +0200 Subject: Typo fix Signed-off-by: Clifford Wolf --- common/nextpnr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/nextpnr.h b/common/nextpnr.h index ca0854e5..4a1aaac1 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -276,7 +276,7 @@ struct CellInfo : ArchCellInfo // placement constraints CellInfo *constr_parent; - stdL::vector constr_children; + std::vector constr_children; const int UNCONSTR = INT_MIN; int constr_x = UNCONSTR; // this.x - parent.x int constr_y = UNCONSTR; // this.y - parent.y -- cgit v1.2.3 From e200c281d988b30ee39bd4d5934d6e6b2d3d4b6d Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 24 Jul 2018 15:45:49 +0200 Subject: common: Remove use of deprecated APIs Signed-off-by: David Shah --- common/archcheck.cc | 5 ++--- common/place_common.cc | 22 +++++++++++----------- common/placer1.cc | 26 +++++++++++--------------- 3 files changed, 24 insertions(+), 29 deletions(-) (limited to 'common') diff --git a/common/archcheck.cc b/common/archcheck.cc index 5c4ef26c..5059066d 100644 --- a/common/archcheck.cc +++ b/common/archcheck.cc @@ -17,8 +17,8 @@ * */ -#include "nextpnr.h" #include "log.h" +#include "nextpnr.h" #if 0 #define dbg(...) log(__VA_ARGS__) @@ -84,8 +84,7 @@ void archcheck_locs(const Context *ctx) log_info("Checking all locations..\n"); for (int x = 0; x < ctx->getGridDimX(); x++) - for (int y = 0; y < ctx->getGridDimY(); y++) - { + for (int y = 0; y < ctx->getGridDimY(); y++) { dbg("> %d %d\n", x, y); std::unordered_set usedz; diff --git a/common/place_common.cc b/common/place_common.cc index 95b7b2aa..5673c847 100644 --- a/common/place_common.cc +++ b/common/place_common.cc @@ -28,19 +28,20 @@ NEXTPNR_NAMESPACE_BEGIN wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type, float &tns) { wirelen_t wirelength = 0; - int driver_x, driver_y; + Loc driver_loc; bool driver_gb; CellInfo *driver_cell = net->driver.cell; if (!driver_cell) return 0; if (driver_cell->bel == BelId()) return 0; - ctx->estimatePosition(driver_cell->bel, driver_x, driver_y, driver_gb); + driver_gb = ctx->getBelGlobalBuf(driver_cell->bel); + driver_loc = ctx->getBelLocation(driver_cell->bel); WireId drv_wire = ctx->getBelPinWire(driver_cell->bel, ctx->portPinFromId(net->driver.port)); if (driver_gb) return 0; float worst_slack = 1000; - int xmin = driver_x, xmax = driver_x, ymin = driver_y, ymax = driver_y; + int xmin = driver_loc.x, xmax = driver_loc.x, ymin = driver_loc.y, ymax = driver_loc.y; for (auto load : net->users) { if (load.cell == nullptr) continue; @@ -56,15 +57,14 @@ wirelen_t get_net_metric(const Context *ctx, const NetInfo *net, MetricType type worst_slack = std::min(slack, worst_slack); } - int load_x, load_y; - bool load_gb; - ctx->estimatePosition(load_cell->bel, load_x, load_y, load_gb); - if (load_gb) + if (ctx->getBelGlobalBuf(load_cell->bel)) continue; - xmin = std::min(xmin, load_x); - ymin = std::min(ymin, load_y); - xmax = std::max(xmax, load_x); - ymax = std::max(ymax, load_y); + Loc load_loc = ctx->getBelLocation(load_cell->bel); + + xmin = std::min(xmin, load_loc.x); + ymin = std::min(ymin, load_loc.y); + xmax = std::max(xmax, load_loc.x); + ymax = std::max(ymax, load_loc.y); } if (ctx->timing_driven && type == MetricType::COST) { wirelength = wirelen_t((((ymax - ymin) + (xmax - xmin)) * std::min(5.0, (1.0 + std::exp(-worst_slack / 5))))); diff --git a/common/placer1.cc b/common/placer1.cc index 025c7c15..f713fb88 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -50,9 +50,7 @@ class SAPlacer { int num_bel_types = 0; for (auto bel : ctx->getBels()) { - int x, y; - bool gb; - ctx->estimatePosition(bel, x, y, gb); + Loc loc = ctx->getBelLocation(bel); BelType type = ctx->getBelType(bel); int type_idx; if (bel_types.find(type) == bel_types.end()) { @@ -63,13 +61,13 @@ class SAPlacer } if (int(fast_bels.size()) < type_idx + 1) fast_bels.resize(type_idx + 1); - if (int(fast_bels.at(type_idx).size()) < (x + 1)) - fast_bels.at(type_idx).resize(x + 1); - if (int(fast_bels.at(type_idx).at(x).size()) < (y + 1)) - fast_bels.at(type_idx).at(x).resize(y + 1); - max_x = std::max(max_x, x); - max_y = std::max(max_y, y); - fast_bels.at(type_idx).at(x).at(y).push_back(bel); + if (int(fast_bels.at(type_idx).size()) < (loc.x + 1)) + fast_bels.at(type_idx).resize(loc.x + 1); + if (int(fast_bels.at(type_idx).at(loc.x).size()) < (loc.y + 1)) + fast_bels.at(type_idx).at(loc.x).resize(loc.y + 1); + max_x = std::max(max_x, loc.x); + max_y = std::max(max_y, loc.y); + fast_bels.at(type_idx).at(loc.x).at(loc.y).push_back(bel); } diameter = std::max(max_x, max_y) + 1; } @@ -404,12 +402,10 @@ class SAPlacer BelId random_bel_for_cell(CellInfo *cell) { BelType targetType = ctx->belTypeFromId(cell->type); - int x, y; - bool gb; - ctx->estimatePosition(cell->bel, x, y, gb); + Loc curr_loc = ctx->getBelLocation(cell->bel); 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); + int nx = ctx->rng(2 * diameter + 1) + std::max(curr_loc.x - diameter, 0); + int ny = ctx->rng(2 * diameter + 1) + std::max(curr_loc.y - diameter, 0); int beltype_idx = bel_types.at(targetType); if (nx >= int(fast_bels.at(beltype_idx).size())) continue; -- cgit v1.2.3