router: compute diff pair gap on the fly when tuning the length
This commit is contained in:
parent
171d39c8d0
commit
2fd493255d
|
@ -98,7 +98,8 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
|
if( m_originPair.Gap() < 0 )
|
||||||
|
m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
|
||||||
|
|
||||||
if( !m_originPair.PLine().SegmentCount() ||
|
if( !m_originPair.PLine().SegmentCount() ||
|
||||||
!m_originPair.NLine().SegmentCount() )
|
!m_originPair.NLine().SegmentCount() )
|
||||||
|
|
|
@ -78,7 +78,8 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_originPair.SetGap ( Router()->Sizes().DiffPairGap() );
|
if( m_originPair.Gap() < 0 )
|
||||||
|
m_originPair.SetGap ( Router()->Sizes().DiffPairGap() );
|
||||||
|
|
||||||
if( !m_originPair.PLine().SegmentCount() ||
|
if( !m_originPair.PLine().SegmentCount() ||
|
||||||
!m_originPair.NLine().SegmentCount() )
|
!m_originPair.NLine().SegmentCount() )
|
||||||
|
|
|
@ -344,8 +344,9 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
||||||
if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() )
|
if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() )
|
||||||
{
|
{
|
||||||
int dist = s->Seg().Distance( refSeg->Seg() );
|
int dist = s->Seg().Distance( refSeg->Seg() );
|
||||||
|
bool isParallel = refSeg->Seg().ApproxParallel( s->Seg() );
|
||||||
|
|
||||||
if( dist < minDist )
|
if( dist < minDist || ( dist == minDist && isParallel ) )
|
||||||
{
|
{
|
||||||
minDist = dist;
|
minDist = dist;
|
||||||
coupledSeg = s;
|
coupledSeg = s;
|
||||||
|
@ -367,9 +368,20 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
|
||||||
std::swap( lp, ln );
|
std::swap( lp, ln );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gap = -1 ;
|
||||||
|
if( refSeg->Seg().ApproxParallel( coupledSeg->Seg() ) ) {
|
||||||
|
|
||||||
|
// Segments are parallel -> compute pair gap
|
||||||
|
const VECTOR2I refDir = refSeg->Anchor(1) - refSeg->Anchor(0);
|
||||||
|
const VECTOR2I displacement = refSeg->Anchor(1) - coupledSeg->Anchor(1);
|
||||||
|
gap = (int) abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp->Width();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
aPair = PNS_DIFF_PAIR( *lp, *ln );
|
aPair = PNS_DIFF_PAIR( *lp, *ln );
|
||||||
aPair.SetWidth( lp->Width() );
|
aPair.SetWidth( lp->Width() );
|
||||||
aPair.SetLayers( lp->Layers() );
|
aPair.SetLayers( lp->Layers() );
|
||||||
|
aPair.SetGap( gap );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue