pcbnew: Add PadToDie length for tuning actions
This adds the pad to die parameter from each pad to the total line length of the tuned line for comparison with desired. Fixes: lp:1711541 * https://bugs.launchpad.net/kicad/+bug/1711541
This commit is contained in:
parent
4135f0c0e7
commit
4178cf7f36
|
@ -105,6 +105,10 @@ bool DP_MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
||||||
m_tunedPathP = topo.AssembleTrivialPath( m_originPair.PLine().GetLink( 0 ) );
|
m_tunedPathP = topo.AssembleTrivialPath( m_originPair.PLine().GetLink( 0 ) );
|
||||||
m_tunedPathN = topo.AssembleTrivialPath( m_originPair.NLine().GetLink( 0 ) );
|
m_tunedPathN = topo.AssembleTrivialPath( m_originPair.NLine().GetLink( 0 ) );
|
||||||
|
|
||||||
|
m_padToDieP = GetTotalPadToDieLength( m_originPair.PLine() );
|
||||||
|
m_padToDieN = GetTotalPadToDieLength( m_originPair.NLine() );
|
||||||
|
m_padToDieLenth = std::max( m_padToDieP, m_padToDieN );
|
||||||
|
|
||||||
m_world->Remove( m_originPair.PLine() );
|
m_world->Remove( m_originPair.PLine() );
|
||||||
m_world->Remove( m_originPair.NLine() );
|
m_world->Remove( m_originPair.NLine() );
|
||||||
|
|
||||||
|
@ -121,8 +125,8 @@ void DP_MEANDER_PLACER::release()
|
||||||
|
|
||||||
long long int DP_MEANDER_PLACER::origPathLength() const
|
long long int DP_MEANDER_PLACER::origPathLength() const
|
||||||
{
|
{
|
||||||
long long int totalP = 0;
|
long long int totalP = m_padToDieLenth;
|
||||||
long long int totalN = 0;
|
long long int totalN = m_padToDieLenth;
|
||||||
|
|
||||||
for( const ITEM* item : m_tunedPathP.CItems() )
|
for( const ITEM* item : m_tunedPathP.CItems() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,6 +142,8 @@ private:
|
||||||
SEGMENT* m_initialSegment;
|
SEGMENT* m_initialSegment;
|
||||||
|
|
||||||
long long int m_lastLength;
|
long long int m_lastLength;
|
||||||
|
int m_padToDieP;
|
||||||
|
int m_padToDieN;
|
||||||
TUNING_STATUS m_lastStatus;
|
TUNING_STATUS m_lastStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -595,6 +595,7 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
||||||
solid->SetLayers( layers );
|
solid->SetLayers( layers );
|
||||||
solid->SetNet( aPad->GetNetCode() );
|
solid->SetNet( aPad->GetNetCode() );
|
||||||
solid->SetParent( aPad );
|
solid->SetParent( aPad );
|
||||||
|
solid->SetPadToDie( aPad->GetPadToDieLength() );
|
||||||
|
|
||||||
wxPoint wx_c = aPad->ShapePos();
|
wxPoint wx_c = aPad->ShapePos();
|
||||||
wxSize wx_sz = aPad->GetSize();
|
wxSize wx_sz = aPad->GetSize();
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
m_minAmplitude = 100000;
|
m_minAmplitude = 100000;
|
||||||
m_maxAmplitude = 1000000;
|
m_maxAmplitude = 1000000;
|
||||||
m_step = 50000;
|
m_step = 50000;
|
||||||
|
m_lenPadToDie = 0;
|
||||||
m_spacing = 600000;
|
m_spacing = 600000;
|
||||||
m_targetLength = 100000000;
|
m_targetLength = 100000000;
|
||||||
m_targetSkew = 0;
|
m_targetSkew = 0;
|
||||||
|
@ -80,6 +81,8 @@ public:
|
||||||
int m_spacing;
|
int m_spacing;
|
||||||
///> amplitude/spacing adjustment step
|
///> amplitude/spacing adjustment step
|
||||||
int m_step;
|
int m_step;
|
||||||
|
///> length PadToDie
|
||||||
|
int m_lenPadToDie;
|
||||||
///> desired length of the tuned line/diff pair (this is in nm, so allow more than board width)
|
///> desired length of the tuned line/diff pair (this is in nm, so allow more than board width)
|
||||||
long long int m_targetLength;
|
long long int m_targetLength;
|
||||||
///> type of corners for the meandered line
|
///> type of corners for the meandered line
|
||||||
|
|
|
@ -21,19 +21,19 @@
|
||||||
|
|
||||||
#include <base_units.h> // God forgive me doing this...
|
#include <base_units.h> // God forgive me doing this...
|
||||||
|
|
||||||
#include "pns_node.h"
|
|
||||||
#include "pns_itemset.h"
|
|
||||||
#include "pns_topology.h"
|
|
||||||
#include "pns_meander_placer.h"
|
|
||||||
#include "pns_router.h"
|
|
||||||
#include "pns_debug_decorator.h"
|
#include "pns_debug_decorator.h"
|
||||||
|
#include "pns_itemset.h"
|
||||||
|
#include "pns_meander_placer.h"
|
||||||
|
#include "pns_node.h"
|
||||||
|
#include "pns_router.h"
|
||||||
|
#include "pns_solid.h"
|
||||||
|
#include "pns_topology.h"
|
||||||
|
|
||||||
namespace PNS {
|
namespace PNS {
|
||||||
|
|
||||||
MEANDER_PLACER::MEANDER_PLACER( ROUTER* aRouter ) :
|
MEANDER_PLACER::MEANDER_PLACER( ROUTER* aRouter ) :
|
||||||
MEANDER_PLACER_BASE( aRouter )
|
MEANDER_PLACER_BASE( aRouter )
|
||||||
{
|
{
|
||||||
m_world = NULL;
|
|
||||||
m_currentNode = NULL;
|
m_currentNode = NULL;
|
||||||
|
|
||||||
// Init temporary variables (do not leave uninitialized members)
|
// Init temporary variables (do not leave uninitialized members)
|
||||||
|
@ -77,6 +77,8 @@ bool MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
||||||
m_world = Router()->GetWorld()->Branch();
|
m_world = Router()->GetWorld()->Branch();
|
||||||
m_originLine = m_world->AssembleLine( m_initialSegment );
|
m_originLine = m_world->AssembleLine( m_initialSegment );
|
||||||
|
|
||||||
|
m_padToDieLenth = GetTotalPadToDieLength( m_originLine );
|
||||||
|
|
||||||
TOPOLOGY topo( m_world );
|
TOPOLOGY topo( m_world );
|
||||||
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
|
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ bool MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
||||||
|
|
||||||
long long int MEANDER_PLACER::origPathLength() const
|
long long int MEANDER_PLACER::origPathLength() const
|
||||||
{
|
{
|
||||||
long long int total = 0;
|
long long int total = m_padToDieLenth;
|
||||||
for( const ITEM* item : m_tunedPath.CItems() )
|
for( const ITEM* item : m_tunedPath.CItems() )
|
||||||
{
|
{
|
||||||
if( const LINE* l = dyn_cast<const LINE*>( item ) )
|
if( const LINE* l = dyn_cast<const LINE*>( item ) )
|
||||||
|
|
|
@ -95,9 +95,6 @@ protected:
|
||||||
|
|
||||||
virtual long long int origPathLength() const;
|
virtual long long int origPathLength() const;
|
||||||
|
|
||||||
///> pointer to world to search colliding items
|
|
||||||
NODE* m_world;
|
|
||||||
|
|
||||||
///> current routing start point (end of tail, beginning of head)
|
///> current routing start point (end of tail, beginning of head)
|
||||||
VECTOR2I m_currentStart;
|
VECTOR2I m_currentStart;
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,19 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pns_router.h"
|
|
||||||
#include "pns_meander.h"
|
|
||||||
#include "pns_meander_placer_base.h"
|
#include "pns_meander_placer_base.h"
|
||||||
|
#include "pns_meander.h"
|
||||||
|
#include "pns_router.h"
|
||||||
|
#include "pns_solid.h"
|
||||||
|
|
||||||
namespace PNS {
|
namespace PNS {
|
||||||
|
|
||||||
MEANDER_PLACER_BASE::MEANDER_PLACER_BASE( ROUTER* aRouter ) :
|
MEANDER_PLACER_BASE::MEANDER_PLACER_BASE( ROUTER* aRouter ) :
|
||||||
PLACEMENT_ALGO( aRouter )
|
PLACEMENT_ALGO( aRouter )
|
||||||
{
|
{
|
||||||
|
m_world = NULL;
|
||||||
m_currentWidth = 0;
|
m_currentWidth = 0;
|
||||||
|
m_padToDieLenth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,6 +177,44 @@ void MEANDER_PLACER_BASE::tuneLineLength( MEANDERED_LINE& aTuned, long long int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int MEANDER_PLACER_BASE::GetTotalPadToDieLength( const LINE& aLine ) const
|
||||||
|
{
|
||||||
|
int length = 0;
|
||||||
|
JOINT start;
|
||||||
|
JOINT end;
|
||||||
|
|
||||||
|
m_world->FindLineEnds( aLine, start, end );
|
||||||
|
|
||||||
|
// Extract the length of the pad to die for start and end pads
|
||||||
|
for( auto& link : start.LinkList() )
|
||||||
|
{
|
||||||
|
if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
|
||||||
|
{
|
||||||
|
// If there are overlapping pads, choose the first with a non-zero length
|
||||||
|
if( solid->GetPadToDie() > 0 )
|
||||||
|
{
|
||||||
|
length += solid->GetPadToDie();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( auto& link : end.LinkList() )
|
||||||
|
{
|
||||||
|
if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
|
||||||
|
{
|
||||||
|
if( solid->GetPadToDie() > 0 )
|
||||||
|
{
|
||||||
|
length += solid->GetPadToDie();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const MEANDER_SETTINGS& MEANDER_PLACER_BASE::MeanderSettings() const
|
const MEANDER_SETTINGS& MEANDER_PLACER_BASE::MeanderSettings() const
|
||||||
{
|
{
|
||||||
return m_settings;
|
return m_settings;
|
||||||
|
|
|
@ -120,6 +120,8 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetTotalPadToDieLength( const LINE& aLine ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,6 +159,12 @@ protected:
|
||||||
int compareWithTolerance(
|
int compareWithTolerance(
|
||||||
long long int aValue, long long int aExpected, long long int aTolerance = 0 ) const;
|
long long int aValue, long long int aExpected, long long int aTolerance = 0 ) const;
|
||||||
|
|
||||||
|
///> pointer to world to search colliding items
|
||||||
|
NODE* m_world;
|
||||||
|
|
||||||
|
///> total length added by pad to die size
|
||||||
|
int m_padToDieLenth;
|
||||||
|
|
||||||
///> width of the meandered trace(s)
|
///> width of the meandered trace(s)
|
||||||
int m_currentWidth;
|
int m_currentWidth;
|
||||||
///> meandering settings
|
///> meandering settings
|
||||||
|
|
|
@ -36,6 +36,8 @@ MEANDER_SKEW_PLACER::MEANDER_SKEW_PLACER ( ROUTER* aRouter ) :
|
||||||
{
|
{
|
||||||
// Init temporary variables (do not leave uninitialized members)
|
// Init temporary variables (do not leave uninitialized members)
|
||||||
m_coupledLength = 0;
|
m_coupledLength = 0;
|
||||||
|
m_padToDieN = 0;
|
||||||
|
m_padToDieP = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,11 +91,19 @@ bool MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
||||||
|
|
||||||
m_currentWidth = m_originLine.Width();
|
m_currentWidth = m_originLine.Width();
|
||||||
m_currentEnd = VECTOR2I( 0, 0 );
|
m_currentEnd = VECTOR2I( 0, 0 );
|
||||||
|
m_padToDieN = GetTotalPadToDieLength( m_originPair.NLine() );
|
||||||
|
m_padToDieP = GetTotalPadToDieLength( m_originPair.PLine() );
|
||||||
|
|
||||||
if ( m_originPair.PLine().Net() == m_originLine.Net() )
|
if ( m_originPair.PLine().Net() == m_originLine.Net() )
|
||||||
|
{
|
||||||
|
m_padToDieLenth = m_padToDieN;
|
||||||
m_coupledLength = itemsetLength( m_tunedPathN );
|
m_coupledLength = itemsetLength( m_tunedPathN );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_padToDieLenth = m_padToDieP;
|
||||||
m_coupledLength = itemsetLength( m_tunedPathP );
|
m_coupledLength = itemsetLength( m_tunedPathP );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +117,7 @@ long long int MEANDER_SKEW_PLACER::origPathLength() const
|
||||||
|
|
||||||
long long int MEANDER_SKEW_PLACER::itemsetLength( const ITEM_SET& aSet ) const
|
long long int MEANDER_SKEW_PLACER::itemsetLength( const ITEM_SET& aSet ) const
|
||||||
{
|
{
|
||||||
long long int total = 0;
|
long long int total = m_padToDieLenth;
|
||||||
for( const ITEM* item : aSet.CItems() )
|
for( const ITEM* item : aSet.CItems() )
|
||||||
{
|
{
|
||||||
if( const LINE* l = dyn_cast<const LINE*>( item ) )
|
if( const LINE* l = dyn_cast<const LINE*>( item ) )
|
||||||
|
|
|
@ -61,6 +61,8 @@ private:
|
||||||
ITEM_SET m_tunedPath, m_tunedPathP, m_tunedPathN;
|
ITEM_SET m_tunedPath, m_tunedPathP, m_tunedPathN;
|
||||||
|
|
||||||
long long int m_coupledLength;
|
long long int m_coupledLength;
|
||||||
|
int m_padToDieP;
|
||||||
|
int m_padToDieN;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
SOLID() : ITEM( SOLID_T ), m_shape( NULL )
|
SOLID() : ITEM( SOLID_T ), m_shape( NULL )
|
||||||
{
|
{
|
||||||
m_movable = false;
|
m_movable = false;
|
||||||
|
m_padToDie = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~SOLID()
|
~SOLID()
|
||||||
|
@ -50,6 +51,7 @@ public:
|
||||||
{
|
{
|
||||||
m_shape = aSolid.m_shape->Clone();
|
m_shape = aSolid.m_shape->Clone();
|
||||||
m_pos = aSolid.m_pos;
|
m_pos = aSolid.m_pos;
|
||||||
|
m_padToDie = aSolid.m_padToDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool ClassOf( const ITEM* aItem )
|
static inline bool ClassOf( const ITEM* aItem )
|
||||||
|
@ -81,6 +83,16 @@ public:
|
||||||
m_pos = aCenter;
|
m_pos = aCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetPadToDie() const
|
||||||
|
{
|
||||||
|
return m_padToDie;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetPadToDie( int aLen )
|
||||||
|
{
|
||||||
|
m_padToDie = aLen;
|
||||||
|
}
|
||||||
|
|
||||||
virtual VECTOR2I Anchor( int aN ) const override
|
virtual VECTOR2I Anchor( int aN ) const override
|
||||||
{
|
{
|
||||||
return m_pos;
|
return m_pos;
|
||||||
|
@ -105,6 +117,7 @@ private:
|
||||||
VECTOR2I m_pos;
|
VECTOR2I m_pos;
|
||||||
SHAPE* m_shape;
|
SHAPE* m_shape;
|
||||||
VECTOR2I m_offset;
|
VECTOR2I m_offset;
|
||||||
|
int m_padToDie;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue