KiCad PCB EDA Suite
PNS::MEANDER_SKEW_PLACER Class Reference

MEANDER_SKEW_PLACER. More...

#include <pns_meander_skew_placer.h>

Inheritance diagram for PNS::MEANDER_SKEW_PLACER:
PNS::MEANDER_PLACER PNS::MEANDER_PLACER_BASE PNS::PLACEMENT_ALGO PNS::ALGO_BASE

Public Types

enum  TUNING_STATUS { TOO_SHORT = 0 , TOO_LONG , TUNED }
 < Result of the length tuning operation More...
 

Public Member Functions

 MEANDER_SKEW_PLACER (ROUTER *aRouter)
 
 ~MEANDER_SKEW_PLACER ()
 
bool Start (const VECTOR2I &aP, ITEM *aStartItem) override
 Function Start() More...
 
bool Move (const VECTOR2I &aP, ITEM *aEndItem) override
 Function Move() More...
 
const wxString TuningInfo (EDA_UNITS aUnits) const override
 Return a string describing the status and length of the tuned traces. More...
 
virtual bool FixRoute (const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false) override
 Function FixRoute() More...
 
bool CommitPlacement () override
 
bool AbortPlacement () override
 
bool HasPlacedAnything () const override
 
NODECurrentNode (bool aLoopsRemoved=false) const override
 Function CurrentNode() More...
 
const ITEM_SET Traces () override
 Function Traces() More...
 
const VECTOR2ICurrentStart () const override
 Function CurrentStart() More...
 
const VECTOR2ICurrentEnd () const override
 Function CurrentEnd() More...
 
const std::vector< int > CurrentNets () const override
 Function CurrentNets() More...
 
int CurrentLayer () const override
 Function CurrentLayer() More...
 
virtual TUNING_STATUS TuningStatus () const override
 Return the tuning status (too short, too long, etc.) of the trace(s) being tuned. More...
 
bool CheckFit (MEANDER_SHAPE *aShape) override
 Checks if it's OK to place the shape aShape (i.e. More...
 
virtual void AmplitudeStep (int aSign)
 Increase/decreases the current meandering amplitude by one step. More...
 
virtual void SpacingStep (int aSign)
 Increase/decrease the current meandering spacing by one step. More...
 
virtual int Clearance ()
 Return the clearance of the track(s) being length tuned. More...
 
virtual const MEANDER_SETTINGSMeanderSettings () const
 Return the current meandering configuration. More...
 
virtual void UpdateSettings (const MEANDER_SETTINGS &aSettings)
 
int GetTotalPadToDieLength (const LINE &aLine) const
 
virtual bool UnfixRoute ()
 
virtual bool ToggleVia (bool aEnabled)
 Function ToggleVia() More...
 
virtual bool IsPlacingVia () const
 Function IsPlacingVia() More...
 
virtual bool SetLayer (int aLayer)
 Function SetLayer() More...
 
virtual void FlipPosture ()
 Function FlipPosture() More...
 
virtual void UpdateSizes (const SIZES_SETTINGS &aSizes)
 Function UpdateSizes() More...
 
virtual void SetOrthoMode (bool aOrthoMode)
 Function SetOrthoMode() More...
 
virtual void GetModifiedNets (std::vector< int > &aNets) const
 Function GetModifiedNets. More...
 
ROUTERRouter () const
 Return current router settings. More...
 
ROUTING_SETTINGSSettings () const
 Return the logger object, allowing to dump geometry to a file. More...
 
virtual LOGGERLogger ()
 
void SetLogger (LOGGER *aLogger)
 
void SetDebugDecorator (DEBUG_DECORATOR *aDecorator)
 Assign a debug decorator allowing this algo to draw extra graphics for visual debugging. More...
 
DEBUG_DECORATORDbg () const
 
const BOX2IVisibleViewArea () const
 

Protected Member Functions

bool doMove (const VECTOR2I &aP, ITEM *aEndItem, long long int aTargetLength)
 
void setWorld (NODE *aWorld)
 
void cutTunedLine (const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aTuneStart, const VECTOR2I &aCursorPos, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aTuned, SHAPE_LINE_CHAIN &aPost)
 Extract the part of a track to be meandered, depending on the starting point and the cursor position. More...
 
void tuneLineLength (MEANDERED_LINE &aTuned, long long int aElongation)
 Take a set of meanders in aTuned and tunes their length to extend the original line length by aElongation. More...
 
int compareWithTolerance (long long int aValue, long long int aExpected, long long int aTolerance=0) const
 Compare aValue against aExpected with given tolerance. More...
 
