78 virtual bool Run()
override;
80 virtual const wxString
GetName()
const override {
return wxT(
"microvia_stack" ); };
84 void checkColumn(
const std::vector<PCB_VIA*>& aColumn );
92 std::vector<PCB_VIA*> vias;
101 vias.push_back(
via );
116 drcItem->SetItems( aStack );
121 std::map<int, int> layerToIndex;
125 layerToIndex[layer] = spanLen++;
127 std::set<int> covered;
132 auto top = layerToIndex.find(
via->TopLayer() );
133 auto bot = layerToIndex.find(
via->BottomLayer() );
135 if(
top == layerToIndex.end() || bot == layerToIndex.end() ||
std::abs(
top->second - bot->second ) != 1 )
141 if( !covered.insert( std::min(
top->second, bot->second ) ).second )
148 if( broken || (
int) covered.size() != spanLen - 1 )
151 drcItem->SetItems( aStack );
168 && (
int) aColumn.size() > depthConstraint.
GetValue().
Max()
172 drcItem->SetErrorMessage( wxString::Format(
_(
"Stack is %d hops deep, limit is %d" ), (
int) aColumn.size(),
174 drcItem->SetItems(
top );
175 drcItem->SetViolatingRule( depthConstraint.
GetParentRule() );
185 bool boardFillsVias =
m_drcEngine->GetBoard()->GetDesignSettings().m_FillVias;
189 if( !
via->Padstack().Drill().is_filled.value_or( boardFillsVias ) )
192 drcItem->SetItems(
via );
203 const int progressDelta = 250;
206 for(
const std::vector<PCB_VIA*>& column : columns )
217static int stackThickness(
const std::vector<BOARD_STACKUP_ITEM*>& aStack,
int aFirst,
int aLast )
221 for(
int i = aFirst; i < aLast; ++i )
250 if( !checkRatio && !checkCore && !checkDielectrics )
254 const std::vector<BOARD_STACKUP_ITEM*>& stack = stackup.
GetList();
256 const int progressDelta = 500;
272 for(
int i = 0; i < (int) stack.size(); ++i )
279 if( layer ==
via->TopLayer() || layer ==
via->BottomLayer() )
288 if( first < 0 || last < 0 )
295 for(
int i = first + 1; i < last; ++i )
298 && stack[i]->GetTypeName() ==
KEY_CORE )
302 drcItem->SetErrorMessage(
303 wxString::Format(
_(
"The stackup gives the dielectric between %s and %s as core" ),
305 drcItem->SetItems(
via );
318 for(
int i = first + 1; i < last; ++i )
324 if( dielectrics > 1 )
328 drcItem->SetErrorMessage( wxString::Format(
_(
"The stackup gives %d dielectrics between %s and %s" ),
331 drcItem->SetItems(
via );
336 if( !checkRatio ||
via->GetDrillValue() <= 0 )
346 double limit = ratioConstraint.
GetValue().
Max() / 1000.0;
353 bool fromBack = botExternal && !topExternal;
355 int thickness =
stackThickness( stack, first + 1, last ) + stack[fromBack ? last : first]->GetThickness();
360 thickness += stack[fromBack ? first : last]->GetThickness();
362 double ratio = (double) thickness / (
double)
via->GetDrillValue();
378 drcItem->SetErrorMessage( wxString::Format(
_(
"Aspect ratio %.2f exceeds the %.2f limit" ), ratio, limit ) );
380 drcItem->SetItems(
via );
381 drcItem->SetViolatingRule( ratioConstraint.
GetParentRule() );
397 for(
PAD*
pad : footprint->Pads() )
406 int drill = std::min(
pad->GetDrillSize().x,
pad->GetDrillSize().y );
417 double limit = ratioConstraint.
GetValue().
Max() / 1000.0;
422 double ratio = (double) boardDepth / (
double) drill;
429 drcItem->SetErrorMessage(
430 wxString::Format(
_(
"Aspect ratio %.2f exceeds the %.2f limit" ), ratio, limit ) );
432 drcItem->SetItems(
pad );
433 drcItem->SetViolatingRule( ratioConstraint.
GetParentRule() );
452 if( !
reportPhase(
_(
"Checking hole aspect ratios and microvia stacks..." ) ) )
@ BS_ITEM_TYPE_DIELECTRIC
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Manage one layer needed to make a physical board.
int GetSublayersCount() const
int GetThickness(int aDielectricSubLayer=0) const
BOARD_STACKUP_ITEM_TYPE GetType() const
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
Information pertinent to a Pcbnew printed circuit board.
BOARD_STACKUP GetStackupOrDefault() const
const GENERATORS & Generators() const
int GetCopperLayerCount() const
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
DRC_RULE * GetParentRule() const
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
DRC_TEST_PROVIDER_VIA_STACK()
virtual const wxString GetName() const override
virtual ~DRC_TEST_PROVIDER_VIA_STACK()=default
void checkConstructability(BOARD *aBoard)
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
void checkColumn(const std::vector< PCB_VIA * > &aColumn)
void checkSpan(PCB_VIA_STACK *aStack, int aCopperLayers)
void checkLooseMicrovias(BOARD *aBoard)
virtual bool reportPhase(const wxString &aStageName)
void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::function< void(PCB_MARKER *)> &aPathGenerator=[](PCB_MARKER *){})
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
VECTOR2I GetPosition() const override
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
PCB_LAYER_ID GetStartLayer() const
PCB_LAYER_ID GetEndLayer() const
static bool IsSpanValid(BOARD *aBoard, PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd)
True when both span ends are copper layers within the board's copper layer count.
static std::vector< std::vector< PCB_VIA * > > CollectMicroviaColumns(BOARD *aBoard)
Runs of microvias that land on one another, each ordered from its outermost hop down.
@ HOLE_ASPECT_RATIO_CONSTRAINT
@ MICROVIA_STACK_DEPTH_CONSTRAINT
@ DRCE_MICROVIA_STACK_DEPTH
@ DRCE_MICROVIA_CROSSES_CORE
@ DRCE_MALFORMED_MICROVIA_STACK_SPAN
@ DRCE_MICROVIA_STACK_NOT_FILLED
@ DRCE_MICROVIA_SPANS_DIELECTRICS
static int stackThickness(const std::vector< BOARD_STACKUP_ITEM * > &aStack, int aFirst, int aLast)
bool IsExternalCopperLayer(int aLayerId)
Test whether a layer is an external (F_Cu or B_Cu) copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ PTH
Plated through hole pad.
KIBIS top(path, &reporter)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)