Update diff pair rule syntax to be clearer.
Fixes https://gitlab.com/kicad/code/kicad/issues/8010
This commit is contained in:
parent
040cdd64f2
commit
a2ffb45698
|
@ -110,10 +110,6 @@ True if any part of `A` lies within the given zone's outline.
|
||||||
|
|
||||||
A.isPlated()
|
A.isPlated()
|
||||||
True if `A` has a hole which is plated.
|
True if `A` has a hole which is plated.
|
||||||
<br><br>
|
|
||||||
|
|
||||||
A.isDiffPair()
|
|
||||||
True if `A` has a net that is part of a differential pair.
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
A.inDiffPair('<net_name>')
|
A.inDiffPair('<net_name>')
|
||||||
|
@ -122,7 +118,7 @@ True if `A` has net that is part of the specified differential pair.
|
||||||
matches items in the `CLK_P` and `CLK_N` nets.
|
matches items in the `CLK_P` and `CLK_N` nets.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
A.isCoupledDiffPair()
|
AB.isCoupledDiffPair()
|
||||||
True if `A` and `B` are members of the same diff pair.
|
True if `A` and `B` are members of the same diff pair.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
@ -191,12 +187,12 @@ For the latter use a `(layer "layer_name")` clause in the rule.
|
||||||
(condition "A.Pad_Type == 'Through-hole'"))
|
(condition "A.Pad_Type == 'Through-hole'"))
|
||||||
|
|
||||||
|
|
||||||
# Specify a larger clearance around a particular diff-pair
|
# Specify an optimal gap for a particular diff-pair
|
||||||
(rule "dp clearance"
|
(rule "dp clock gap"
|
||||||
(constraint clearance (min "1.5mm"))
|
(constraint diff_pair_gap (opt "0.8mm"))
|
||||||
(condition "A.inDiffPair('CLK')"))
|
(condition "A.inDiffPair('CLK') && AB.isCoupledDiffPair()"))
|
||||||
|
|
||||||
# Specify a larger clearance around any diff-pair
|
# Specify a larger clearance around any diff-pair
|
||||||
(rule "dp clearance"
|
(rule "dp clearance"
|
||||||
(constraint clearance (min "1.5mm"))
|
(constraint clearance (min "1.5mm"))
|
||||||
(condition "A.isDiffPair() && !A.isCoupledDiffPair()"))
|
(condition "A.inDiffPair('*') && !AB.isCoupledDiffPair()"))
|
||||||
|
|
|
@ -266,7 +266,7 @@ void DRC_ENGINE::loadImplicitRules()
|
||||||
ncName );
|
ncName );
|
||||||
netclassRule->m_Implicit = true;
|
netclassRule->m_Implicit = true;
|
||||||
|
|
||||||
expr = wxString::Format( "A.NetClass == '%s' && A.isDiffPair()",
|
expr = wxString::Format( "A.NetClass == '%s' && A.inDiffPair('*')",
|
||||||
ncName );
|
ncName );
|
||||||
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
|
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
|
||||||
netclassItemSpecificRules.push_back( netclassRule );
|
netclassItemSpecificRules.push_back( netclassRule );
|
||||||
|
@ -295,7 +295,7 @@ void DRC_ENGINE::loadImplicitRules()
|
||||||
ncName );
|
ncName );
|
||||||
netclassRule->m_Implicit = true;
|
netclassRule->m_Implicit = true;
|
||||||
|
|
||||||
expr = wxString::Format( "A.NetClass == '%s' && A.isCoupledDiffPair()",
|
expr = wxString::Format( "A.NetClass == '%s' && AB.isCoupledDiffPair()",
|
||||||
ncName );
|
ncName );
|
||||||
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
|
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
|
||||||
netclassItemSpecificRules.push_back( netclassRule );
|
netclassItemSpecificRules.push_back( netclassRule );
|
||||||
|
|
|
@ -708,26 +708,6 @@ static void isBlindBuriedVia( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 && item->IsConnected() )
|
|
||||||
{
|
|
||||||
NETINFO_ITEM* netinfo = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
|
|
||||||
int dummy_p, dummy_n;
|
|
||||||
|
|
||||||
if( netinfo && DRC_ENGINE::IsNetADiffPair( item->GetBoard(), netinfo, dummy_p, dummy_n ) )
|
|
||||||
result->Set( 1.0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void isCoupledDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
static void isCoupledDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
{
|
{
|
||||||
PCB_EXPR_CONTEXT* context = static_cast<PCB_EXPR_CONTEXT*>( aCtx );
|
PCB_EXPR_CONTEXT* context = static_cast<PCB_EXPR_CONTEXT*>( aCtx );
|
||||||
|
@ -806,7 +786,6 @@ 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()", isDiffPair );
|
|
||||||
RegisterFunc( "isCoupledDiffPair()", isCoupledDiffPair );
|
RegisterFunc( "isCoupledDiffPair()", isCoupledDiffPair );
|
||||||
RegisterFunc( "inDiffPair('x')", inDiffPair );
|
RegisterFunc( "inDiffPair('x')", inDiffPair );
|
||||||
}
|
}
|
||||||
|
@ -964,7 +943,7 @@ std::unique_ptr<LIBEVAL::VAR_REF> PCB_EXPR_UCODE::CreateVarRef( const wxString&
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aVar == "A" )
|
if( aVar == "A" || aVar == "AB" )
|
||||||
vref = std::make_unique<PCB_EXPR_VAR_REF>( 0 );
|
vref = std::make_unique<PCB_EXPR_VAR_REF>( 0 );
|
||||||
else if( aVar == "B" )
|
else if( aVar == "B" )
|
||||||
vref = std::make_unique<PCB_EXPR_VAR_REF>( 1 );
|
vref = std::make_unique<PCB_EXPR_VAR_REF>( 1 );
|
||||||
|
|
Loading…
Reference in New Issue