VECTOR2I getSnappedStartPoint (LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
 
long long int lineLength (const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad) const
 Calculate the total length of the line represented by an item set (tracks and vias) More...
 

Protected Attributes

VECTOR2I m_currentStart
 Current world state. More...
 
NODEm_currentNode
 
LINE m_originLine
 
LINE m_currentTrace
 
SHAPE_LINE_CHAIN m_finalShape
 
MEANDERED_LINE m_result
 
LINKED_ITEMm_initialSegment
 Total length added by pad to die size. More...
 
int m_padToDieLength
 
long long int m_lastLength
 
TUNING_STATUS m_lastStatus
 
NODEm_world
 Width of the meandered trace(s). More...
 
int m_currentWidth
 Meander settings. More...
 
MEANDER_SETTINGS m_settings
 The current end point. More...
 
VECTOR2I m_currentEnd
 
SOLIDm_startPad_p
 
SOLIDm_endPad_p
 
SOLIDm_startPad_n
 
SOLIDm_endPad_n
 
DEBUG_DECORATORm_debugDecorator
 
ROUTERm_router
 
LOGGERm_logger
 

Private Member Functions

long long int currentSkew () const
 
long long int origPathLength () const override
 current routing start point (end of tail, beginning of head) More...
 

Private Attributes

DIFF_PAIR m_originPair
 
ITEM_SET m_tunedPath
 
ITEM_SET m_tunedPathP
 
ITEM_SET m_tunedPathN
 
long long int m_coupledLength
 
int m_padToDieP
 
int m_padToDieN
 

Detailed Description

MEANDER_SKEW_PLACER.

Differential pair skew adjustment algorithm.

Definition at line 39 of file pns_meander_skew_placer.h.

Member Enumeration Documentation

◆ TUNING_STATUS

< Result of the length tuning operation

Enumerator
TOO_SHORT 
TOO_LONG 
TUNED 

Definition at line 49 of file pns_meander_placer_base.h.

Constructor & Destructor Documentation

◆ MEANDER_SKEW_PLACER()

PNS::MEANDER_SKEW_PLACER::MEANDER_SKEW_PLACER ( ROUTER aRouter)

Definition at line 35 of file pns_meander_skew_placer.cpp.

35 :
36 MEANDER_PLACER ( aRouter )
37{
38 // Init temporary variables (do not leave uninitialized members)
40 m_padToDieN = 0;
41 m_padToDieP = 0;
42}
MEANDER_PLACER(ROUTER *aRouter)

References m_coupledLength, m_padToDieN, and m_padToDieP.

◆ ~MEANDER_SKEW_PLACER()

PNS::MEANDER_SKEW_PLACER::~MEANDER_SKEW_PLACER ( )

Definition at line 45 of file pns_meander_skew_placer.cpp.

46{
47}

Member Function Documentation

◆ AbortPlacement()

bool PNS::MEANDER_PLACER::AbortPlacement ( )
overridevirtualinherited

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 213 of file pns_meander_placer.cpp.

214{
216 return true;
217}
NODE * m_world
Width of the meandered trace(s).
void KillChildren()
Definition: pns_node.cpp:1467

References PNS::NODE::KillChildren(), and PNS::MEANDER_PLACER_BASE::m_world.

◆ AmplitudeStep()

void PNS::MEANDER_PLACER_BASE::AmplitudeStep ( int  aSign)
virtualinherited

Increase/decreases the current meandering amplitude by one step.

Parameters
aSigndirection (negative = decrease, positive = increase).

Definition at line 49 of file pns_meander_placer_base.cpp.

50{
52 a = std::max( a, m_settings.m_minAmplitude );
53
55}
MEANDER_SETTINGS m_settings
The current end point.
int m_minAmplitude
Maximum meandering amplitude.
Definition: pns_meander.h:78
int m_step
Length PadToDie.
Definition: pns_meander.h:87
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
Definition: pns_meander.h:81

References PNS::MEANDER_SETTINGS::m_maxAmplitude, PNS::MEANDER_SETTINGS::m_minAmplitude, PNS::MEANDER_PLACER_BASE::m_settings, and PNS::MEANDER_SETTINGS::m_step.

◆ CheckFit()

bool PNS::MEANDER_PLACER::CheckFit ( MEANDER_SHAPE aShape)
overridevirtualinherited

Checks if it's OK to place the shape aShape (i.e.

if it doesn't cause DRC violations or collide with other meanders).

Parameters
aShapethe shape to check.
Returns
true if the shape fits.

Reimplemented from PNS::MEANDER_PLACER_BASE.

Definition at line 236 of file pns_meander_placer.cpp.

237{
238 LINE l( m_originLine, aShape->CLine( 0 ) );
239
240 if( m_currentNode->CheckColliding( &l ) )
241 return false;
242
243 int w = aShape->Width();
244 int clearance = w + m_settings.m_spacing;
245
246 return m_result.CheckSelfIntersections( aShape, clearance );
247}
const SHAPE_LINE_CHAIN & CLine() const
Definition: pns_line.h:142
bool CheckSelfIntersections(MEANDER_SHAPE *aShape, int aClearance)
Check if the given shape is intersecting with any other meander in the current line.
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:84
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
Definition: pns_node.cpp:472

References PNS::NODE::CheckColliding(), PNS::MEANDERED_LINE::CheckSelfIntersections(), PNS::MEANDER_SHAPE::CLine(), PNS::MEANDER_PLACER::m_currentNode, PNS::MEANDER_PLACER::m_originLine, PNS::MEANDER_PLACER::m_result, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_spacing, and PNS::MEANDER_SHAPE::Width().

◆ Clearance()

int PNS::MEANDER_PLACER_BASE::Clearance ( )
virtualinherited

Return the clearance of the track(s) being length tuned.

Returns
clearance value in internal units

Definition at line 67 of file pns_meander_placer_base.cpp.

68{
69 // Assumption: All tracks are part of the same net class.
70 // It shouldn't matter which track we pick. They should all have the same clearance if
71 // they are part of the same net class. Therefore, pick the first one on the list.
72 ITEM* itemToCheck = Traces().CItems().front().item;
73 PNS::CONSTRAINT constraint;
74
76 nullptr, CurrentLayer(), &constraint );
77
78 wxCHECK_MSG( constraint.m_Value.HasMin(), m_currentWidth, wxT( "No minimum clearance?" ) );
79
80 return constraint.m_Value.Min();
81}
T Min() const
Definition: minoptmax.h:33
bool HasMin() const
Definition: minoptmax.h:37
ROUTER * Router() const
Return current router settings.
Definition: pns_algo_base.h:54
const ENTRIES & CItems() const
Definition: pns_itemset.h:136
int m_currentWidth
Meander settings.
virtual const ITEM_SET Traces()=0
Function Traces()
virtual int CurrentLayer() const =0
Function CurrentLayer()
RULE_RESOLVER * GetRuleResolver() const
Definition: pns_router.h:176
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, int aLayer, PNS::CONSTRAINT *aConstraint)=0
MINOPTMAX< int > m_Value
Definition: pns_node.h:70

References PNS::ITEM_SET::CItems(), PNS::CT_CLEARANCE, PNS::PLACEMENT_ALGO::CurrentLayer(), PNS::ROUTER::GetRuleResolver(), MINOPTMAX< T >::HasMin(), PNS::MEANDER_PLACER_BASE::m_currentWidth, PNS::CONSTRAINT::m_Value, MINOPTMAX< T >::Min(), PNS::RULE_RESOLVER::QueryConstraint(), PNS::ALGO_BASE::Router(), and PNS::PLACEMENT_ALGO::Traces().

Referenced by PNS::MEANDER_SHAPE::spacing(), and PNS::MEANDER_PLACER_BASE::SpacingStep().

◆ CommitPlacement()

bool PNS::MEANDER_PLACER::CommitPlacement ( )
overridevirtualinherited

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 226 of file pns_meander_placer.cpp.

227{
228 if( m_currentNode )
230
231 m_currentNode = nullptr;
232 return true;
233}
void CommitRouting()
Definition: pns_router.cpp:895

References PNS::ROUTER::CommitRouting(), PNS::MEANDER_PLACER::m_currentNode, and PNS::ALGO_BASE::Router().

Referenced by PNS::MEANDER_PLACER::FixRoute().

◆ compareWithTolerance()

int PNS::MEANDER_PLACER_BASE::compareWithTolerance ( long long int  aValue,
long long int  aExpected,
long long int  aTolerance = 0 
) const
protectedinherited

Compare aValue against aExpected with given tolerance.

Definition at line 344 of file pns_meander_placer_base.cpp.

346{
347 if( aValue < aExpected - aTolerance )
348 return -1;
349 else if( aValue > aExpected + aTolerance )
350 return 1;
351 else
352 return 0;
353}

Referenced by PNS::MEANDER_PLACER::doMove(), and PNS::DP_MEANDER_PLACER::Move().

◆ CurrentEnd()

const VECTOR2I & PNS::MEANDER_PLACER::CurrentEnd ( ) const
overridevirtualinherited

Function CurrentEnd()

Returns the current end of the line(s) being placed/tuned. It may not be equal to the cursor position due to collisions.

Implements PNS::PLACEMENT_ALGO.

Definition at line 261 of file pns_meander_placer.cpp.

262{
263 return m_currentEnd;
264}

References PNS::MEANDER_PLACER_BASE::m_currentEnd.

◆ CurrentLayer()

int PNS::MEANDER_PLACER::CurrentLayer ( ) const
overridevirtualinherited

Function CurrentLayer()

Returns the layer of currently routed track.

Implements PNS::PLACEMENT_ALGO.

Definition at line 266 of file pns_meander_placer.cpp.

267{
268 return m_initialSegment->Layers().Start();
269}
int Start() const
Definition: pns_layerset.h:82
const LAYER_RANGE & Layers() const
Definition: pns_item.h:156
LINKED_ITEM * m_initialSegment
Total length added by pad to die size.

References PNS::ITEM::Layers(), PNS::MEANDER_PLACER::m_initialSegment, and LAYER_RANGE::Start().

◆ CurrentNets()

