2020-09-23 21:49:34 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2020 KiCad Developers.
|
|
|
|
*
|
2020-09-26 20:42:56 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2020-09-23 21:49:34 +00:00
|
|
|
*
|
2020-09-26 20:42:56 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2020-09-23 21:49:34 +00:00
|
|
|
*
|
2020-09-26 20:42:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2020-09-23 21:49:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
|
|
|
#include <pad.h>
|
2021-06-11 21:07:02 +00:00
|
|
|
#include <pcb_track.h>
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <drc/drc_engine.h>
|
2020-09-23 21:49:34 +00:00
|
|
|
#include <drc/drc_item.h>
|
|
|
|
#include <drc/drc_rule.h>
|
|
|
|
#include <drc/drc_test_provider.h>
|
2020-09-25 18:29:05 +00:00
|
|
|
#include <drc/drc_length_report.h>
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
#include <connectivity/connectivity_data.h>
|
2020-09-25 18:29:05 +00:00
|
|
|
#include <connectivity/from_to_cache.h>
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
#include <pcb_expr_evaluator.h>
|
|
|
|
|
|
|
|
/*
|
2020-09-25 18:29:05 +00:00
|
|
|
Single-ended matched length + skew + via count test.
|
2020-09-23 21:49:34 +00:00
|
|
|
Errors generated:
|
2020-09-25 18:29:05 +00:00
|
|
|
- DRCE_LENGTH_OUT_OF_RANGE
|
|
|
|
- DRCE_SKEW_OUT_OF_RANGE
|
|
|
|
- DRCE_TOO_MANY_VIAS
|
2020-09-26 20:42:56 +00:00
|
|
|
Todo: arc support
|
2020-09-23 21:49:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class DRC_TEST_PROVIDER_MATCHED_LENGTH : public DRC_TEST_PROVIDER
|
|
|
|
{
|
|
|
|
public:
|
2020-10-25 09:02:07 +00:00
|
|
|
DRC_TEST_PROVIDER_MATCHED_LENGTH () :
|
|
|
|
m_board( nullptr )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-01 13:39:34 +00:00
|
|
|
virtual ~DRC_TEST_PROVIDER_MATCHED_LENGTH()
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool Run() override;
|
|
|
|
|
2020-10-01 13:39:34 +00:00
|
|
|
virtual const wxString GetName() const override
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
|
|
|
return "length";
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual const wxString GetDescription() const override
|
|
|
|
{
|
|
|
|
return "Tests matched track lengths.";
|
|
|
|
}
|
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
DRC_LENGTH_REPORT BuildLengthReport() const;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
bool runInternal( bool aDelayReportMode = false );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
using CONNECTION = DRC_LENGTH_REPORT::ENTRY;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
void checkLengths( DRC_CONSTRAINT& aConstraint, std::vector<CONNECTION>& aMatchedConnections );
|
|
|
|
void checkSkews( DRC_CONSTRAINT& aConstraint, std::vector<CONNECTION>& aMatchedConnections );
|
|
|
|
void checkViaCounts( DRC_CONSTRAINT& aConstraint, std::vector<CONNECTION>& aMatchedConnections );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
BOARD* m_board;
|
2020-09-25 18:29:05 +00:00
|
|
|
DRC_LENGTH_REPORT m_report;
|
2020-09-23 21:49:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
static int computeViaThruLength( PCB_VIA *aVia, const std::set<BOARD_CONNECTED_ITEM*> &conns )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
return 0; // fixme: not yet there...
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkLengths( DRC_CONSTRAINT& aConstraint,
|
|
|
|
std::vector<CONNECTION>& aMatchedConnections )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2021-07-28 20:04:53 +00:00
|
|
|
for( const DRC_LENGTH_REPORT::ENTRY& ent : aMatchedConnections )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
bool minViolation = false;
|
|
|
|
bool maxViolation = false;
|
2020-10-01 13:39:34 +00:00
|
|
|
int minLen = 0;
|
|
|
|
int maxLen = 0;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
if( aConstraint.GetValue().HasMin() && ent.total < aConstraint.GetValue().Min() )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
minViolation = true;
|
|
|
|
minLen = aConstraint.GetValue().Min();
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
2020-09-25 18:29:05 +00:00
|
|
|
else if( aConstraint.GetValue().HasMax() && ent.total > aConstraint.GetValue().Max() )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
maxViolation = true;
|
|
|
|
maxLen = aConstraint.GetValue().Max();
|
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
if( ( minViolation || maxViolation ) )
|
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LENGTH_OUT_OF_RANGE );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
if( minViolation )
|
|
|
|
{
|
2020-11-02 16:20:00 +00:00
|
|
|
m_msg.Printf( _( "(%s min length: %s; actual: %s)" ),
|
|
|
|
aConstraint.GetName(),
|
|
|
|
MessageTextFromValue( userUnits(), minLen ),
|
|
|
|
MessageTextFromValue( userUnits(), ent.total ) );
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
|
|
|
else if( maxViolation )
|
|
|
|
{
|
2020-11-02 16:20:00 +00:00
|
|
|
m_msg.Printf( _( "(%s max length: %s; actual: %s)" ),
|
|
|
|
aConstraint.GetName(),
|
|
|
|
MessageTextFromValue( userUnits(), maxLen ),
|
|
|
|
MessageTextFromValue( userUnits(), ent.total ) );
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
for( auto offendingTrack : ent.items )
|
2020-09-27 15:51:16 +00:00
|
|
|
drcItem->AddItem( offendingTrack );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
drcItem->SetViolatingRule( aConstraint.GetParentRule() );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
reportViolation( drcItem, (*ent.items.begin() )->GetPosition() );
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkews( DRC_CONSTRAINT& aConstraint,
|
|
|
|
std::vector<CONNECTION>& aMatchedConnections )
|
2020-09-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
int avgLength = 0;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
for( const DRC_LENGTH_REPORT::ENTRY& ent : aMatchedConnections )
|
2020-09-25 18:29:05 +00:00
|
|
|
avgLength += ent.total;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
avgLength /= aMatchedConnections.size();
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
for( const auto& ent : aMatchedConnections )
|
2020-09-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
int skew = ent.total - avgLength;
|
|
|
|
if( aConstraint.GetValue().HasMax() && abs( skew ) > aConstraint.GetValue().Max() )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_SKEW_OUT_OF_RANGE );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
m_msg.Printf( _( "(%s max skew: %s; actual: %s; average net length: %s; actual: %s)" ),
|
|
|
|
aConstraint.GetName(),
|
|
|
|
MessageTextFromValue( userUnits(), aConstraint.GetValue().Max() ),
|
|
|
|
MessageTextFromValue( userUnits(), skew ),
|
|
|
|
MessageTextFromValue( userUnits(), avgLength ),
|
|
|
|
MessageTextFromValue( userUnits(), ent.total ) );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + " " + m_msg );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
for( BOARD_CONNECTED_ITEM* offendingTrack : ent.items )
|
2020-09-25 18:29:05 +00:00
|
|
|
drcItem->SetItems( offendingTrack );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
drcItem->SetViolatingRule( aConstraint.GetParentRule() );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
reportViolation( drcItem, (*ent.items.begin() )->GetPosition() );
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkViaCounts( DRC_CONSTRAINT& aConstraint,
|
|
|
|
std::vector<CONNECTION>& aMatchedConnections )
|
2020-09-25 18:29:05 +00:00
|
|
|
{
|
2021-07-28 20:04:53 +00:00
|
|
|
for( const auto& ent : aMatchedConnections )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
if( aConstraint.GetValue().HasMax() && ent.viaCount > aConstraint.GetValue().Max() )
|
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_TOO_MANY_VIAS );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
m_msg.Printf( _( "(%s max count: %d; actual: %d)" ),
|
|
|
|
aConstraint.GetName(),
|
|
|
|
aConstraint.GetValue().Max(),
|
|
|
|
ent.viaCount );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
for( auto offendingTrack : ent.items )
|
|
|
|
drcItem->SetItems( offendingTrack );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
drcItem->SetViolatingRule( aConstraint.GetParentRule() );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
reportViolation( drcItem, (*ent.items.begin() )->GetPosition() );
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
bool DRC_TEST_PROVIDER_MATCHED_LENGTH::Run()
|
2020-09-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
return runInternal( false );
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
bool DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal( bool aDelayReportMode )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
|
|
|
m_board = m_drcEngine->GetBoard();
|
2020-09-25 18:29:05 +00:00
|
|
|
m_report.Clear();
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
if( !aDelayReportMode )
|
|
|
|
{
|
2020-10-05 13:31:10 +00:00
|
|
|
if( !reportPhase( _( "Gathering length-constrained connections..." ) ) )
|
|
|
|
return false;
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
std::map<DRC_RULE*, std::set<BOARD_CONNECTED_ITEM*> > itemSets;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-10-05 13:31:10 +00:00
|
|
|
auto evaluateLengthConstraints =
|
2020-09-23 21:49:34 +00:00
|
|
|
[&]( BOARD_ITEM *item ) -> bool
|
|
|
|
{
|
2021-01-01 22:29:15 +00:00
|
|
|
const DRC_CONSTRAINT_T constraintsToCheck[] = {
|
2020-11-02 16:20:00 +00:00
|
|
|
LENGTH_CONSTRAINT,
|
|
|
|
SKEW_CONSTRAINT,
|
|
|
|
VIA_COUNT_CONSTRAINT,
|
2020-09-25 18:29:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
for( int i = 0; i < 3; i++ )
|
|
|
|
{
|
2021-02-08 14:53:49 +00:00
|
|
|
auto constraint = m_drcEngine->EvalRules( constraintsToCheck[i], item, nullptr,
|
|
|
|
item->GetLayer() );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
if( constraint.IsNull() )
|
|
|
|
continue;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
auto citem = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
itemSets[ constraint.GetParentRule() ].insert( citem );
|
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2020-09-26 20:42:56 +00:00
|
|
|
auto ftCache = m_board->GetConnectivity()->GetFromToCache();
|
|
|
|
|
|
|
|
ftCache->Rebuild( m_board );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
forEachGeometryItem( { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T }, LSET::AllCuMask(),
|
|
|
|
evaluateLengthConstraints );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2021-07-28 20:04:53 +00:00
|
|
|
std::map<DRC_RULE*, std::vector<CONNECTION> > matches;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
for( auto it : itemSets )
|
|
|
|
{
|
2021-07-28 20:04:53 +00:00
|
|
|
std::map<int, std::set<BOARD_CONNECTED_ITEM*> > netMap;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
for( auto citem : it.second )
|
2020-09-25 18:29:05 +00:00
|
|
|
netMap[ citem->GetNetCode() ].insert( citem );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
for( auto nitem : netMap )
|
|
|
|
{
|
2021-07-28 20:04:53 +00:00
|
|
|
CONNECTION ent;
|
2020-09-23 21:49:34 +00:00
|
|
|
ent.items = nitem.second;
|
|
|
|
ent.netcode = nitem.first;
|
|
|
|
ent.netname = m_board->GetNetInfo().GetNetItem( ent.netcode )->GetNetname();
|
|
|
|
|
|
|
|
ent.viaCount = 0;
|
|
|
|
ent.totalRoute = 0;
|
|
|
|
ent.totalVia = 0;
|
|
|
|
ent.totalPadToDie = 0;
|
2020-09-25 18:29:05 +00:00
|
|
|
ent.fromItem = nullptr;
|
|
|
|
ent.toItem = nullptr;
|
|
|
|
|
2020-11-24 22:16:41 +00:00
|
|
|
for( BOARD_CONNECTED_ITEM* citem : nitem.second )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-11-24 22:16:41 +00:00
|
|
|
if( citem->Type() == PCB_VIA_T )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
|
|
|
ent.viaCount++;
|
2021-06-11 21:07:02 +00:00
|
|
|
ent.totalVia += computeViaThruLength( static_cast<PCB_VIA*>( citem ),
|
|
|
|
nitem.second );
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
2020-11-24 22:16:41 +00:00
|
|
|
else if( citem->Type() == PCB_TRACE_T )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
ent.totalRoute += static_cast<PCB_TRACK*>( citem )->GetLength();
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
2020-11-24 22:16:41 +00:00
|
|
|
else if ( citem->Type() == PCB_ARC_T )
|
2020-09-25 18:29:05 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
ent.totalRoute += static_cast<PCB_ARC*>( citem )->GetLength();
|
2020-11-24 22:16:41 +00:00
|
|
|
}
|
|
|
|
else if( citem->Type() == PCB_PAD_T )
|
|
|
|
{
|
|
|
|
ent.totalPadToDie += static_cast<PAD*>( citem )->GetPadToDieLength();
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ent.total = ent.totalRoute + ent.totalVia + ent.totalPadToDie;
|
2020-09-25 18:29:05 +00:00
|
|
|
ent.matchingRule = it.first;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-26 20:42:56 +00:00
|
|
|
// fixme: doesn't seem to work ;-)
|
|
|
|
auto ftPath = ftCache->QueryFromToPath( ent.items );
|
|
|
|
|
|
|
|
if( ftPath )
|
|
|
|
{
|
|
|
|
ent.from = ftPath->fromName;
|
|
|
|
ent.to = ftPath->toName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ent.from = ent.to = _("<unconstrained>");
|
|
|
|
}
|
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
m_report.Add( ent );
|
2020-09-23 21:49:34 +00:00
|
|
|
matches[ it.first ].push_back(ent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
if( !aDelayReportMode )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
for( auto it : matches )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-09-25 18:29:05 +00:00
|
|
|
DRC_RULE *rule = it.first;
|
|
|
|
auto& matchedConnections = it.second;
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
std::sort( matchedConnections.begin(), matchedConnections.end(),
|
2021-07-28 20:04:53 +00:00
|
|
|
[] ( const CONNECTION&a, const CONNECTION&b ) -> int
|
2020-11-02 16:20:00 +00:00
|
|
|
{
|
|
|
|
return a.netname < b.netname;
|
|
|
|
} );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
reportAux( wxString::Format( "Length-constrained traces for rule '%s':",
|
|
|
|
it.first->m_Name ) );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-09-26 20:42:56 +00:00
|
|
|
for( auto& ent : matchedConnections )
|
2020-09-23 21:49:34 +00:00
|
|
|
{
|
2020-11-02 16:20:00 +00:00
|
|
|
reportAux(wxString::Format( " - net: %s, from: %s, to: %s, "
|
|
|
|
"%d matching items, "
|
|
|
|
"total: %s (tracks: %s, vias: %s, pad-to-die: %s), "
|
|
|
|
"vias: %d",
|
|
|
|
ent.netname,
|
|
|
|
ent.from,
|
|
|
|
ent.to,
|
|
|
|
(int) ent.items.size(),
|
|
|
|
MessageTextFromValue( userUnits(), ent.total ),
|
|
|
|
MessageTextFromValue( userUnits(), ent.totalRoute ),
|
|
|
|
MessageTextFromValue( userUnits(), ent.totalVia ),
|
|
|
|
MessageTextFromValue( userUnits(), ent.totalPadToDie ),
|
|
|
|
ent.viaCount ) );
|
2020-09-25 18:29:05 +00:00
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
OPT<DRC_CONSTRAINT> lengthConstraint = rule->FindConstraint( LENGTH_CONSTRAINT );
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( lengthConstraint && lengthConstraint->GetSeverity() != RPT_SEVERITY_IGNORE )
|
2021-07-28 20:04:53 +00:00
|
|
|
checkLengths( *lengthConstraint, matchedConnections );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
OPT<DRC_CONSTRAINT> skewConstraint = rule->FindConstraint( SKEW_CONSTRAINT );
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( skewConstraint && skewConstraint->GetSeverity() != RPT_SEVERITY_IGNORE )
|
2021-07-28 20:04:53 +00:00
|
|
|
checkSkews( *skewConstraint, matchedConnections );
|
2020-09-23 21:49:34 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
OPT<DRC_CONSTRAINT> viaCountConstraint = rule->FindConstraint( VIA_COUNT_CONSTRAINT );
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( viaCountConstraint && viaCountConstraint->GetSeverity() != RPT_SEVERITY_IGNORE )
|
2021-07-28 20:04:53 +00:00
|
|
|
checkViaCounts( *viaCountConstraint, matchedConnections );
|
2020-09-23 21:49:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-25 18:29:05 +00:00
|
|
|
reportRuleStatistics();
|
|
|
|
}
|
2020-09-23 21:49:34 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
2020-11-02 16:20:00 +00:00
|
|
|
static DRC_REGISTER_TEST_PROVIDER<DRC_TEST_PROVIDER_MATCHED_LENGTH> dummy;
|
2020-10-02 20:51:24 +00:00
|
|
|
}
|