router: clean up shoved traces after aborting differential pair routing in shove mode

Note: the single-trace placer (LINE_PLACER) has moved to the FIXED_TAIL for tracking the interim placed routes (and reverting them if user pressed backspace). Unfortunately the DIFF_PAIR_PLACER didn't follow. The result was the dummy CommitPlacement() call at the end of aborted routing would commit the last shove state, even if FixRoute() was never called. For longer-term fix: fix ROUTER_TOOL logic to indicated aborted routing to the router/placer (AbortPlacement() is already there). Also implement FIXED_TAIL in diff pair placement mode.
This commit is contained in:
Tomasz Wlostowski 2025-06-23 00:49:56 +02:00
parent 8c017c7503
commit ed6440b782
2 changed files with 13 additions and 2 deletions

View File

@ -642,6 +642,7 @@ bool DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
m_currentTraceOk = false;
m_currentTrace = DIFF_PAIR();
m_currentTrace.SetNets( m_netP, m_netN );
m_lastFixNode = nullptr;
initPlacement();
@ -842,9 +843,15 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForce
topo.SimplifyLine( &lineN );
m_prevPair = m_currentTrace.EndingPrimitives();
m_lastFixNode = m_lastNode;
// avoid an use-after-free error (CommitPlacement calls NODE::Commit which will invalidate the shove heads state. Need to rethink the memory management).
if( Settings().Mode() == RM_Shove )
m_shove = std::make_unique<SHOVE>( m_world, Router() );
CommitPlacement();
m_placingVia = false;
m_lastFixNode = nullptr;
if( m_snapOnTarget || aForceFinish )
{
@ -862,6 +869,7 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForce
bool DIFF_PAIR_PLACER::AbortPlacement()
{
m_world->KillChildren();
m_lastNode = nullptr;
return true;
}
@ -874,9 +882,10 @@ bool DIFF_PAIR_PLACER::HasPlacedAnything() const
bool DIFF_PAIR_PLACER::CommitPlacement()
{
if( m_lastNode )
Router()->CommitRouting( m_lastNode );
if( m_lastFixNode )
Router()->CommitRouting( m_lastFixNode );
m_lastFixNode = nullptr;
m_lastNode = nullptr;
m_currentNode = nullptr;
return true;

View File

@ -249,6 +249,7 @@ private:
///< Postprocessed world state (including marked collisions & removed loops)
NODE* m_lastNode;
NODE* m_lastFixNode;
SIZES_SETTINGS m_sizes;
@ -277,6 +278,7 @@ private:
ITEM* m_currentEndItem;
bool m_idle;
bool m_hasFixedAnything;
};
}