const std::vector< int > PNS::MEANDER_PLACER::CurrentNets ( ) const
inlineoverridevirtualinherited

Function CurrentNets()

Returns the net code(s) of currently routed track(s).

Implements PNS::PLACEMENT_ALGO.

Definition at line 83 of file pns_meander_placer.h.

84 {
85 return std::vector<int> (1, m_originLine.Net() );
86 }
int Net() const
Definition: pns_item.h:154

References PNS::MEANDER_PLACER::m_originLine, and PNS::ITEM::Net().

◆ CurrentNode()

NODE * PNS::MEANDER_PLACER::CurrentNode ( bool  aLoopsRemoved = false) const
overridevirtualinherited

Function CurrentNode()

Returns the most recent board state.

Implements PNS::PLACEMENT_ALGO.

Definition at line 52 of file pns_meander_placer.cpp.

53{
54 if( !m_currentNode )
55 return m_world;
56
57 return m_currentNode;
58}

References PNS::MEANDER_PLACER::m_currentNode, and PNS::MEANDER_PLACER_BASE::m_world.

◆ currentSkew()

long long int PNS::MEANDER_SKEW_PLACER::currentSkew ( ) const
private

Definition at line 133 of file pns_meander_skew_placer.cpp.

134{
136}
long long int m_lastLength

References m_coupledLength, and PNS::MEANDER_PLACER::m_lastLength.

◆ CurrentStart()

const VECTOR2I & PNS::MEANDER_PLACER::CurrentStart ( ) const
overridevirtualinherited

Function CurrentStart()

Returns the current start of the line(s) being placed/tuned.

Implements PNS::PLACEMENT_ALGO.

Definition at line 256 of file pns_meander_placer.cpp.

257{
258 return m_currentStart;
259}
VECTOR2I m_currentStart
Current world state.

References PNS::MEANDER_PLACER::m_currentStart.

◆ cutTunedLine()

void PNS::MEANDER_PLACER_BASE::cutTunedLine ( const SHAPE_LINE_CHAIN aOrigin,
const VECTOR2I aTuneStart,
const VECTOR2I aCursorPos,
SHAPE_LINE_CHAIN aPre,
SHAPE_LINE_CHAIN aTuned,
SHAPE_LINE_CHAIN aPost 
)
protectedinherited

Extract the part of a track to be meandered, depending on the starting point and the cursor position.

Parameters
aOriginthe original line.
aTuneStartpoint where we start meandering (start click coordinates).
aCursorPoscurrent cursor position.
aPrepart before the beginning of meanders.
aTunedpart to be meandered.
aPostpart after the end of meanders.

Definition at line 90 of file pns_meander_placer_base.cpp.

93{
94 VECTOR2I cp ( aCursorPos );
95
96 if( cp == aTuneStart ) // we don't like tuning segments with 0 length
97 {
98 int idx = aOrigin.FindSegment( cp );
99
100 if( idx >= 0 )
101 {
102 const SEG& s = aOrigin.CSegment( idx );
103 cp += ( s.B - s.A ).Resize( 2 );
104 }
105 else
106 {
107 cp += VECTOR2I( 2, 5 ); // some arbitrary value that is not 45 degrees oriented
108 }
109 }
110
111 VECTOR2I n = aOrigin.NearestPoint( cp, false );
112 VECTOR2I m = aOrigin.NearestPoint( aTuneStart, false );
113
114 SHAPE_LINE_CHAIN l( aOrigin );
115 l.Split( n );
116 l.Split( m );
117
118 int i_start = l.Find( m );
119 int i_end = l.Find( n );
120
121 if( i_start > i_end )
122 {
123 l = l.Reverse();
124 i_start = l.Find( m );
125 i_end = l.Find( n );
126 }
127
128 aPre = l.Slice( 0, i_start );
129 aPost = l.Slice( i_end, -1 );
130 aTuned = l.Slice( i_start, i_end );
131
132 aTuned.Simplify();
133}
Definition: seg.h:42
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
int FindSegment(const VECTOR2I &aP, int aThreshold=1) const
Search for segment containing point aP.
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Return a subset of this line chain containing the [start_index, end_index] range of points.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References SEG::A, SEG::B, SHAPE_LINE_CHAIN::CSegment(), SHAPE_LINE_CHAIN::Find(), SHAPE_LINE_CHAIN::FindSegment(), SHAPE_LINE_CHAIN::NearestPoint(), SHAPE_LINE_CHAIN::Reverse(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), and SHAPE_LINE_CHAIN::Split().

Referenced by PNS::MEANDER_PLACER::doMove(), and PNS::DP_MEANDER_PLACER::Move().

◆ Dbg()

DEBUG_DECORATOR * PNS::ALGO_BASE::Dbg ( ) const
inlineinherited

Definition at line 78 of file pns_algo_base.h.

79 {
80 return m_debugDecorator;
81 }
DEBUG_DECORATOR * m_debugDecorator
Definition: pns_algo_base.h:86

References PNS::ALGO_BASE::m_debugDecorator.

