Improve tie-net heuristics and destructive edit safeguards

This commit is contained in:
Rbanh committed 2026-02-18 20:55:29 -05:00
1 parent 31d2182258
commit f65e4d9876
4 files changed
+28 -4

No files matched your search

+2 -1
View File
@@ -260,7 +260,8 @@ export function compile(payload, options = {}) {
total_length: 0,
direct_length: 0,
detour_ratio: 1,
label_tie_fallbacks: 0
label_tie_fallbacks: 0,
label_tie_routes: 0
},
bus_groups: [],
focus_map: {},
+22 -1
View File
@@ -1366,6 +1366,15 @@ function detectBusGroups(nets) {
}
function shouldUseLabelTie(net, pinNodes, context) {
if (!pinNodes.length) {
return false;
}
const minX = Math.min(...pinNodes.map((p) => p.exit.x), 0);
const maxX = Math.max(...pinNodes.map((p) => p.exit.x), 0);
const minY = Math.min(...pinNodes.map((p) => p.exit.y), 0);
const maxY = Math.max(...pinNodes.map((p) => p.exit.y), 0);
const span = Math.abs(maxX - minX) + Math.abs(maxY - minY);
if (context.renderMode === "explicit") {
return LABEL_TIE_CLASSES.has(net.class) && pinNodes.length > 2;
}
@@ -1378,6 +1387,16 @@ function shouldUseLabelTie(net, pinNodes, context) {
return true;
}
// Prefer readable schematic stubs for dense multi-node nets.
if (pinNodes.length >= 5) {
return true;
}
// Long-distributed analog/signal nets become noisy when fully routed.
if ((net.class === "analog" || net.class === "signal") && pinNodes.length >= 3 && span > GRID * 56) {
return true;
}
return false;
}
@@ -1577,6 +1596,7 @@ function computeLayoutMetrics(routed, busGroups) {
(total, rn) => total + (rn.route_stats?.used_label_tie && rn.route_stats?.fallback_reason ? 1 : 0),
0
);
const labelTieRoutes = routed.reduce((total, rn) => total + (rn.route_stats?.used_label_tie ? 1 : 0), 0);
return {
segment_count: segmentCount,
@@ -1589,7 +1609,8 @@ function computeLayoutMetrics(routed, busGroups) {
total_length: totalLength,
direct_length: totalDirect,
detour_ratio: totalDirect > 0 ? totalLength / totalDirect : 1,
label_tie_fallbacks: labelTieFallbacks
label_tie_fallbacks: labelTieFallbacks,
label_tie_routes: labelTieRoutes
};
}