diff options
author | Sergiusz Bazanski <q3k@q3k.org> | 2018-07-13 14:50:58 +0100 |
---|---|---|
committer | Sergiusz Bazanski <q3k@q3k.org> | 2018-07-13 14:50:58 +0100 |
commit | 9e4f97290a50fc5d9dc0cbe6ead945840b9811b1 (patch) | |
tree | 92ceb562f28bb42d4bd1913dbeba38dd34c5ca94 /common | |
parent | 0816f447b768ebe0632f419e9b696714dda4e860 (diff) | |
download | nextpnr-9e4f97290a50fc5d9dc0cbe6ead945840b9811b1.tar.gz nextpnr-9e4f97290a50fc5d9dc0cbe6ead945840b9811b1.tar.bz2 nextpnr-9e4f97290a50fc5d9dc0cbe6ead945840b9811b1.zip |
Make PnR use Unlocked methods
Diffstat (limited to 'common')
-rw-r--r-- | common/place_common.cc | 14 | ||||
-rw-r--r-- | common/placer1.cc | 38 | ||||
-rw-r--r-- | common/router1.cc | 36 |
3 files changed, 44 insertions, 44 deletions
diff --git a/common/place_common.cc b/common/place_common.cc index 60735890..281e40a2 100644 --- a/common/place_common.cc +++ b/common/place_common.cc @@ -36,7 +36,7 @@ wirelen_t get_net_wirelength(const Context *ctx, const NetInfo *net, float &tns) if (driver_cell->bel == BelId()) return 0; ctx->estimatePosition(driver_cell->bel, driver_x, driver_y, driver_gb); - WireId drv_wire = ctx->getWireBelPin(driver_cell->bel, ctx->portPinFromId(net->driver.port)); + WireId drv_wire = ctx->getWireBelPinUnlocked(driver_cell->bel, ctx->portPinFromId(net->driver.port)); if (driver_gb) return 0; float worst_slack = 1000; @@ -48,7 +48,7 @@ wirelen_t get_net_wirelength(const Context *ctx, const NetInfo *net, float &tns) if (load_cell->bel == BelId()) continue; if (ctx->timing_driven) { - WireId user_wire = ctx->getWireBelPin(load_cell->bel, ctx->portPinFromId(load.port)); + WireId user_wire = ctx->getWireBelPinUnlocked(load_cell->bel, ctx->portPinFromId(load.port)); delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire); float slack = ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl); if (slack < 0) @@ -112,12 +112,12 @@ bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality) CellInfo *ripup_target = nullptr; BelId ripup_bel = BelId(); if (cell->bel != BelId()) { - ctx->unbindBel(cell->bel); + ctx->unbindBelUnlocked(cell->bel); } BelType targetType = ctx->belTypeFromId(cell->type); for (auto bel : ctx->getBels()) { if (ctx->getBelType(bel) == targetType && (!require_legality || ctx->isValidBelForCell(cell, bel))) { - if (ctx->checkBelAvail(bel)) { + if (ctx->checkBelAvailUnlocked(bel)) { wirelen_t wirelen = get_cell_wirelength_at_bel(ctx, cell, bel); if (iters >= 4) wirelen += ctx->rng(25); @@ -130,7 +130,7 @@ bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality) if (iters >= 4) wirelen += ctx->rng(25); if (wirelen <= best_ripup_wirelen) { - ripup_target = ctx->cells.at(ctx->getBoundBelCell(bel)).get(); + ripup_target = ctx->cells.at(ctx->getBoundBelCellUnlocked(bel)).get(); if (ripup_target->belStrength < STRENGTH_STRONG) { best_ripup_wirelen = wirelen; ripup_bel = bel; @@ -148,12 +148,12 @@ bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality) log_error("failed to place cell '%s' of type '%s'\n", cell->name.c_str(ctx), cell->type.c_str(ctx)); } --iters; - ctx->unbindBel(ripup_target->bel); + ctx->unbindBelUnlocked(ripup_target->bel); best_bel = ripup_bel; } else { all_placed = true; } - ctx->bindBel(best_bel, cell->name, STRENGTH_WEAK); + ctx->bindBelUnlocked(best_bel, cell->name, STRENGTH_WEAK); cell = ripup_target; } diff --git a/common/placer1.cc b/common/placer1.cc index 53295a91..05f760a3 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -85,7 +85,7 @@ class SAPlacer auto loc = cell->attrs.find(ctx->id("BEL")); if (loc != cell->attrs.end()) { std::string loc_name = loc->second; - BelId bel = ctx->getBelByName(ctx->id(loc_name)); + BelId bel = ctx->getBelByNameUnlocked(ctx->id(loc_name)); if (bel == BelId()) { log_error("No Bel named \'%s\' located for " "this chip (processing BEL attribute on \'%s\')\n", @@ -100,7 +100,7 @@ class SAPlacer cell->type.c_str(ctx)); } - ctx->bindBel(bel, cell->name, STRENGTH_USER); + ctx->bindBelUnlocked(bel, cell->name, STRENGTH_USER); locked_bels.insert(bel); placed_cells++; } @@ -235,7 +235,7 @@ class SAPlacer } // Final post-pacement validitiy check for (auto bel : ctx->getBels()) { - IdString cell = ctx->getBoundBelCell(bel); + IdString cell = ctx->getBoundBelCellUnlocked(bel); if (!ctx->isBelLocationValid(bel)) { std::string cell_text = "no cell"; if (cell != IdString()) @@ -267,12 +267,12 @@ class SAPlacer CellInfo *ripup_target = nullptr; BelId ripup_bel = BelId(); if (cell->bel != BelId()) { - ctx->unbindBel(cell->bel); + ctx->unbindBelUnlocked(cell->bel); } BelType targetType = ctx->belTypeFromId(cell->type); for (auto bel : ctx->getBels()) { if (ctx->getBelType(bel) == targetType && (ctx->isValidBelForCell(cell, bel) || !require_legal)) { - if (ctx->checkBelAvail(bel)) { + if (ctx->checkBelAvailUnlocked(bel)) { uint64_t score = ctx->rng64(); if (score <= best_score) { best_score = score; @@ -282,7 +282,7 @@ class SAPlacer uint64_t score = ctx->rng64(); if (score <= best_ripup_score) { best_ripup_score = score; - ripup_target = ctx->cells.at(ctx->getBoundBelCell(bel)).get(); + ripup_target = ctx->cells.at(ctx->getBoundBelCellUnlocked(bel)).get(); ripup_bel = bel; } } @@ -292,12 +292,12 @@ class SAPlacer if (iters == 0 || ripup_bel == BelId()) log_error("failed to place cell '%s' of type '%s'\n", cell->name.c_str(ctx), cell->type.c_str(ctx)); --iters; - ctx->unbindBel(ripup_target->bel); + ctx->unbindBelUnlocked(ripup_target->bel); best_bel = ripup_bel; } else { all_placed = true; } - ctx->bindBel(best_bel, cell->name, STRENGTH_WEAK); + ctx->bindBelUnlocked(best_bel, cell->name, STRENGTH_WEAK); // Back annotate location cell->attrs[ctx->id("BEL")] = ctx->getBelName(cell->bel).str(ctx); @@ -313,7 +313,7 @@ class SAPlacer new_lengths.clear(); update.clear(); BelId oldBel = cell->bel; - IdString other = ctx->getBoundBelCell(newBel); + IdString other = ctx->getBoundBelCellUnlocked(newBel); CellInfo *other_cell = nullptr; if (other != IdString()) { other_cell = ctx->cells[other].get(); @@ -321,9 +321,9 @@ class SAPlacer return false; } wirelen_t new_wirelength = 0, delta; - ctx->unbindBel(oldBel); + ctx->unbindBelUnlocked(oldBel); if (other != IdString()) { - ctx->unbindBel(newBel); + ctx->unbindBelUnlocked(newBel); } for (const auto &port : cell->ports) @@ -336,16 +336,16 @@ class SAPlacer update.insert(port.second.net); } - ctx->bindBel(newBel, cell->name, STRENGTH_WEAK); + ctx->bindBelUnlocked(newBel, cell->name, STRENGTH_WEAK); if (other != IdString()) { - ctx->bindBel(oldBel, other_cell->name, STRENGTH_WEAK); + ctx->bindBelUnlocked(oldBel, other_cell->name, STRENGTH_WEAK); } if (require_legal) { if (!ctx->isBelLocationValid(newBel) || ((other != IdString() && !ctx->isBelLocationValid(oldBel)))) { - ctx->unbindBel(newBel); + ctx->unbindBelUnlocked(newBel); if (other != IdString()) - ctx->unbindBel(oldBel); + ctx->unbindBelUnlocked(oldBel); goto swap_fail; } } @@ -369,8 +369,8 @@ class SAPlacer improved = true; } else { if (other != IdString()) - ctx->unbindBel(oldBel); - ctx->unbindBel(newBel); + ctx->unbindBelUnlocked(oldBel); + ctx->unbindBelUnlocked(newBel); goto swap_fail; } curr_wirelength = new_wirelength; @@ -379,9 +379,9 @@ class SAPlacer return true; swap_fail: - ctx->bindBel(oldBel, cell->name, STRENGTH_WEAK); + ctx->bindBelUnlocked(oldBel, cell->name, STRENGTH_WEAK); if (other != IdString()) { - ctx->bindBel(newBel, other, STRENGTH_WEAK); + ctx->bindBelUnlocked(newBel, other, STRENGTH_WEAK); } return false; } diff --git a/common/router1.cc b/common/router1.cc index 94c7070e..cbaf773d 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -90,10 +90,10 @@ void ripup_net(Context *ctx, IdString net_name) } for (auto pip : pips) - ctx->unbindPip(pip); + ctx->unbindPipUnlocked(pip); for (auto wire : wires) - ctx->unbindWire(wire); + ctx->unbindWireUnlocked(wire); NPNR_ASSERT(net_info->wires.empty()); } @@ -148,10 +148,10 @@ struct Router bool foundRipupNet = false; thisVisitCnt++; - if (!ctx->checkWireAvail(next_wire)) { + if (!ctx->checkWireAvailUnlocked(next_wire)) { if (!ripup) continue; - IdString ripupWireNet = ctx->getConflictingWireNet(next_wire); + IdString ripupWireNet = ctx->getConflictingWireNetUnlocked(next_wire); if (ripupWireNet == net_name || ripupWireNet == IdString()) continue; @@ -166,10 +166,10 @@ struct Router foundRipupNet = true; } - if (!ctx->checkPipAvail(pip)) { + if (!ctx->checkPipAvailUnlocked(pip)) { if (!ripup) continue; - IdString ripupPipNet = ctx->getConflictingPipNet(pip); + IdString ripupPipNet = ctx->getConflictingPipNetUnlocked(pip); if (ripupPipNet == net_name || ripupPipNet == IdString()) continue; @@ -272,7 +272,7 @@ struct Router if (driver_port_it != net_info->driver.cell->pins.end()) driver_port = driver_port_it->second; - auto src_wire = ctx->getWireBelPin(src_bel, ctx->portPinFromId(driver_port)); + auto src_wire = ctx->getWireBelPinUnlocked(src_bel, ctx->portPinFromId(driver_port)); if (src_wire == WireId()) log_error("No wire found for port %s (pin %s) on source cell %s " @@ -287,7 +287,7 @@ struct Router src_wires[src_wire] = 0; ripup_net(ctx, net_name); - ctx->bindWire(src_wire, net_name, STRENGTH_WEAK); + ctx->bindWireUnlocked(src_wire, net_name, STRENGTH_WEAK); std::vector<PortRef> users_array = net_info->users; ctx->shuffle(users_array); @@ -312,7 +312,7 @@ struct Router if (user_port_it != user_it.cell->pins.end()) user_port = user_port_it->second; - auto dst_wire = ctx->getWireBelPin(dst_bel, ctx->portPinFromId(user_port)); + auto dst_wire = ctx->getWireBelPinUnlocked(dst_bel, ctx->portPinFromId(user_port)); if (dst_wire == WireId()) log_error("No wire found for port %s (pin %s) on destination " @@ -355,14 +355,14 @@ struct Router if (src_wires.count(cursor)) break; - IdString conflicting_wire_net = ctx->getConflictingWireNet(cursor); + IdString conflicting_wire_net = ctx->getConflictingWireNetUnlocked(cursor); if (conflicting_wire_net != IdString()) { NPNR_ASSERT(ripup); NPNR_ASSERT(conflicting_wire_net != net_name); - ctx->unbindWire(cursor); - if (!ctx->checkWireAvail(cursor)) + ctx->unbindWireUnlocked(cursor); + if (!ctx->checkWireAvailUnlocked(cursor)) ripup_net(ctx, conflicting_wire_net); rippedNets.insert(conflicting_wire_net); @@ -372,14 +372,14 @@ struct Router } PipId pip = visited[cursor].pip; - IdString conflicting_pip_net = ctx->getConflictingPipNet(pip); + IdString conflicting_pip_net = ctx->getConflictingPipNetUnlocked(pip); if (conflicting_pip_net != IdString()) { NPNR_ASSERT(ripup); NPNR_ASSERT(conflicting_pip_net != net_name); - ctx->unbindPip(pip); - if (!ctx->checkPipAvail(pip)) + ctx->unbindPipUnlocked(pip); + if (!ctx->checkPipAvailUnlocked(pip)) ripup_net(ctx, conflicting_pip_net); rippedNets.insert(conflicting_pip_net); @@ -388,7 +388,7 @@ struct Router scores.netPipScores[std::make_pair(conflicting_pip_net, visited[cursor].pip)]++; } - ctx->bindPip(visited[cursor].pip, net_name, STRENGTH_WEAK); + ctx->bindPipUnlocked(visited[cursor].pip, net_name, STRENGTH_WEAK); src_wires[cursor] = visited[cursor].delay; cursor = ctx->getPipSrcWire(visited[cursor].pip); } @@ -451,7 +451,7 @@ bool router1(Context *ctx) if (driver_port_it != net_info->driver.cell->pins.end()) driver_port = driver_port_it->second; - auto src_wire = ctx->getWireBelPin(src_bel, ctx->portPinFromId(driver_port)); + auto src_wire = ctx->getWireBelPinUnlocked(src_bel, ctx->portPinFromId(driver_port)); if (src_wire == WireId()) continue; @@ -469,7 +469,7 @@ bool router1(Context *ctx) if (user_port_it != user_it.cell->pins.end()) user_port = user_port_it->second; - auto dst_wire = ctx->getWireBelPin(dst_bel, ctx->portPinFromId(user_port)); + auto dst_wire = ctx->getWireBelPinUnlocked(dst_bel, ctx->portPinFromId(user_port)); if (dst_wire == WireId()) continue; |