Referenced by PNS::LINE_PLACER::buildInitialLine(), PNS::LINE_PLACER::clipAndCheckCollisions(), PNS::MEANDER_PLACER::doMove(), PNS::COMPONENT_DRAGGER::Drag(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dragWalkaround(), PNS::SHOVE::fixupViaCollisions(), PNS::LINE_PLACER::handlePullback(), PNS::LINE_PLACER::mergeHead(), PNS::DP_MEANDER_PLACER::Move(), Move(), PNS::SHOVE::onCollidingArc(), PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onCollidingVia(), PNS::SHOVE::onReverseCollidingVia(), PNS::DRAGGER::optimizeAndUpdateDraggedLine(), PNS::LINE_PLACER::optimizeTailHeadTransition(), PNS::SHOVE::pushLineStack(), PNS::SHOVE::pushOrShoveVia(), PNS::LINE_PLACER::reduceTail(), PNS::LINE_PLACER::removeLoops(), PNS::SHOVE::replaceLine(), PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::LINE_PLACER::rhWalkOnly(), PNS::LINE_PLACER::routeStep(), PNS::SHOVE::runOptimizer(), PNS::SHOVE::shoveIteration(), PNS::SHOVE::ShoveLines(), PNS::SHOVE::shoveLineToHullSet(), PNS::SHOVE::shoveMainLoop(), PNS::SHOVE::ShoveMultiLines(), PNS::SHOVE::ShoveObstacleLine(), PNS::WALKAROUND::singleStep(), PNS::LINE_PLACER::splitHeadTail(), PNS::LINE_PLACER::Start(), PNS::DRAGGER::Start(), PNS::LINE_PLACER::Trace(), PNS::DRAGGER::tryWalkaround(), and PNS::SHOVE::unwindLineStack().

◆ doMove()

bool PNS::MEANDER_PLACER::doMove ( const VECTOR2I aP,
ITEM aEndItem,
long long int  aTargetLength 
)
protectedinherited

Definition at line 108 of file pns_meander_placer.cpp.

109{
110 SHAPE_LINE_CHAIN pre, tuned, post;
111
112 if( m_currentNode )
113 delete m_currentNode;
114
116
117 cutTunedLine( m_originLine.CLine(), m_currentStart, aP, pre, tuned, post );
118
119 m_result = MEANDERED_LINE( this, false );
122
123 for( int i = 0; i < tuned.SegmentCount(); i++ )
124 {
125 if( tuned.IsArcSegment( i ) )
126 {
127 ssize_t arcIndex = tuned.ArcIndex( i );
128 m_result.AddArc( tuned.Arc( arcIndex ) );
129 i = tuned.NextShape( i );
130
131 // NextShape will return -1 if last shape
132 if( i < 0 )
133 i = tuned.SegmentCount();
134
135 continue;
136 }
137
138 const SEG s = tuned.CSegment( i );
139 m_result.AddCorner( s.A );
140 m_result.MeanderSegment( s, s.Side( aP ) < 0 );
141 m_result.AddCorner( s.B );
142 }
143
144 long long int lineLen = origPathLength();
145
146 m_lastLength = lineLen;
148
149 if( compareWithTolerance( lineLen, aTargetLength, m_settings.m_lengthTolerance ) > 0 )
150 {
152 } else {
153 m_lastLength = lineLen - tuned.Length();
154 tuneLineLength( m_result, aTargetLength - lineLen );
155 }
156
157 for( const ITEM* item : m_tunedPath.CItems() )
158 {
159 if( const LINE* l = dyn_cast<const LINE*>( item ) )
160 {
161 PNS_DBG( Dbg(), AddItem, l, BLUE, 30000, wxT( "tuned-line" ) );
162 }
163 }
164
165 if( m_lastStatus != TOO_LONG )
166 {
167 tuned.Clear();
168
169 for( MEANDER_SHAPE* m : m_result.Meanders() )
170 {
171 if( m->Type() != MT_EMPTY )
172 {
173 tuned.Append ( m->CLine( 0 ) );
174 }
175 }
176
177 m_lastLength += tuned.Length();
178
179 int comp = compareWithTolerance( m_lastLength - aTargetLength, 0,
181
182 if( comp > 0 )
184 else if( comp < 0 )
186 else
188 }
189
191 m_finalShape.Append( pre );
192 m_finalShape.Append( tuned );
193 m_finalShape.Append( post );
195
196 return true;
197}
DEBUG_DECORATOR * Dbg() const
Definition: pns_algo_base.h:78
int Width() const
Return true if the line is geometrically identical as line aOther.
Definition: pns_line.h:161
void SetBaselineOffset(int aOffset)
Set the parallel offset between the base segment and the meandered line.
Definition: pns_meander.h:507
void SetWidth(int aWidth)
Set the line width.
Definition: pns_meander.h:492
void AddCorner(const VECTOR2I &aA, const VECTOR2I &aB=VECTOR2I(0, 0))
Create a dummy meander shape representing a line corner.
void MeanderSegment(const SEG &aSeg, bool aSide, int aBaseIndex=0)
Fit maximum amplitude meanders on a given segment and adds to the current line.
Definition: pns_meander.cpp:45
void AddArc(const SHAPE_ARC &aArc1, const SHAPE_ARC &aArc2=SHAPE_ARC())
Create a dummy meander shape representing an arc corner.
std::vector< MEANDER_SHAPE * > & Meanders()
Definition: pns_meander.h:515
void tuneLineLength(MEANDERED_LINE &aTuned, long long int aElongation)
Take a set of meanders in aTuned and tunes their length to extend the original line length by aElonga...
void cutTunedLine(const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aTuneStart, const VECTOR2I &aCursorPos, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aTuned, SHAPE_LINE_CHAIN &aPost)
Extract the part of a track to be meandered, depending on the starting point and the cursor position.
int compareWithTolerance(long long int aValue, long long int aExpected, long long int aTolerance=0) const
Compare aValue against aExpected with given tolerance.
TUNING_STATUS m_lastStatus
virtual long long int origPathLength() const
current routing start point (end of tail, beginning of head)
SHAPE_LINE_CHAIN m_finalShape
int m_lengthTolerance
Target skew value for diff pair de-skewing.
Definition: pns_meander.h:105
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
Definition: pns_node.cpp:139
int Side(const VECTOR2I &aP) const
Determine on which side of directed line passing via segment ends point aP lies.
Definition: seg.h:143
const SHAPE_ARC & Arc(size_t aArc) const
int NextShape(int aPointIndex, bool aForwards=true) const
Return the vertex index of the next shape in the chain, or -1 if aPointIndex is the last shape.
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
void Clear()
Remove all points from the line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
bool IsArcSegment(size_t aSegment) const
long long int Length() const
Return length of the line chain in Euclidean metric.
@ BLUE
Definition: color4d.h:56
@ MT_EMPTY
Definition: pns_meander.h:46
#define PNS_DBG(dbg, method,...)

References SEG::A, PNS::MEANDERED_LINE::AddArc(), PNS::MEANDERED_LINE::AddCorner(), SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Arc(), SHAPE_LINE_CHAIN::ArcIndex(), SEG::B, BLUE, PNS::NODE::Branch(), PNS::ITEM_SET::CItems(), SHAPE_LINE_CHAIN::Clear(), PNS::LINE::CLine(), PNS::MEANDER_PLACER_BASE::compareWithTolerance(), SHAPE_LINE_CHAIN::CSegment(), PNS::MEANDER_PLACER_BASE::cutTunedLine(), PNS::ALGO_BASE::Dbg(), SHAPE_LINE_CHAIN::IsArcSegment(), SHAPE_LINE_CHAIN::Length(), PNS::MEANDER_PLACER::m_currentNode, PNS::MEANDER_PLACER::m_currentStart, PNS::MEANDER_PLACER::m_finalShape, PNS::MEANDER_PLACER::m_lastLength, PNS::MEANDER_PLACER::m_lastStatus, PNS::MEANDER_SETTINGS::m_lengthTolerance, PNS::MEANDER_PLACER::m_originLine, PNS::MEANDER_PLACER::m_result, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_PLACER::m_tunedPath, PNS::MEANDER_PLACER_BASE::m_world, PNS::MEANDERED_LINE::Meanders(), PNS::MEANDERED_LINE::MeanderSegment(), PNS::MT_EMPTY, SHAPE_LINE_CHAIN::NextShape(), PNS::MEANDER_PLACER::origPathLength(), PNS_DBG, SHAPE_LINE_CHAIN::SegmentCount(), PNS::MEANDERED_LINE::SetBaselineOffset(), PNS::MEANDERED_LINE::SetWidth(), SEG::Side(), SHAPE_LINE_CHAIN::Simplify(), PNS::MEANDER_PLACER_BASE::TOO_LONG, PNS::MEANDER_PLACER_BASE::TOO_SHORT, PNS::MEANDER_PLACER_BASE::TUNED, PNS::MEANDER_PLACER_BASE::tuneLineLength(), and PNS::LINE::Width().

Referenced by PNS::MEANDER_PLACER::Move(), and Move().

◆ FixRoute()

bool PNS::MEANDER_PLACER::FixRoute ( const VECTOR2I aP,
ITEM aEndItem,
bool  aForceFinish = false 
)
overridevirtualinherited

Function FixRoute()

Commits the currently routed items to the parent node, taking aP as the final end point and aEndItem as the final anchor (if provided).

Returns
true, if route has been committed. May return false if the routing result is violating design rules - in such case, the track is only committed if Settings.CanViolateDRC() is on.

Implements PNS::PLACEMENT_ALGO.

Definition at line 200 of file pns_meander_placer.cpp.

201{
202 if( !m_currentNode )
203 return false;
204
208
209 return true;
210}
bool CommitPlacement() override
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
Definition: pns_node.cpp:664

References PNS::NODE::Add(), PNS::MEANDER_PLACER::CommitPlacement(), PNS::MEANDER_PLACER::m_currentNode, PNS::MEANDER_PLACER::m_currentTrace, PNS::MEANDER_PLACER::m_finalShape, and PNS::MEANDER_PLACER::m_originLine.

◆ FlipPosture()

virtual void PNS::PLACEMENT_ALGO::FlipPosture ( )
inlinevirtualinherited

Function FlipPosture()

Toggles the current posture (straight/diagonal) of the trace head.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 167 of file pns_placement_algo.h.

168 {
169 }

◆ GetModifiedNets()

virtual void PNS::PLACEMENT_ALGO::GetModifiedNets ( std::vector< int > &  aNets) const
inlinevirtualinherited

Function GetModifiedNets.

Returns the net codes of all currently routed trace(s)

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 198 of file pns_placement_algo.h.

199 {
200 }

◆ getSnappedStartPoint()

VECTOR2I PNS::MEANDER_PLACER_BASE::getSnappedStartPoint ( LINKED_ITEM aStartItem,
VECTOR2I  aStartPoint 
)
protectedinherited

Definition at line 356 of file pns_meander_placer_base.cpp.

357{
358 if( aStartItem->Kind() == ITEM::SEGMENT_T )
359 {
360 return static_cast<SEGMENT*>( aStartItem )->Seg().NearestPoint( aStartPoint );
361 }
362 else
363 {
364 wxASSERT( aStartItem->Kind() == ITEM::ARC_T );
365 ARC* arc = static_cast<ARC*>( aStartItem );
366
367 if( ( VECTOR2I( arc->Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm() <=
368 ( VECTOR2I( arc->Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
369 {
370 return arc->Anchor( 0 );
371 }
372 else
373 {
374 return arc->Anchor( 1 );
375 }
376 }
377}
@ SEGMENT_T
Definition: pns_item.h:66

References PNS::ARC::Anchor(), PNS::ITEM::ARC_T, PNS::ITEM::Kind(), and PNS::ITEM::SEGMENT_T.

Referenced by PNS::DP_MEANDER_PLACER::Start(), PNS::MEANDER_PLACER::Start(), and Start().

◆ GetTotalPadToDieLength()

int PNS::MEANDER_PLACER_BASE::GetTotalPadToDieLength ( const LINE aLine) const
inherited

Definition at line 300 of file pns_meander_placer_base.cpp.

301{
302 int length = 0;
303 JOINT start;
304 JOINT end;
305
306 m_world->FindLineEnds( aLine, start, end );
307
308 // Extract the length of the pad to die for start and end pads
309 for( auto& link : start.LinkList() )
310 {
311 if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
312 {
313 // If there are overlapping pads, choose the first with a non-zero length
314 if( solid->GetPadToDie() > 0 )
315 {
316 length += solid->GetPadToDie();
317 break;
318 }
319 }
320 }
321
322 for( auto& link : end.LinkList() )
323 {
324 if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
325 {
326 if( solid->GetPadToDie() > 0 )
327 {
328 length += solid->GetPadToDie();
329 break;
330 }
331 }
332 }
333
334 return length;
335}
void FindLineEnds(const LINE &aLine, JOINT &aA, JOINT &aB)
Destroy all child nodes. Applicable only to the root node.
Definition: pns_node.cpp:1085

References PNS::NODE::FindLineEnds(), PNS::JOINT::LinkList(), and PNS::MEANDER_PLACER_BASE::m_world.

◆ HasPlacedAnything()

bool PNS::MEANDER_PLACER::HasPlacedAnything ( ) const
overridevirtualinherited

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 220 of file pns_meander_placer.cpp.

221{
222 return m_currentTrace.SegmentCount() > 0;
223}
int SegmentCount() const
Definition: pns_line.h:144

References PNS::MEANDER_PLACER::m_currentTrace, and PNS::LINE::SegmentCount().

◆ IsPlacingVia()

virtual bool PNS::PLACEMENT_ALGO::IsPlacingVia ( ) const
inlinevirtualinherited

Function IsPlacingVia()

Returns true if the placer is placing a via (or more vias).

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 104 of file pns_placement_algo.h.

105 {
106 return false;
107 }

◆ lineLength()

long long int PNS::MEANDER_PLACER_BASE::lineLength ( const ITEM_SET aLine,
const SOLID aStartPad,
const SOLID aEndPad 
) const
protectedinherited

Calculate the total length of the line represented by an item set (tracks and vias)

Parameters
aLine
Returns
Pointer to world to search colliding items.

If there is a start pad but the pad's layers do not overlap the first track layer, then there must be a fanout via on the line. If there isn't, we still need to have the via back to the pad, so count the distance in the line tuning

Definition at line 380 of file pns_meander_placer_base.cpp.

381{
382 long long int total = 0;
383
384 if( aLine.Empty() )
385 return 0;
386
387 const ITEM* start_item = aLine[0];
388 const ITEM* end_item = aLine[aLine.Size() - 1];
389 bool start_via = false;
390 bool end_via = false;
391
392
398 start_via = aStartPad && ( !aStartPad->LayersOverlap( start_item ) );
399 end_via = aEndPad && ( !aEndPad->LayersOverlap( end_item ) );
400
401 for( int idx = 0; idx < aLine.Size(); idx++ )
402 {
403 const ITEM* item = aLine[idx];
404
405 if( const LINE* l = dyn_cast<const LINE*>( item ) )
406 {
407 total += l->CLine().Length();
408 }
409 else if( item->OfKind( ITEM::VIA_T ) && idx > 0 && idx < aLine.Size() - 1 )
410 {
411 int layerPrev = aLine[idx - 1]->Layer();
412 int layerNext = aLine[idx + 1]->Layer();
413
414 if( layerPrev != layerNext )
415 total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
416 }
417 }
418
419 if( start_via )
420 {
421 int layerPrev = aStartPad->Layer();
422 int layerNext = start_item->Layer();
423
424 total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
425 }
426
427 if( end_via )
428 {
429 int layerPrev = end_item->Layer();
430 int layerNext = aEndPad->Layer();
431
432 total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
433 }
434
435 return total;
436}
ROUTER * m_router
Definition: pns_algo_base.h:87
virtual int StackupHeight(int aFirstLayer, int aSecondLayer) const =0
ROUTER_IFACE * GetInterface() const
Definition: pns_router.h:214

References PNS::ITEM_SET::Empty(), PNS::ROUTER::GetInterface(), PNS::ITEM::Layer(), PNS::ITEM::LayersOverlap(), PNS::ALGO_BASE::m_router, PNS::ITEM::OfKind(), PNS::ITEM_SET::Size(), PNS::ROUTER_IFACE::StackupHeight(), and PNS::ITEM::VIA_T.

Referenced by PNS::DP_MEANDER_PLACER::origPathLength(), PNS::MEANDER_PLACER::origPathLength(), origPathLength(), and Start().

◆ Logger()

LOGGER * PNS::ALGO_BASE::Logger ( )
virtualinherited

Reimplemented in PNS::SHOVE.

Definition at line 34 of file pns_algo_base.cpp.

35{
36 return nullptr;
37}

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::DRAGGER::Start(), and PNS::DRAGGER::tryWalkaround().

◆ MeanderSettings()

const MEANDER_SETTINGS & PNS::MEANDER_PLACER_BASE::MeanderSettings ( ) const
virtualinherited

◆ Move()

bool PNS::MEANDER_SKEW_PLACER::Move ( const VECTOR2I aP,
ITEM aEndItem 
)
overridevirtual

Function Move()

Moves the end of the currently routed primtive(s) to the point aP, taking aEndItem as the anchor (if not NULL). (unless NULL).

Reimplemented from PNS::MEANDER_PLACER.

Definition at line 139 of file pns_meander_skew_placer.cpp.

140{
141 for( const ITEM* item : m_tunedPathP.CItems() )
142 {
143 if( const LINE* l = dyn_cast<const LINE*>( item ) )
144 PNS_DBG( Dbg(), AddItem, l, BLUE, 10000, wxT( "tuned-path-skew-p" ) );
145 }
146
147 for( const ITEM* item : m_tunedPathN.CItems() )
148 {
149 if( const LINE* l = dyn_cast<const LINE*>( item ) )
150 PNS_DBG( Dbg(), AddItem, l, YELLOW, 10000, wxT( "tuned-path-skew-n" ) );
151 }
152
153 return doMove( aP, aEndItem, m_coupledLength + m_settings.m_targetSkew );
154}
bool doMove(const VECTOR2I &aP, ITEM *aEndItem, long long int aTargetLength)
@ YELLOW
Definition: color4d.h:67

References BLUE, PNS::ITEM_SET::CItems(), PNS::ALGO_BASE::Dbg(), PNS::MEANDER_PLACER::doMove(), m_coupledLength, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_targetSkew, m_tunedPathN, m_tunedPathP, PNS_DBG, and YELLOW.

◆ origPathLength()

long long int PNS::MEANDER_SKEW_PLACER::origPathLength ( ) const
overrideprivatevirtual

current routing start point (end of tail, beginning of head)

Reimplemented from PNS::MEANDER_PLACER.

Definition at line 123 of file pns_meander_skew_placer.cpp.

124{
125 if ( m_originPair.NetP() == m_originLine.Net() )
127
129
130}
int NetP() const
long long int lineLength(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad) const
Calculate the total length of the line represented by an item set (tracks and vias)

References PNS::MEANDER_PLACER_BASE::lineLength(), PNS::MEANDER_PLACER_BASE::m_endPad_n, PNS::MEANDER_PLACER_BASE::m_endPad_p, PNS::MEANDER_PLACER::m_originLine, m_originPair, m_padToDieN, m_padToDieP, PNS::MEANDER_PLACER_BASE::m_startPad_n, PNS::MEANDER_PLACER_BASE::m_startPad_p, m_tunedPath, PNS::ITEM::Net(), and PNS::DIFF_PAIR::NetP().

◆ Router()

◆ SetDebugDecorator()

void PNS::ALGO_BASE::SetDebugDecorator ( DEBUG_DECORATOR aDecorator)
inlineinherited

Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.

Definition at line 73 of file pns_algo_base.h.

74 {
75 m_debugDecorator = aDecorator;
76 }

References PNS::ALGO_BASE::m_debugDecorator.

Referenced by PNS::SHOVE::onCollidingSolid(), PNS::LINE_PLACER::rhWalkBase(), PNS::SHOVE::SHOVE(), and PNS::DRAGGER::tryWalkaround().

◆ SetLayer()

virtual bool PNS::PLACEMENT_ALGO::SetLayer ( int  aLayer)
inlinevirtualinherited

Function SetLayer()

Sets the current routing layer.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 114 of file pns_placement_algo.h.

115 {
116 return false;
117 }

◆ SetLogger()

void PNS::ALGO_BASE::SetLogger ( LOGGER aLogger)
inlineinherited

Definition at line 65 of file pns_algo_base.h.

66 {
67 m_logger = aLogger;
68 }
LOGGER * m_logger
Definition: pns_algo_base.h:88

References PNS::ALGO_BASE::m_logger.

Referenced by PNS::LINE_PLACER::rhWalkBase(), and PNS::DRAGGER::tryWalkaround().

◆ SetOrthoMode()

virtual void PNS::PLACEMENT_ALGO::SetOrthoMode ( bool  aOrthoMode)
inlinevirtualinherited

Function SetOrthoMode()

Forces the router to place a straight 90/45 degree trace (with the end as near to the cursor as possible) instead of a standard 135 degree two-segment bend.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 189 of file pns_placement_algo.h.

190 {
191 }

◆ Settings()

◆ setWorld()

void PNS::MEANDER_PLACER::setWorld ( NODE aWorld)
protectedinherited

◆ SpacingStep()

void PNS::MEANDER_PLACER_BASE::SpacingStep ( int  aSign)
virtualinherited

Increase/decrease the current meandering spacing by one step.

Parameters
aSigndirection (negative = decrease, positive = increase).

Definition at line 58 of file pns_meander_placer_base.cpp.

59{
60 int s = m_settings.m_spacing + aSign * m_settings.m_step;
61 s = std::max( s, m_currentWidth + Clearance() );
62
64}
virtual int Clearance()
Return the clearance of the track(s) being length tuned.

References PNS::MEANDER_PLACER_BASE::Clearance(), PNS::MEANDER_PLACER_BASE::m_currentWidth, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_spacing, and PNS::MEANDER_SETTINGS::m_step.

◆ Start()

bool PNS::MEANDER_SKEW_PLACER::Start ( const VECTOR2I aP,
ITEM aStartItem 
)
overridevirtual

Function Start()

Starts placement/drag operation at point aP, taking item aStartItem as anchor (unless NULL).

Reimplemented from PNS::MEANDER_PLACER.

Definition at line 50 of file pns_meander_skew_placer.cpp.

51{
52 if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T) )
53 {
54 Router()->SetFailureReason( _( "Please select a differential pair trace you want to tune." ) );
55 return false;
56 }
57
58 m_initialSegment = static_cast<LINKED_ITEM*>( aStartItem );
59 m_currentNode = nullptr;
61
62 m_world = Router()->GetWorld( )->Branch();
64
65 TOPOLOGY topo( m_world );
66 m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
67
68 if( !topo.AssembleDiffPair ( m_initialSegment, m_originPair ) )
69 {
70 Router()->SetFailureReason( _( "Unable to find complementary differential pair "
71 "net for skew tuning. Make sure the names of the nets belonging "
72 "to a differential pair end with either _N/_P or +/-." ) );
73 return false;
74 }
75
76 if( m_originPair.Gap() < 0 )
77 m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
78
81 return false;
82
83 m_tunedPathP = topo.AssembleTuningPath( m_originPair.PLine().GetLink( 0 ), &m_startPad_p, &m_endPad_p );
84
85 m_padToDieP = 0;
86
87 if( m_startPad_p )
89
90 if( m_endPad_p )
92
93 m_tunedPathN = topo.AssembleTuningPath( m_originPair.NLine().GetLink( 0 ), &m_startPad_n, &m_endPad_n );
94
95 m_padToDieN = 0;
96
97 if( m_startPad_n )
99
100 if( m_endPad_n )
102
104
106 m_currentEnd = VECTOR2I( 0, 0 );
107
108 if ( m_originPair.NetP() == m_originLine.Net() )
109 {
112 }
113 else
114 {
117 }
118
119 return true;
120}
int Gap() const
void SetGap(int aGap)
VECTOR2I getSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
void Remove(ARC *aArc)
Remove an item from this branch.
Definition: pns_node.cpp:889
const LINE AssembleLine(LINKED_ITEM *aSeg, int *aOriginSegmentIndex=nullptr, bool aStopAtLockedJoints=false, bool aFollowLockedSegments=false)
Follow the joint map to assemble a line connecting two non-trivial joints starting from segment aSeg.
Definition: pns_node.cpp:999
void SetFailureReason(const wxString &aReason)
Definition: pns_router.h:209
NODE * GetWorld() const
Definition: pns_router.h:160
int GetPadToDie() const
Definition: pns_solid.h:103
#define _(s)

References _, PNS::ITEM::ARC_T, PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::TOPOLOGY::AssembleTrivialPath(), PNS::TOPOLOGY::AssembleTuningPath(), PNS::NODE::Branch(), PNS::DIFF_PAIR::Gap(), PNS::LINK_HOLDER::GetLink(), PNS::SOLID::GetPadToDie(), PNS::MEANDER_PLACER_BASE::getSnappedStartPoint(), PNS::ROUTER::GetWorld(), PNS::MEANDER_PLACER_BASE::lineLength(), m_coupledLength, PNS::MEANDER_PLACER_BASE::m_currentEnd, PNS::MEANDER_PLACER::m_currentNode, PNS::MEANDER_PLACER::m_currentStart, PNS::MEANDER_PLACER_BASE::m_currentWidth, PNS::MEANDER_PLACER_BASE::m_endPad_n, PNS::MEANDER_PLACER_BASE::m_endPad_p, PNS::MEANDER_PLACER::m_initialSegment, PNS::MEANDER_PLACER::m_originLine, m_originPair, m_padToDieN, m_padToDieP, PNS::MEANDER_PLACER_BASE::m_startPad_n, PNS::MEANDER_PLACER_BASE::m_startPad_p, m_tunedPath, m_tunedPathN, m_tunedPathP, PNS::MEANDER_PLACER_BASE::m_world, PNS::ITEM::Net(), PNS::DIFF_PAIR::NetP(), PNS::DIFF_PAIR::NLine(), PNS::ITEM::OfKind(), PNS::DIFF_PAIR::PLine(), PNS::NODE::Remove(), PNS::ALGO_BASE::Router(), PNS::ITEM::SEGMENT_T, PNS::LINE::SegmentCount(), PNS::ROUTER::SetFailureReason(), PNS::DIFF_PAIR::SetGap(), and PNS::LINE::Width().

◆ ToggleVia()

virtual bool PNS::PLACEMENT_ALGO::ToggleVia ( bool  aEnabled)
inlinevirtualinherited

Function ToggleVia()

Enables/disables a via at the end of currently routed trace.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 94 of file pns_placement_algo.h.

95 {
96 return false;
97 }

◆ Traces()

const ITEM_SET PNS::MEANDER_PLACER::Traces ( )
overridevirtualinherited

Function Traces()

Returns all routed/tuned traces.

Implements PNS::PLACEMENT_ALGO.

Definition at line 250 of file pns_meander_placer.cpp.

251{
253 return ITEM_SET( &m_currentTrace );
254}

References PNS::MEANDER_PLACER::m_currentTrace, PNS::MEANDER_PLACER::m_finalShape, and PNS::MEANDER_PLACER::m_originLine.

◆ tuneLineLength()

void PNS::MEANDER_PLACER_BASE::tuneLineLength ( MEANDERED_LINE aTuned,
long long int  aElongation 
)
protectedinherited

Take a set of meanders in aTuned and tunes their length to extend the original line length by aElongation.

Definition at line 202 of file pns_meander_placer_base.cpp.

203{
204 long long int maxElongation = 0;
205 long long int minElongation = 0;
206 bool finished = false;
207
208 for( MEANDER_SHAPE* m : aTuned.Meanders() )
209 {
210 if( m->Type() != MT_CORNER && m->Type() != MT_ARC )
211 {
212 MEANDER_SHAPE end = *m;
213 MEANDER_TYPE endType;
214
215 if( m->Type() == MT_START || m->Type() == MT_SINGLE )
216 endType = MT_SINGLE;
217 else
218 endType = MT_FINISH;
219
220 end.SetType( endType );
221 end.Recalculate();
222
223 long long int maxEndElongation = end.CurrentLength() - end.BaselineLength();
224
225 if( maxElongation + maxEndElongation > aElongation )
226 {
227 if( !finished )
228 {
229 m->SetType( endType );
230 m->Recalculate();
231
232 if( endType == MT_SINGLE )
233 {
234 // Check if we need to fit this meander
235 long long int endMinElongation =
236 ( m->MinTunableLength() - m->BaselineLength() );
237
238 if( minElongation + endMinElongation >= aElongation )
239 m->MakeEmpty();
240 }
241
242 finished = true;
243 }
244 else
245 {
246 m->MakeEmpty();
247 }
248 }
249
250 maxElongation += m->CurrentLength() - m->BaselineLength();
251 minElongation += m->MinTunableLength() - m->BaselineLength();
252 }
253 }
254
255 long long int remainingElongation = aElongation;
256 int meanderCount = 0;
257
258 for( MEANDER_SHAPE* m : aTuned.Meanders() )
259 {
260 if( m->Type() != MT_CORNER && m->Type() != MT_ARC && m->Type() != MT_EMPTY )
261 {
262 remainingElongation -= m->CurrentLength() - m->BaselineLength();
263 meanderCount++;
264 }
265 }
266
267 long long int lenReductionLeft = -remainingElongation;
268 int meandersLeft = meanderCount;
269
270 if( lenReductionLeft < 0 || !meandersLeft )
271 return;
272
273 for( MEANDER_SHAPE* m : aTuned.Meanders() )
274 {
275 if( m->Type() != MT_CORNER && m->Type() != MT_ARC && m->Type() != MT_EMPTY )
276 {
277 long long int lenReductionHere = lenReductionLeft / meandersLeft;
278 long long int initialLen = m->CurrentLength();
279 int minAmpl = m->MinAmplitude();
280
281 int amp = findAmplitudeForLength( m, initialLen - lenReductionHere, minAmpl,
282 m->Amplitude() );
283
284 if( amp < minAmpl )
285 amp = minAmpl;
286
287 m->SetTargetBaselineLength( m->BaselineLength() );
288 m->Resize( amp );
289
290 lenReductionLeft -= initialLen - m->CurrentLength();
291 meandersLeft--;
292
293 if( !meandersLeft )
294 break;
295 }
296 }
297}
MEANDER_TYPE
Shapes of available meanders.
Definition: pns_meander.h:37
@ MT_ARC
Definition: pns_meander.h:45
@ MT_START
Definition: pns_meander.h:39
@ MT_FINISH
Definition: pns_meander.h:40
@ MT_CORNER
Definition: pns_meander.h:44
@ MT_SINGLE
Definition: pns_meander.h:38
int findAmplitudeForLength(MEANDER_SHAPE *m, int targetLength, int minAmp, int maxAmp)

References PNS::MEANDER_SHAPE::BaselineLength(), PNS::MEANDER_SHAPE::CurrentLength(), PNS::findAmplitudeForLength(), PNS::MEANDERED_LINE::Meanders(), PNS::MT_ARC, PNS::MT_CORNER, PNS::MT_EMPTY, PNS::MT_FINISH, PNS::MT_SINGLE, PNS::MT_START, PNS::MEANDER_SHAPE::Recalculate(), and PNS::MEANDER_SHAPE::SetType().

Referenced by PNS::MEANDER_PLACER::doMove(), and PNS::DP_MEANDER_PLACER::Move().

◆ TuningInfo()

const wxString PNS::MEANDER_SKEW_PLACER::TuningInfo ( EDA_UNITS  aUnits) const
overridevirtual

Return a string describing the status and length of the tuned traces.

Reimplemented from PNS::MEANDER_PLACER.

Definition at line 157 of file pns_meander_skew_placer.cpp.

158{
159 wxString status;
160
161 switch( m_lastStatus )
162 {
163 case TOO_LONG:
164 status = _( "Too long: skew " );
165 break;
166 case TOO_SHORT:
167 status = _( "Too short: skew " );
168 break;
169 case TUNED:
170 status = _( "Tuned: skew " );
171 break;
172 default:
173 return _( "?" );
174 }
175
177 status += wxT( "/" );
179
180 return status;
181}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
wxString MessageTextFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units.
Definition: eda_units.cpp:326

References _, m_coupledLength, PNS::MEANDER_PLACER::m_lastLength, PNS::MEANDER_PLACER::m_lastStatus, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_targetSkew, EDA_UNIT_UTILS::UI::MessageTextFromValue(), pcbIUScale, PNS::MEANDER_PLACER_BASE::TOO_LONG, PNS::MEANDER_PLACER_BASE::TOO_SHORT, and PNS::MEANDER_PLACER_BASE::TUNED.

◆ TuningStatus()

MEANDER_PLACER::TUNING_STATUS PNS::MEANDER_PLACER::TuningStatus ( ) const
overridevirtualinherited

Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.

Implements PNS::MEANDER_PLACER_BASE.

Definition at line 299 of file pns_meander_placer.cpp.

300{
301 return m_lastStatus;
302}

References PNS::MEANDER_PLACER::m_lastStatus.

◆ UnfixRoute()

virtual bool PNS::PLACEMENT_ALGO::UnfixRoute ( )
inlinevirtualinherited

Reimplemented in PNS::LINE_PLACER.

Definition at line 81 of file pns_placement_algo.h.

81{ return false; };

◆ UpdateSettings()

void PNS::MEANDER_PLACER_BASE::UpdateSettings ( const MEANDER_SETTINGS aSettings)
virtualinherited

◆ UpdateSizes()

virtual void PNS::PLACEMENT_ALGO::UpdateSizes ( const SIZES_SETTINGS aSizes)
inlinevirtualinherited

Function UpdateSizes()

Performs on-the-fly update of the width, via diameter & drill size from a settings class. Used to dynamically change these parameters as the track is routed.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 178 of file pns_placement_algo.h.

179 {
180 }

◆ VisibleViewArea()

const BOX2I & PNS::ALGO_BASE::VisibleViewArea ( ) const
inherited

Definition at line 40 of file pns_algo_base.cpp.

41{
42 return m_router->VisibleViewArea();
43}
const BOX2I & VisibleViewArea() const
Definition: pns_router.h:217

References PNS::ALGO_BASE::m_router, and PNS::ROUTER::VisibleViewArea().

Referenced by PNS::DRAGGER::optimizeAndUpdateDraggedLine(), and PNS::SHOVE::runOptimizer().

Member Data Documentation

◆ m_coupledLength

long long int PNS::MEANDER_SKEW_PLACER::m_coupledLength
private

Definition at line 62 of file pns_meander_skew_placer.h.

Referenced by currentSkew(), MEANDER_SKEW_PLACER(), Move(), Start(), and TuningInfo().

◆ m_currentEnd

VECTOR2I PNS::MEANDER_PLACER_BASE::m_currentEnd
protectedinherited

◆ m_currentNode

◆ m_currentStart

VECTOR2I PNS::MEANDER_PLACER::m_currentStart
protectedinherited

◆ m_currentTrace

LINE PNS::MEANDER_PLACER::m_currentTrace
protectedinherited

◆ m_currentWidth

◆ m_debugDecorator

DEBUG_DECORATOR* PNS::ALGO_BASE::m_debugDecorator
protectedinherited

Definition at line 86 of file pns_algo_base.h.

Referenced by PNS::ALGO_BASE::Dbg(), and PNS::ALGO_BASE::SetDebugDecorator().

◆ m_endPad_n

◆ m_endPad_p

SOLID* PNS::MEANDER_PLACER_BASE::m_endPad_p
protectedinherited

◆ m_finalShape

SHAPE_LINE_CHAIN PNS::MEANDER_PLACER::m_finalShape
protectedinherited

◆ m_initialSegment

LINKED_ITEM* PNS::MEANDER_PLACER::m_initialSegment
protectedinherited

Total length added by pad to die size.

Definition at line 119 of file pns_meander_placer.h.

Referenced by PNS::MEANDER_PLACER::CurrentLayer(), PNS::MEANDER_PLACER::MEANDER_PLACER(), PNS::MEANDER_PLACER::Start(), and Start().

◆ m_lastLength

long long int PNS::MEANDER_PLACER::m_lastLength
protectedinherited

◆ m_lastStatus

◆ m_logger

LOGGER* PNS::ALGO_BASE::m_logger
protectedinherited

Definition at line 88 of file pns_algo_base.h.

Referenced by PNS::ALGO_BASE::SetLogger().

◆ m_originLine

◆ m_originPair

DIFF_PAIR PNS::MEANDER_SKEW_PLACER::m_originPair
private

Definition at line 59 of file pns_meander_skew_placer.h.

Referenced by origPathLength(), and Start().

◆ m_padToDieLength

int PNS::MEANDER_PLACER::m_padToDieLength
protectedinherited

◆ m_padToDieN

int PNS::MEANDER_SKEW_PLACER::m_padToDieN
private

Definition at line 64 of file pns_meander_skew_placer.h.

Referenced by MEANDER_SKEW_PLACER(), origPathLength(), and Start().

◆ m_padToDieP

int PNS::MEANDER_SKEW_PLACER::m_padToDieP
private

Definition at line 63 of file pns_meander_skew_placer.h.

Referenced by MEANDER_SKEW_PLACER(), origPathLength(), and Start().

◆ m_result

MEANDERED_LINE PNS::MEANDER_PLACER::m_result
protectedinherited

◆ m_router

◆ m_settings

◆ m_startPad_n

◆ m_startPad_p

SOLID* PNS::MEANDER_PLACER_BASE::m_startPad_p
protectedinherited

◆ m_tunedPath

ITEM_SET PNS::MEANDER_SKEW_PLACER::m_tunedPath
private

Definition at line 60 of file pns_meander_skew_placer.h.

Referenced by origPathLength(), and Start().

◆ m_tunedPathN

ITEM_SET PNS::MEANDER_SKEW_PLACER::m_tunedPathN
private

Definition at line 60 of file pns_meander_skew_placer.h.

Referenced by Move(), and Start().

◆ m_tunedPathP

ITEM_SET PNS::MEANDER_SKEW_PLACER::m_tunedPathP
private

Definition at line 60 of file pns_meander_skew_placer.h.

Referenced by Move(), and Start().

◆ m_world


The documentation for this class was generated from the following files: