PCB_EXPR_EVALUATOR: added isDiffPair() API method
This commit is contained in:
parent
5c2c66dd07
commit
b5fa523a11
|
@ -150,7 +150,7 @@ static int matchDpSuffix( const wxString& aNetName, wxString& aComplementNet,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int isNetADiffPair( BOARD* aBoard, int aNet, int& aNetP, int& aNetN )
|
int DRC_ENGINE::IsNetADiffPair( BOARD* aBoard, int aNet, int& aNetP, int& aNetN )
|
||||||
{
|
{
|
||||||
wxString refName = aBoard->FindNet( aNet )->GetNetname();
|
wxString refName = aBoard->FindNet( aNet )->GetNetname();
|
||||||
wxString dummy, coupledNetName;
|
wxString dummy, coupledNetName;
|
||||||
|
@ -370,7 +370,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
|
||||||
auto citem = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
auto citem = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
||||||
int refNet = citem->GetNetCode();
|
int refNet = citem->GetNetCode();
|
||||||
|
|
||||||
if( !isNetADiffPair( m_board, refNet, key.netP, key.netN ) ) // not our business
|
if( !DRC_ENGINE::IsNetADiffPair( m_board, refNet, key.netP, key.netN ) ) // not our business
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
drc_dbg(10, "eval dp %p\n", item );
|
drc_dbg(10, "eval dp %p\n", item );
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <connectivity/connectivity_algo.h>
|
#include <connectivity/connectivity_algo.h>
|
||||||
#include <connectivity/from_to_cache.h>
|
#include <connectivity/from_to_cache.h>
|
||||||
|
|
||||||
|
#include <drc/drc_engine.h>
|
||||||
|
|
||||||
|
|
||||||
bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self )
|
bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
|
@ -59,20 +60,12 @@ bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int r =0 ;
|
|
||||||
|
|
||||||
if( ftCache->IsOnFromToPath( static_cast<BOARD_CONNECTED_ITEM*>( item ),
|
if( ftCache->IsOnFromToPath( static_cast<BOARD_CONNECTED_ITEM*>( item ),
|
||||||
argFrom->AsString(), argTo->AsString() ) )
|
argFrom->AsString(), argTo->AsString() ) )
|
||||||
{
|
{
|
||||||
result->Set(1.0);
|
result->Set(1.0);
|
||||||
r = 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*printf("isonfromto %p %s %s -> %d\n", static_cast<BOARD_CONNECTED_ITEM*>( item ),
|
|
||||||
(const char *)argFrom->AsString(),
|
|
||||||
(const char *)argTo->AsString(), r );*/
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,9 +323,29 @@ static void isBlindBuriedVia( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
{
|
{
|
||||||
result->Set ( 1.0 );
|
result->Set ( 1.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void isDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
|
{
|
||||||
|
PCB_EXPR_VAR_REF* vref = static_cast<PCB_EXPR_VAR_REF*>( self );
|
||||||
|
BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
|
||||||
|
LIBEVAL::VALUE* result = aCtx->AllocValue();
|
||||||
|
|
||||||
|
result->Set( 0.0 );
|
||||||
|
aCtx->Push( result );
|
||||||
|
|
||||||
|
if( item->IsConnected() )
|
||||||
|
{
|
||||||
|
int net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode();
|
||||||
|
int net_p, net_n;
|
||||||
|
|
||||||
|
if( DRC_ENGINE::IsNetADiffPair( item->GetBoard(), net, net_p, net_n ) )
|
||||||
|
result->Set( 1.0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS()
|
PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS()
|
||||||
{
|
{
|
||||||
RegisterAllFunctions();
|
RegisterAllFunctions();
|
||||||
|
@ -350,7 +363,7 @@ void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions()
|
||||||
RegisterFunc( "isBlindBuriedVia()", isBlindBuriedVia );
|
RegisterFunc( "isBlindBuriedVia()", isBlindBuriedVia );
|
||||||
RegisterFunc( "memberOf('x')", memberOf );
|
RegisterFunc( "memberOf('x')", memberOf );
|
||||||
RegisterFunc( "fromTo('x','y')", exprFromTo );
|
RegisterFunc( "fromTo('x','y')", exprFromTo );
|
||||||
//RegisterFunc( "isDiffPair()", exprFromTo );
|
RegisterFunc( "isDiffPair()", isDiffPair );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue