diff --git a/docs/repro79-demo.mp4 b/docs/repro79-demo.mp4 new file mode 100644 index 00000000..724697df Binary files /dev/null and b/docs/repro79-demo.mp4 differ diff --git a/docs/repro79-demo.svg b/docs/repro79-demo.svg new file mode 100644 index 00000000..31a7d4e7 --- /dev/null +++ b/docs/repro79-demo.svg @@ -0,0 +1,42 @@ + + + Issue #79 demo: remove extra net-label traces + Repro61 uses only netConnections for VCC and GND. Those should render as net labels, not physical wire traces. + + + Before + Net-label-only pins still generated traces + + + R1 + R2 + + + + + + + extra VCC trace + extra GND trace + + + After PR #260 + Only directly-wired nets are queued for MSP traces + + + R1 + R2 + + + + + + VCC + + GND + 0 MSP pairs, 0 traces + + + Verification + Targeted repro tests pass, full suite passes: 54 pass, 4 skip, 0 fail. PR body includes /claim #79. + diff --git a/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts b/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts index 31e0df39..f4e2d62b 100644 --- a/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts +++ b/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts @@ -55,6 +55,12 @@ export class LongDistancePairSolver extends BaseSolver { primaryConnectedPinIds.add(pair.pins[0].pinId) primaryConnectedPinIds.add(pair.pins[1].pinId) } + const directlyWiredPinIds = new Set() + for (const dc of inputProblem.directConnections) { + for (const pinId of dc.pinIds) { + directlyWiredPinIds.add(pinId) + } + } const { netConnMap } = getConnectivityMapsFromInputProblem(inputProblem) this.netConnMap = netConnMap @@ -73,7 +79,9 @@ export class LongDistancePairSolver extends BaseSolver { const addedPairKeys = new Set() for (const netId of Object.keys(netConnMap.netMap)) { - const allPinIdsInNet = netConnMap.getIdsConnectedToNet(netId) + const allPinIdsInNet = netConnMap + .getIdsConnectedToNet(netId) + .filter((pinId) => directlyWiredPinIds.has(pinId)) if (allPinIdsInNet.length < 2) continue const unconnectedPinIds = allPinIdsInNet.filter( diff --git a/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts b/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts index 48b46c90..b4730089 100644 --- a/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +++ b/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts @@ -74,7 +74,16 @@ export class MspConnectionPairSolver extends BaseSolver { } } - this.queuedDcNetIds = Object.keys(netConnMap.netMap) + const directlyWiredPinIds = new Set() + for (const dc of inputProblem.directConnections) { + for (const pid of dc.pinIds) { + directlyWiredPinIds.add(pid) + } + } + this.queuedDcNetIds = Object.keys(netConnMap.netMap).filter((netId) => { + const connectedIds = netConnMap.getIdsConnectedToNet(netId) as string[] + return connectedIds.some((id) => directlyWiredPinIds.has(id)) + }) } override getConstructorParams(): ConstructorParameters< diff --git a/tests/examples/__snapshots__/example01.snap.svg b/tests/examples/__snapshots__/example01.snap.svg index 2614ba80..ae8c10c0 100644 --- a/tests/examples/__snapshots__/example01.snap.svg +++ b/tests/examples/__snapshots__/example01.snap.svg @@ -2,106 +2,121 @@ +x-" data-x="-0.8" data-y="0.2" cx="422.5742574257426" cy="289.44950495049505" r="3" fill="hsl(319, 100%, 50%, 0.8)" /> +x-" data-x="-0.8" data-y="0" cx="422.5742574257426" cy="311.62772277227725" r="3" fill="hsl(320, 100%, 50%, 0.8)" /> +x-" data-x="-0.8" data-y="-0.2" cx="422.5742574257426" cy="333.80594059405945" r="3" fill="hsl(321, 100%, 50%, 0.8)" /> +x+" data-x="0.8" data-y="-0.2" cx="600" cy="333.80594059405945" r="3" fill="hsl(322, 100%, 50%, 0.8)" /> +x+" data-x="0.8" data-y="0" cx="600" cy="311.62772277227725" r="3" fill="hsl(323, 100%, 50%, 0.8)" /> +x+" data-x="0.8" data-y="0.2" cx="600" cy="289.44950495049505" r="3" fill="hsl(324, 100%, 50%, 0.8)" /> +y+" data-x="-2" data-y="0.5" cx="289.50495049504957" cy="256.1821782178218" r="3" fill="hsl(121, 100%, 50%, 0.8)" /> +y-" data-x="-2" data-y="-0.5" cx="289.50495049504957" cy="367.0732673267327" r="3" fill="hsl(122, 100%, 50%, 0.8)" /> +y+" data-x="-4" data-y="0.5" cx="67.72277227722776" cy="256.1821782178218" r="3" fill="hsl(2, 100%, 50%, 0.8)" /> +y-" data-x="-4" data-y="-0.5" cx="67.72277227722776" cy="367.0732673267327" r="3" fill="hsl(3, 100%, 50%, 0.8)" /> +orientation: y+" data-x="-1.1" data-y="0.20000000000000018" cx="389.3069306930693" cy="289.44950495049505" r="3" fill="hsl(40, 100%, 50%, 0.9)" /> +orientation: x-" data-x="-1.275" data-y="0" cx="369.90099009900996" cy="311.62772277227725" r="3" fill="hsl(40, 100%, 50%, 0.9)" /> +orientation: y-" data-x="-0.901" data-y="-0.30100000000000005" cx="411.3742574257426" cy="345.00594059405944" r="3" fill="hsl(40, 100%, 50%, 0.9)" /> - + + + + - + - + - + - + - + - + - + - + - + - + - + +available orientations: y+" data-x="-1.1" data-y="0.42500000000000016" x="378.21782178217825" y="239.54851485148515" width="22.178217821782198" height="49.9009900990099" fill="#ef444466" stroke="#ef4444" stroke-width="0.009017857142857143" /> +available orientations: x+, x-" data-x="-1.5" data-y="0" x="320" y="300.5386138613862" width="49.90099009900996" height="22.17821782178214" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" /> + + + + + + +available orientations: y-" data-x="-2" data-y="-0.726" x="278.41584158415844" y="367.1841584158416" width="22.178217821782198" height="49.90099009900996" fill="#00000066" stroke="#000000" stroke-width="0.009017857142857143" />