clangformat
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
f9a5126338
commit
6002a0a80a
@ -33,9 +33,7 @@ struct arc_key
|
||||
NetInfo *net_info;
|
||||
int user_idx;
|
||||
|
||||
bool operator==(const arc_key &other) const {
|
||||
return (net_info == other.net_info) && (user_idx == other.user_idx);
|
||||
}
|
||||
bool operator==(const arc_key &other) const { return (net_info == other.net_info) && (user_idx == other.user_idx); }
|
||||
|
||||
struct Hash
|
||||
{
|
||||
@ -55,10 +53,7 @@ struct arc_entry
|
||||
|
||||
struct Greater
|
||||
{
|
||||
bool operator()(const arc_entry &lhs, const arc_entry &rhs) const noexcept
|
||||
{
|
||||
return lhs.pri > rhs.pri;
|
||||
}
|
||||
bool operator()(const arc_entry &lhs, const arc_entry &rhs) const noexcept { return lhs.pri > rhs.pri; }
|
||||
};
|
||||
};
|
||||
|
||||
@ -245,15 +240,17 @@ struct Router1
|
||||
{
|
||||
std::unordered_set<arc_key, arc_key::Hash> valid_arcs;
|
||||
|
||||
for (auto &net_it : ctx->nets)
|
||||
{
|
||||
for (auto &net_it : ctx->nets) {
|
||||
NetInfo *net_info = net_it.second.get();
|
||||
std::unordered_set<WireId> valid_wires_for_net;
|
||||
|
||||
if (skip_net(net_info))
|
||||
continue;
|
||||
|
||||
// log("[check] net: %s\n", net_info->name.c_str(ctx));
|
||||
#if 0
|
||||
if (ctx->debug)
|
||||
log("[check] net: %s\n", net_info->name.c_str(ctx));
|
||||
#endif
|
||||
|
||||
auto src_wire = ctx->getNetinfoSourceWire(net_info);
|
||||
log_assert(src_wire != WireId());
|
||||
@ -267,10 +264,17 @@ struct Router1
|
||||
arc.user_idx = user_idx;
|
||||
|
||||
valid_arcs.insert(arc);
|
||||
// log("[check] arc: %s %s\n", ctx->getWireName(src_wire).c_str(ctx), ctx->getWireName(dst_wire).c_str(ctx));
|
||||
#if 0
|
||||
if (ctx->debug)
|
||||
log("[check] arc: %s %s\n", ctx->getWireName(src_wire).c_str(ctx),
|
||||
ctx->getWireName(dst_wire).c_str(ctx));
|
||||
#endif
|
||||
|
||||
for (WireId wire : arc_to_wires[arc]) {
|
||||
// log("[check] wire: %s\n", ctx->getWireName(wire).c_str(ctx));
|
||||
#if 0
|
||||
if (ctx->debug)
|
||||
log("[check] wire: %s\n", ctx->getWireName(wire).c_str(ctx));
|
||||
#endif
|
||||
valid_wires_for_net.insert(wire);
|
||||
log_assert(wire_to_arcs[wire].count(arc));
|
||||
log_assert(net_info->wires.count(wire));
|
||||
@ -298,8 +302,7 @@ struct Router1
|
||||
std::unordered_map<WireId, NetInfo *> src_to_net;
|
||||
std::unordered_map<WireId, arc_key> dst_to_arc;
|
||||
|
||||
for (auto &net_it : ctx->nets)
|
||||
{
|
||||
for (auto &net_it : ctx->nets) {
|
||||
NetInfo *net_info = net_it.second.get();
|
||||
|
||||
if (skip_net(net_info))
|
||||
@ -316,26 +319,30 @@ struct Router1
|
||||
ctx->nameOf(net_info), ctx->nameOf(src_to_net.at(src_wire)));
|
||||
|
||||
if (dst_to_arc.count(src_wire))
|
||||
log_error("Wire %s is used as source and sink in different nets: %s vs %s (%d)\n", ctx->getWireName(src_wire).c_str(ctx),
|
||||
ctx->nameOf(net_info), ctx->nameOf(dst_to_arc.at(src_wire).net_info), dst_to_arc.at(src_wire).user_idx);
|
||||
log_error("Wire %s is used as source and sink in different nets: %s vs %s (%d)\n",
|
||||
ctx->getWireName(src_wire).c_str(ctx), ctx->nameOf(net_info),
|
||||
ctx->nameOf(dst_to_arc.at(src_wire).net_info), dst_to_arc.at(src_wire).user_idx);
|
||||
|
||||
for (int user_idx = 0; user_idx < int(net_info->users.size()); user_idx++) {
|
||||
auto dst_wire = ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx]);
|
||||
|
||||
if (dst_wire == WireId())
|
||||
log_error("No wire found for port %s on destination cell %s.\n", net_info->users[user_idx].port.c_str(ctx),
|
||||
log_error("No wire found for port %s on destination cell %s.\n",
|
||||
net_info->users[user_idx].port.c_str(ctx),
|
||||
net_info->users[user_idx].cell->name.c_str(ctx));
|
||||
|
||||
if (dst_to_arc.count(dst_wire)) {
|
||||
if (dst_to_arc.at(dst_wire).net_info == net_info)
|
||||
continue;
|
||||
log_error("Found two arcs with same sink wire %s: %s (%d) vs %s (%d)\n", ctx->getWireName(dst_wire).c_str(ctx),
|
||||
ctx->nameOf(net_info), user_idx, ctx->nameOf(dst_to_arc.at(dst_wire).net_info), dst_to_arc.at(dst_wire).user_idx);
|
||||
log_error("Found two arcs with same sink wire %s: %s (%d) vs %s (%d)\n",
|
||||
ctx->getWireName(dst_wire).c_str(ctx), ctx->nameOf(net_info), user_idx,
|
||||
ctx->nameOf(dst_to_arc.at(dst_wire).net_info), dst_to_arc.at(dst_wire).user_idx);
|
||||
}
|
||||
|
||||
if (src_to_net.count(dst_wire))
|
||||
log_error("Wire %s is used as source and sink in different nets: %s vs %s (%d)\n", ctx->getWireName(dst_wire).c_str(ctx),
|
||||
ctx->nameOf(src_to_net.at(dst_wire)), ctx->nameOf(net_info), user_idx);
|
||||
log_error("Wire %s is used as source and sink in different nets: %s vs %s (%d)\n",
|
||||
ctx->getWireName(dst_wire).c_str(ctx), ctx->nameOf(src_to_net.at(dst_wire)),
|
||||
ctx->nameOf(net_info), user_idx);
|
||||
|
||||
arc_key arc;
|
||||
arc.net_info = net_info;
|
||||
@ -390,7 +397,8 @@ struct Router1
|
||||
ripup_flag = false;
|
||||
|
||||
if (ctx->debug) {
|
||||
log("Routing arc %d on net %s (%d arcs total):\n", user_idx, net_info->name.c_str(ctx), int(net_info->users.size()));
|
||||
log("Routing arc %d on net %s (%d arcs total):\n", user_idx, net_info->name.c_str(ctx),
|
||||
int(net_info->users.size()));
|
||||
log(" source ... %s\n", ctx->getWireName(src_wire).c_str(ctx));
|
||||
log(" sink ..... %s\n", ctx->getWireName(dst_wire).c_str(ctx));
|
||||
}
|
||||
@ -443,8 +451,7 @@ struct Router1
|
||||
visited[qw.wire] = qw;
|
||||
}
|
||||
|
||||
while (visitCnt++ < maxVisitCnt && !queue.empty())
|
||||
{
|
||||
while (visitCnt++ < maxVisitCnt && !queue.empty()) {
|
||||
QueuedWire qw = queue.top();
|
||||
queue.pop();
|
||||
|
||||
@ -484,10 +491,12 @@ struct Router1
|
||||
}
|
||||
}
|
||||
|
||||
if (conflictWireNet != nullptr && conflictPipWire != WireId() && conflictWireNet->wires.count(conflictPipWire))
|
||||
if (conflictWireNet != nullptr && conflictPipWire != WireId() &&
|
||||
conflictWireNet->wires.count(conflictPipWire))
|
||||
conflictPipWire = WireId();
|
||||
|
||||
if (conflictPipNet != nullptr && conflictWireWire != WireId() && conflictPipNet->wires.count(conflictWireWire))
|
||||
if (conflictPipNet != nullptr && conflictWireWire != WireId() &&
|
||||
conflictPipNet->wires.count(conflictWireWire))
|
||||
conflictWireWire = WireId();
|
||||
|
||||
if (conflictWireWire == conflictPipWire)
|
||||
@ -702,9 +711,8 @@ bool router1(Context *ctx, const Router1Cfg &cfg)
|
||||
|
||||
while (!router.arc_queue.empty()) {
|
||||
if (++iter_cnt % 1000 == 0) {
|
||||
log_info("%10d | %8d %10d | %4d %5d | %9d\n",
|
||||
iter_cnt, router.arcs_with_ripup, router.arcs_without_ripup,
|
||||
router.arcs_with_ripup - last_arcs_with_ripup,
|
||||
log_info("%10d | %8d %10d | %4d %5d | %9d\n", iter_cnt, router.arcs_with_ripup,
|
||||
router.arcs_without_ripup, router.arcs_with_ripup - last_arcs_with_ripup,
|
||||
router.arcs_without_ripup - last_arcs_without_ripup, int(router.arc_queue.size()));
|
||||
last_arcs_with_ripup = router.arcs_with_ripup;
|
||||
last_arcs_without_ripup = router.arcs_without_ripup;
|
||||
@ -719,8 +727,8 @@ bool router1(Context *ctx, const Router1Cfg &cfg)
|
||||
arc_key arc = router.arc_queue_pop();
|
||||
|
||||
if (!router.route_arc(arc, true)) {
|
||||
log_warning("Failed to find a route for arc %d of net %s.\n",
|
||||
arc.user_idx, arc.net_info->name.c_str(ctx));
|
||||
log_warning("Failed to find a route for arc %d of net %s.\n", arc.user_idx,
|
||||
arc.net_info->name.c_str(ctx));
|
||||
#ifndef NDEBUG
|
||||
router.check();
|
||||
ctx->check();
|
||||
@ -730,10 +738,9 @@ bool router1(Context *ctx, const Router1Cfg &cfg)
|
||||
}
|
||||
}
|
||||
|
||||
log_info("%10d | %8d %10d | %4d %5d | %9d\n",
|
||||
iter_cnt, router.arcs_with_ripup, router.arcs_without_ripup,
|
||||
router.arcs_with_ripup - last_arcs_with_ripup,
|
||||
router.arcs_without_ripup - last_arcs_without_ripup, int(router.arc_queue.size()));
|
||||
log_info("%10d | %8d %10d | %4d %5d | %9d\n", iter_cnt, router.arcs_with_ripup, router.arcs_without_ripup,
|
||||
router.arcs_with_ripup - last_arcs_with_ripup, router.arcs_without_ripup - last_arcs_without_ripup,
|
||||
int(router.arc_queue.size()));
|
||||
log_info("Routing complete.\n");
|
||||
|
||||
#ifndef NDEBUG
|
||||
@ -777,7 +784,8 @@ bool Context::checkRoutedDesign() const
|
||||
bool found_loop = false;
|
||||
bool found_stub = false;
|
||||
|
||||
struct ExtraWireInfo {
|
||||
struct ExtraWireInfo
|
||||
{
|
||||
int order_num = 0;
|
||||
std::unordered_set<WireId> children;
|
||||
};
|
||||
|
10
ecp5/arch.h
10
ecp5/arch.h
@ -619,10 +619,7 @@ struct Arch : BaseCtx
|
||||
return wire_to_net.at(wire);
|
||||
}
|
||||
|
||||
WireId getConflictingWireWire(WireId wire) const
|
||||
{
|
||||
return wire;
|
||||
}
|
||||
WireId getConflictingWireWire(WireId wire) const { return wire; }
|
||||
|
||||
NetInfo *getConflictingWireNet(WireId wire) const
|
||||
{
|
||||
@ -729,10 +726,7 @@ struct Arch : BaseCtx
|
||||
return pip_to_net.at(pip);
|
||||
}
|
||||
|
||||
WireId getConflictingPipWire(PipId pip) const
|
||||
{
|
||||
return WireId();
|
||||
}
|
||||
WireId getConflictingPipWire(PipId pip) const { return WireId(); }
|
||||
|
||||
NetInfo *getConflictingPipNet(PipId pip) const
|
||||
{
|
||||
|
@ -453,8 +453,8 @@ void DesignWidget::onSelectionChanged(const QItemSelection &, const QItemSelecti
|
||||
addProperty(topItem, QVariant::String, "Type", ctx->getWireType(wire).c_str(ctx));
|
||||
addProperty(topItem, QVariant::Bool, "Available", ctx->checkWireAvail(wire));
|
||||
addProperty(topItem, QVariant::String, "Bound Net", ctx->nameOf(ctx->getBoundWireNet(wire)), ElementType::NET);
|
||||
addProperty(topItem, QVariant::String, "Conflicting Wire", ctx->getWireName(ctx->getConflictingWireWire(wire)).c_str(ctx),
|
||||
ElementType::WIRE);
|
||||
addProperty(topItem, QVariant::String, "Conflicting Wire",
|
||||
ctx->getWireName(ctx->getConflictingWireWire(wire)).c_str(ctx), ElementType::WIRE);
|
||||
addProperty(topItem, QVariant::String, "Conflicting Net", ctx->nameOf(ctx->getConflictingWireNet(wire)),
|
||||
ElementType::NET);
|
||||
|
||||
@ -515,8 +515,8 @@ void DesignWidget::onSelectionChanged(const QItemSelection &, const QItemSelecti
|
||||
addProperty(topItem, QVariant::String, "Type", ctx->getPipType(pip).c_str(ctx));
|
||||
addProperty(topItem, QVariant::Bool, "Available", ctx->checkPipAvail(pip));
|
||||
addProperty(topItem, QVariant::String, "Bound Net", ctx->nameOf(ctx->getBoundPipNet(pip)), ElementType::NET);
|
||||
addProperty(topItem, QVariant::String, "Conflicting Wire", ctx->getWireName(ctx->getConflictingPipWire(pip)).c_str(ctx),
|
||||
ElementType::WIRE);
|
||||
addProperty(topItem, QVariant::String, "Conflicting Wire",
|
||||
ctx->getWireName(ctx->getConflictingPipWire(pip)).c_str(ctx), ElementType::WIRE);
|
||||
addProperty(topItem, QVariant::String, "Conflicting Net", ctx->nameOf(ctx->getConflictingPipNet(pip)),
|
||||
ElementType::NET);
|
||||
addProperty(topItem, QVariant::String, "Src Wire", ctx->getWireName(ctx->getPipSrcWire(pip)).c_str(ctx),
|
||||
|
@ -566,10 +566,7 @@ struct Arch : BaseCtx
|
||||
return wire_to_net[wire.index];
|
||||
}
|
||||
|
||||
WireId getConflictingWireWire(WireId wire) const
|
||||
{
|
||||
return wire;
|
||||
}
|
||||
WireId getConflictingWireWire(WireId wire) const { return wire; }
|
||||
|
||||
NetInfo *getConflictingWireNet(WireId wire) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user