router2: debugging some edge cases
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
bbc9c9b0ba
commit
50b120528a
@ -155,7 +155,7 @@ struct Router2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::container::flat_map<WireId, PerWireData> wires;
|
std::unordered_map<WireId, PerWireData> wires;
|
||||||
void setup_wires()
|
void setup_wires()
|
||||||
{
|
{
|
||||||
// Set up per-wire structures, so that MT parts don't have to do any memory allocation
|
// Set up per-wire structures, so that MT parts don't have to do any memory allocation
|
||||||
@ -458,6 +458,7 @@ struct Router2
|
|||||||
|
|
||||||
int toexplore = 25000 * std::max(1, (ad.bb.x1 - ad.bb.x0) + (ad.bb.y1 - ad.bb.y0));
|
int toexplore = 25000 * std::max(1, (ad.bb.x1 - ad.bb.x0) + (ad.bb.y1 - ad.bb.y0));
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
|
int explored = 1;
|
||||||
while (!t.queue.empty() && (!is_bb || iter < toexplore)) {
|
while (!t.queue.empty() && (!is_bb || iter < toexplore)) {
|
||||||
auto curr = t.queue.top();
|
auto curr = t.queue.top();
|
||||||
t.queue.pop();
|
t.queue.pop();
|
||||||
@ -497,6 +498,7 @@ struct Router2
|
|||||||
curr.score.delay + ctx->getPipDelay(dh).maxDelay() + ctx->getWireDelay(next).maxDelay();
|
curr.score.delay + ctx->getPipDelay(dh).maxDelay() + ctx->getWireDelay(next).maxDelay();
|
||||||
next_score.togo_cost = 1.75 * get_togo_cost(net, i, next, dst_wire);
|
next_score.togo_cost = 1.75 * get_togo_cost(net, i, next, dst_wire);
|
||||||
if (!t.visited.count(next) || (t.visited.at(next).score.total() > next_score.total())) {
|
if (!t.visited.count(next) || (t.visited.at(next).score.total() > next_score.total())) {
|
||||||
|
++explored;
|
||||||
#if 0
|
#if 0
|
||||||
ROUTE_LOG_DBG("exploring wire %s cost %f togo %f\n", ctx->nameOfWire(next), next_score.cost,
|
ROUTE_LOG_DBG("exploring wire %s cost %f togo %f\n", ctx->nameOfWire(next), next_score.cost,
|
||||||
next_score.togo_cost);
|
next_score.togo_cost);
|
||||||
@ -505,25 +507,23 @@ struct Router2
|
|||||||
t.queue.push(QueuedWire(next, dh, ctx->getPipLocation(dh), next_score, ctx->rng()));
|
t.queue.push(QueuedWire(next, dh, ctx->getPipLocation(dh), next_score, ctx->rng()));
|
||||||
t.visited[next].score = next_score;
|
t.visited[next].score = next_score;
|
||||||
t.visited[next].pip = dh;
|
t.visited[next].pip = dh;
|
||||||
if (next == dst_wire)
|
if (next == dst_wire) {
|
||||||
goto loop_done;
|
toexplore = std::min(toexplore, iter + 5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (false) {
|
|
||||||
loop_done:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (t.visited.count(dst_wire)) {
|
if (t.visited.count(dst_wire)) {
|
||||||
ROUTE_LOG_DBG(" Routed: ");
|
ROUTE_LOG_DBG(" Routed (explored %d wires): ", explored);
|
||||||
WireId cursor_bwd = dst_wire;
|
WireId cursor_bwd = dst_wire;
|
||||||
while (t.visited.count(cursor_bwd)) {
|
while (t.visited.count(cursor_bwd)) {
|
||||||
auto &v = t.visited.at(cursor_bwd);
|
auto &v = t.visited.at(cursor_bwd);
|
||||||
bind_pip_internal(net, i, cursor_bwd, v.pip);
|
bind_pip_internal(net, i, cursor_bwd, v.pip);
|
||||||
if (ctx->debug) {
|
if (ctx->debug) {
|
||||||
auto &wd = wires.at(cursor_bwd);
|
auto &wd = wires.at(cursor_bwd);
|
||||||
ROUTE_LOG_DBG(" wire: %s (curr %d hist %f)\n", ctx->nameOfWire(cursor_bwd),
|
ROUTE_LOG_DBG(" wire: %s (curr %d hist %f share %d)\n", ctx->nameOfWire(cursor_bwd),
|
||||||
int(wd.bound_nets.size()) - 1, wd.hist_cong_cost);
|
int(wd.bound_nets.size()) - 1, wd.hist_cong_cost,
|
||||||
|
wd.bound_nets.count(net->udata) ? wd.bound_nets.at(net->udata).first : 0);
|
||||||
}
|
}
|
||||||
if (v.pip == PipId()) {
|
if (v.pip == PipId()) {
|
||||||
NPNR_ASSERT(cursor_bwd == src_wire);
|
NPNR_ASSERT(cursor_bwd == src_wire);
|
||||||
|
Loading…
Reference in New Issue
Block a user