From ad9bc627e670392e52d5e1f1e24106deada6eb8c Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 8 Apr 2019 18:08:26 +0100 Subject: placer1: Check correctness of incremental updates with --debug Signed-off-by: David Shah --- common/placer1.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/placer1.cc b/common/placer1.cc index d1e315eb..1fbd2a6e 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -291,6 +291,24 @@ class SAPlacer } } + if (ctx->debug) { + // Verify correctness of incremental wirelen updates + for (size_t i = 0; i < net_bounds.size(); i++) { + auto net = net_by_udata[i]; + if (ignore_net(net)) + continue; + auto &incr = net_bounds.at(i), gold = get_net_bounds(net); + NPNR_ASSERT(incr.x0 == gold.x0); + NPNR_ASSERT(incr.x1 == gold.x1); + NPNR_ASSERT(incr.y0 == gold.y0); + NPNR_ASSERT(incr.y1 == gold.y1); + NPNR_ASSERT(incr.nx0 == gold.nx0); + NPNR_ASSERT(incr.nx1 == gold.nx1); + NPNR_ASSERT(incr.ny0 == gold.ny0); + NPNR_ASSERT(incr.ny1 == gold.ny1); + } + } + if (curr_wirelen_cost < min_wirelen) { min_wirelen = curr_wirelen_cost; improved = true; -- cgit v1.2.3