KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_drc_via_stack.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <fstream>
21#include <memory>
22
23#include <wx/filename.h>
24
25#include <qa_utils/file_utils.h>
28
29#include <board.h>
33#include <common.h>
34#include <footprint.h>
35#include <lset.h>
36#include <pad.h>
37#include <padstack.h>
38#include <pcb_track.h>
40#include <drc/drc_engine.h>
41#include <drc/drc_item.h>
42#include <drc/drc_rule_parser.h>
44#include <reporter.h>
47
48
50{
52 std::unique_ptr<BOARD> m_board;
53
55 int m_notFilled = 0;
56 int m_depth = 0;
57 int m_aspect = 0;
60
61 wxString m_spanMessage;
62
63 std::vector<int> m_ignored;
64
65 wxFileName m_rulePath;
66
67 // The temp dir has to outlive run(), so it is kept here rather than in each test.
68 std::unique_ptr<KI_TEST::SCOPED_TEMP_DIR> m_ruleDir;
69
70 // The limits these checks read come from rules, so a test states them the way a user would.
71 void setRule( const std::string& aConstraint, const std::string& aCondition = "",
72 const std::string& aSeverity = "" )
73 {
74 m_ruleDir = std::make_unique<KI_TEST::SCOPED_TEMP_DIR>( "microvia_rule" );
75
76 wxFileName rulePath( m_ruleDir->PathStr(), "test.kicad_dru" );
77
78 {
79 std::ofstream dru( rulePath.GetFullPath().ToStdString() );
80 dru << "(version 1)\n"
81 << "(rule \"via stack limits\"\n";
82
83 if( !aCondition.empty() )
84 dru << " (condition \"" << aCondition << "\")\n";
85
86 if( !aSeverity.empty() )
87 dru << " (severity " << aSeverity << ")\n";
88
89 dru << " (constraint " << aConstraint << ")\n"
90 << ")\n";
91 }
92
93 m_rulePath = rulePath;
94 }
95
96 void buildBoard( int aCopperLayers )
97 {
98 m_board = std::make_unique<BOARD>();
99 m_board->SetCopperLayerCount( aCopperLayers );
100 m_board->SetEnabledLayers( LSET::AllCuMask( aCopperLayers ) | LSET::AllTechMask() );
101
102 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
103 bds.SetCopperLayerCount( aCopperLayers );
104 bds.GetStackupDescriptor().BuildDefaultStackupList( &bds, aCopperLayers );
105 bds.m_HasStackup = true;
106 }
107
108
109 // The default stackup alternates core and prepreg, which a case about laser drilling
110 // has to override.
112 {
113 for( BOARD_STACKUP_ITEM* item : m_board->GetDesignSettings().GetStackupDescriptor().GetList() )
114 {
115 if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
116 item->SetTypeName( KEY_PREPREG );
117 }
118 }
119
120
121 // Cases whose subject is the stackup still build their board here: a
122 // synthesized stackup is not written to the board file, so a fixture would
123 // come back with no thicknesses and quietly test something else.
124 //
125 // Each case's board is stored under drc_via_stack/ named after the test case,
126 // so a renamed case fails loudly here rather than silently reading the wrong
127 // board. Via stacks do not exist in v10, so these fixtures are written by
128 // the development build.
130 {
131 const std::string boardName = boost::unit_test::framework::current_test_case().p_name.get();
132
133 m_board = KI_TEST::RequireBoardFromPcbnewQAData( "drc_via_stack/" + boardName + ".kicad_pcb" );
134 }
135
136
137 void run()
138 {
139 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
140
141 if( !bds.m_DRCEngine )
142 bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( m_board.get(), &bds );
143
145
146 for( int code = DRCE_FIRST; code <= DRCE_LAST; ++code )
148
155
156 for( int code : m_ignored )
158
160 [&]( const std::shared_ptr<DRC_ITEM>& aItem, const VECTOR2I&, int,
161 const std::function<void( PCB_MARKER* )>& )
162 {
163 switch( aItem->GetErrorCode() )
164 {
167 case DRCE_MICROVIA_STACK_DEPTH: m_depth++; break;
168 case DRCE_HOLE_ASPECT_RATIO: m_aspect++; break;
172 m_spanMessage = aItem->GetErrorMessage( false );
173 break;
174 default: break;
175 }
176 } );
177
178 bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false );
180 }
181};
182
183
184static const VECTOR2I VIA_POS( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) );
185
186
187static PCB_VIA* makeMicrovia( BOARD* aBoard, const VECTOR2I& aPos, PCB_LAYER_ID aTop, PCB_LAYER_ID aBottom,
188 bool aFilled )
189{
190 PCB_VIA* via = new PCB_VIA( aBoard );
191 via->SetViaType( VIATYPE::MICROVIA );
192 via->SetLayerPair( aTop, aBottom );
193 via->SetWidth( PADSTACK::ALL_LAYERS, pcbIUScale.mmToIU( 0.3 ) );
194 via->SetDrill( pcbIUScale.mmToIU( 0.15 ) );
195 via->SetPosition( aPos );
196 via->Padstack().Drill().is_filled = aFilled;
197 aBoard->Add( via );
198
199 return via;
200}
201
202
203static PCB_VIA* makeVia( BOARD* aBoard, const VECTOR2I& aPos, VIATYPE aType, PCB_LAYER_ID aTop, PCB_LAYER_ID aBottom,
204 int aDrill )
205{
206 PCB_VIA* via = new PCB_VIA( aBoard );
207 via->SetViaType( aType );
208 via->SetLayerPair( aTop, aBottom );
209 via->SetWidth( PADSTACK::ALL_LAYERS, aDrill + pcbIUScale.mmToIU( 0.2 ) );
210 via->SetDrill( aDrill );
211 via->SetPosition( aPos );
212 aBoard->Add( via );
213
214 return via;
215}
216
217
218static PAD* makePthPad( BOARD* aBoard, const VECTOR2I& aPos, const VECTOR2I& aDrill )
219{
220 FOOTPRINT* footprint = new FOOTPRINT( aBoard );
221 footprint->SetPosition( aPos );
222 aBoard->Add( footprint );
223
224 PAD* pad = new PAD( footprint );
225 pad->SetAttribute( PAD_ATTRIB::PTH );
226 pad->SetLayerSet( PAD::PTHMask() );
227 pad->SetPosition( aPos );
229 pad->SetSize( PADSTACK::ALL_LAYERS, aDrill + VECTOR2I( pcbIUScale.mmToIU( 0.3 ), pcbIUScale.mmToIU( 0.3 ) ) );
230 pad->SetDrillShape( aDrill.x == aDrill.y ? PAD_DRILL_SHAPE::CIRCLE : PAD_DRILL_SHAPE::OBLONG );
231 pad->SetDrillSize( aDrill );
232 footprint->Add( pad );
233
234 return pad;
235}
236
237
238static PCB_VIA_STACK* makeStack( BOARD* aBoard, PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd )
239{
240 PCB_VIA_STACK* stack = new PCB_VIA_STACK( aBoard, F_Cu );
241 stack->SetStartLayer( aStart );
242 stack->SetEndLayer( aEnd );
244 aBoard->Add( stack );
245
246 return stack;
247}
248
249
250BOOST_AUTO_TEST_SUITE( DRCViaStack )
251
252
254{
255 m_board = std::make_unique<BOARD>();
256 m_board->SetCopperLayerCount( 4 );
257 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
258
259 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
260 bds.SetCopperLayerCount( 4 );
262 bds.m_HasStackup = true;
263 setRule( "hole_aspect_ratio (max 1.0)" );
264
265 for( BOARD_STACKUP_ITEM* item : bds.GetStackupDescriptor().GetList() )
266 {
267 if( item->GetType() != BS_ITEM_TYPE_DIELECTRIC )
268 continue;
269
270 item->SetThickness( pcbIUScale.mmToIU( 0.1 ) );
271 item->SetTypeName( KEY_PREPREG );
272 }
273
274 PCB_VIA_STACK* stack = makeStack( m_board.get(), F_Cu, In2_Cu );
275 stack->SetViaSize( pcbIUScale.mmToIU( 0.3 ) );
276 stack->SetViaDrill( pcbIUScale.mmToIU( 0.15 ) );
277 stack->SetPosition( VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ) );
278 stack->Regenerate( m_board.get(), nullptr );
279
280 run();
281
282 BOOST_CHECK_EQUAL( m_malformedSpans, 0 );
283 BOOST_CHECK_EQUAL( m_notFilled, 0 );
284 BOOST_CHECK_EQUAL( m_depth, 0 );
285 BOOST_CHECK_EQUAL( m_aspect, 0 );
286 BOOST_CHECK_EQUAL( m_crossesCore, 0 );
287}
288
289
290BOOST_FIXTURE_TEST_CASE( StackNotTilingItsSpanReported, VIA_STACK_DRC_FIXTURE )
291{
292 loadBoard();
293
294 run();
295
296 BOOST_CHECK_EQUAL( m_malformedSpans, 1 );
297}
298
299
301{
302 m_board = std::make_unique<BOARD>();
303 m_board->SetCopperLayerCount( 4 );
304 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
305
306 VECTOR2I pos( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) );
307
308 PCB_VIA_STACK* stack = makeStack( m_board.get(), F_Cu, In2_Cu );
309 stack->SetViaSize( pcbIUScale.mmToIU( 0.3 ) );
310 stack->SetViaDrill( pcbIUScale.mmToIU( 0.15 ) );
311 stack->SetPosition( pos );
312 stack->Regenerate( m_board.get(), nullptr );
313
314 stack->AddItem( makeMicrovia( m_board.get(), pos, F_Cu, In1_Cu, true ) );
315
316 run();
317
318 BOOST_CHECK_EQUAL( m_malformedSpans, 1 );
319}
320
321
323{
324 loadBoard();
325
326 run();
327
328 BOOST_CHECK_EQUAL( m_malformedSpans, 0 );
329 BOOST_CHECK_EQUAL( m_notFilled, 1 );
330}
331
332
334{
335 loadBoard();
336
337 setRule( "microvia_stack_depth (max 1)" );
338
339 run();
340
341 BOOST_CHECK_EQUAL( m_malformedSpans, 0 );
342 BOOST_CHECK_EQUAL( m_depth, 1 );
343}
344
345
346BOOST_FIXTURE_TEST_CASE( LooseStackedMicroviasReportNotFilled, VIA_STACK_DRC_FIXTURE )
347{
348 loadBoard();
349
350 run();
351
352 BOOST_CHECK_EQUAL( m_notFilled, 1 );
353}
354
355
356BOOST_FIXTURE_TEST_CASE( LooseStackedMicroviasReportDepth, VIA_STACK_DRC_FIXTURE )
357{
358 loadBoard();
359
360 setRule( "microvia_stack_depth (max 2)" );
361
362 run();
363
364 BOOST_CHECK_EQUAL( m_depth, 1 );
365}
366
367
368// Two microvias sharing an x,y but not touching are two structures, not one three deep.
369BOOST_FIXTURE_TEST_CASE( CoaxialButSeparatedMicroviasAreNotOneStack, VIA_STACK_DRC_FIXTURE )
370{
371 loadBoard();
372
373 setRule( "microvia_stack_depth (max 1)" );
374
375 run();
376
377 BOOST_CHECK_EQUAL( m_depth, 0 );
378 BOOST_CHECK_EQUAL( m_notFilled, 0 );
379}
380
381
382// A generator stack must be judged once, not once as a generator and again as loose geometry.
383BOOST_FIXTURE_TEST_CASE( GeneratorStackIsNotReportedTwice, VIA_STACK_DRC_FIXTURE )
384{
385 loadBoard();
386
387 run();
388
389 BOOST_CHECK_EQUAL( m_notFilled, 2 );
390}
391
392
393// A hair of offset must not split one structure into two. The upper via still lands on the one
394// below, so both rules still apply.
395BOOST_FIXTURE_TEST_CASE( OverlappingButOffsetMicroviasAreOneStructure, VIA_STACK_DRC_FIXTURE )
396{
397 loadBoard();
398
399 run();
400
401 BOOST_CHECK_EQUAL( m_notFilled, 1 );
402}
403
404
405// A real stagger clears the via below, so the fill rule does not apply to it.
406BOOST_FIXTURE_TEST_CASE( ClearOfTheViaBelowIsAStaggerNotAStack, VIA_STACK_DRC_FIXTURE )
407{
408 loadBoard();
409
410 run();
411
412 BOOST_CHECK_EQUAL( m_notFilled, 0 );
413 BOOST_CHECK_EQUAL( m_depth, 0 );
414}
415
416
417// IPC-6012 requires the hops of a stacked microvia to be filled. That applies to the whole
418// structure and not only to the ones carrying another hop.
419BOOST_FIXTURE_TEST_CASE( EveryHopOfAStackMustBeFilled, VIA_STACK_DRC_FIXTURE )
420{
421 loadBoard();
422
423 run();
424
425 BOOST_CHECK_EQUAL( m_notFilled, 2 );
426}
427
428
429// A lone microvia carries nothing, so it may be unfilled.
430BOOST_FIXTURE_TEST_CASE( ALoneMicroviaMayBeUnfilled, VIA_STACK_DRC_FIXTURE )
431{
432 loadBoard();
433
434 run();
435
436 BOOST_CHECK_EQUAL( m_notFilled, 0 );
437}
438
439
440// IPC-2226 caps a microvia at 1:1. A default 6 layer stackup has dielectrics far thicker than a
441// 0.1 mm hole, so a microvia across one is well outside that.
442BOOST_FIXTURE_TEST_CASE( MicroviaTooDeepForItsDiameterIsReported, VIA_STACK_DRC_FIXTURE )
443{
444 m_board = std::make_unique<BOARD>();
445 m_board->SetCopperLayerCount( 6 );
446 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
447
448 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
449 bds.SetCopperLayerCount( 6 );
451 bds.m_HasStackup = true;
452 setRule( "hole_aspect_ratio (max 1.0)" );
453
454 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), F_Cu, In1_Cu, true );
455
456 run();
457
458 BOOST_CHECK_EQUAL( m_aspect, 1 );
459}
460
461
462// With no limit set the check says nothing, however thick the dielectric.
463BOOST_FIXTURE_TEST_CASE( AspectRatioIsSilentWithoutALimit, VIA_STACK_DRC_FIXTURE )
464{
465 m_board = std::make_unique<BOARD>();
466 m_board->SetCopperLayerCount( 6 );
467 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
468
469 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
470 bds.SetCopperLayerCount( 6 );
472 bds.m_HasStackup = true;
473
474
475 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), F_Cu, In1_Cu, true );
476
477 run();
478
479 BOOST_CHECK_EQUAL( m_aspect, 0 );
480
481 // The same via violates once a limit exists, so the silence came from the missing limit.
482 m_aspect = 0;
483 setRule( "hole_aspect_ratio (max 1.0)" );
484
485 run();
486
487 BOOST_CHECK_EQUAL( m_aspect, 1 );
488}
489
490
491// The aspect ratio check is independent of the other three, so silencing them must not
492// silence it.
493BOOST_FIXTURE_TEST_CASE( AspectRatioSurvivesTheOtherChecksBeingIgnored, VIA_STACK_DRC_FIXTURE )
494{
495 m_board = std::make_unique<BOARD>();
496 m_board->SetCopperLayerCount( 6 );
497 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
498
499 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
500 bds.SetCopperLayerCount( 6 );
502 bds.m_HasStackup = true;
503 setRule( "hole_aspect_ratio (max 1.0)" );
504
506
507 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), F_Cu, In1_Cu, true );
508
509 run();
510
511 BOOST_CHECK_EQUAL( m_aspect, 1 );
512}
513
514
515BOOST_FIXTURE_TEST_CASE( AspectRatioFallsBackToTheDefaultStackup, VIA_STACK_DRC_FIXTURE )
516{
517 m_board = std::make_unique<BOARD>();
518 m_board->SetCopperLayerCount( 4 );
519 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
520
521 BOOST_REQUIRE( m_board->GetDesignSettings().GetStackupDescriptor().GetList().empty() );
522
523 setRule( "hole_aspect_ratio (max 0.5)" );
524
525 VECTOR2I at( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) );
526 makeMicrovia( m_board.get(), at, F_Cu, In1_Cu, true );
527
528 // The default 4 layer build puts roughly 0.5 mm of dielectric under a 0.15 mm drill.
529 run();
530 BOOST_CHECK_EQUAL( m_aspect, 1 );
531}
532
533
534BOOST_FIXTURE_TEST_CASE( MicroviaStackDepthRuleIsHonoured, VIA_STACK_DRC_FIXTURE )
535{
536 loadBoard();
537
538 setRule( "microvia_stack_depth (max 2)" );
539
540 run();
541 BOOST_CHECK_EQUAL( m_depth, 1 );
542
543 m_depth = 0;
544 setRule( "microvia_stack_depth (max 4)" );
545
546 // A rule that allows four leaves the same three hops alone.
547 run();
548 BOOST_CHECK_EQUAL( m_depth, 0 );
549
550 // With a condition the rule still has to match, so a limit of two bites again.
551 m_depth = 0;
552 setRule( "microvia_stack_depth (max 2)", "A.isStackedVia()" );
553
554 run();
555 BOOST_CHECK_MESSAGE( m_depth == 1, "the rule condition did not select the stack" );
556}
557
558
560{
561 m_board = std::make_unique<BOARD>();
562 m_board->SetCopperLayerCount( 4 );
563 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
564
565 PCB_VIA_STACK* stack = makeStack( m_board.get(), F_Cu, In2_Cu );
566 stack->SetPosition( VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ) );
567 stack->Regenerate( m_board.get(), nullptr );
568
569 setRule( "microvia_stack_depth (max 1)", "", "ignore" );
570
571 run();
572
573 BOOST_CHECK_EQUAL( m_depth, 0 );
574}
575
576
578{
579 m_board = std::make_unique<BOARD>();
580 m_board->SetCopperLayerCount( 4 );
581 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
582
583 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
585
586 for( BOARD_STACKUP_ITEM* item : bds.GetStackupDescriptor().GetList() )
587 {
588 if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
589 item->SetThickness( pcbIUScale.mmToIU( 0.1 ) );
590 }
591
592 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), F_Cu, In1_Cu, true );
593
594 setRule( "hole_aspect_ratio (max 0.1)", "", "ignore" );
595
596 run();
597
598 BOOST_CHECK_EQUAL( m_aspect, 0 );
599}
600
601
602// A microvia whose two layers are the same spans no dielectric. Such vias point at each other
603// in the chain walk, so a handful of them must not multiply into a pile of violations.
604BOOST_FIXTURE_TEST_CASE( ZeroSpanMicroviasDoNotMultiplyViolations, VIA_STACK_DRC_FIXTURE )
605{
606 loadBoard();
607
608 run();
609
610 // A via spanning one layer forms no column, so there is nothing to report at all.
611 BOOST_CHECK_MESSAGE( m_notFilled == 0, "3 vias produced " << m_notFilled << " violations" );
612}
613
614
615// A dielectric built from several sublayers is as deep as all of them together.
616BOOST_FIXTURE_TEST_CASE( AspectRatioCountsEveryDielectricSublayer, VIA_STACK_DRC_FIXTURE )
617{
618 m_board = std::make_unique<BOARD>();
619 m_board->SetCopperLayerCount( 6 );
620 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
621
622 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
623 bds.SetCopperLayerCount( 6 );
625 bds.m_HasStackup = true;
626
627 // Split the dielectric under F.Cu into two 0.1 mm sublayers.
628 for( BOARD_STACKUP_ITEM* item : bds.GetStackupDescriptor().GetList() )
629 {
630 if( item->GetType() != BS_ITEM_TYPE_DIELECTRIC )
631 continue;
632
633 item->AddDielectricPrms( 1 );
634 item->SetThickness( pcbIUScale.mmToIU( 0.1 ), 0 );
635 item->SetThickness( pcbIUScale.mmToIU( 0.1 ), 1 );
636 break;
637 }
638
639 // 0.2 mm of dielectric over a 0.15 mm drill is a ratio above 1, one sublayer alone is not.
640 setRule( "hole_aspect_ratio (max 1.2)" );
641
642 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), F_Cu, In1_Cu, true );
643
644 run();
645
646 BOOST_CHECK_MESSAGE( m_aspect == 1, "both sublayers must count toward the via depth" );
647}
648
649
650// A microvia reaching B.Cu is drilled from the back, so it passes through the B.Cu foil.
651BOOST_FIXTURE_TEST_CASE( AspectRatioUsesTheFoilTheLaserEnters, VIA_STACK_DRC_FIXTURE )
652{
653 m_board = std::make_unique<BOARD>();
654 m_board->SetCopperLayerCount( 6 );
655 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
656
657 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
658 bds.SetCopperLayerCount( 6 );
660 bds.m_HasStackup = true;
661
662 const std::vector<BOARD_STACKUP_ITEM*>& stack = bds.GetStackupDescriptor().GetList();
663
664 // 1 oz outer foil, half that inside, and a known dielectric between In4.Cu and B.Cu.
665 for( BOARD_STACKUP_ITEM* item : stack )
666 {
667 if( item->GetType() != BS_ITEM_TYPE_COPPER )
668 continue;
669
670 bool outer = item->GetBrdLayerId() == F_Cu || item->GetBrdLayerId() == B_Cu;
671 item->SetThickness( pcbIUScale.mmToIU( outer ? 0.035 : 0.0175 ) );
672 }
673
674 for( int i = (int) stack.size() - 1; i >= 0; --i )
675 {
676 if( stack[i]->GetType() == BS_ITEM_TYPE_DIELECTRIC )
677 {
678 stack[i]->SetThickness( pcbIUScale.mmToIU( 0.1 ) );
679 break;
680 }
681 }
682
683 // Through the B.Cu foil the depth is 0.135 mm over a 0.1 mm drill, a ratio of 1.35.
684 // Through the In4.Cu foil it would read 1.175 and slip under the limit.
685 setRule( "hole_aspect_ratio (max 1.25)" );
686
687 PCB_VIA* via = makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), In4_Cu,
688 B_Cu, true );
689 via->SetDrill( pcbIUScale.mmToIU( 0.1 ) );
690
691 run();
692
693 BOOST_CHECK_MESSAGE( m_aspect == 1, "a back-side microvia must be measured through the B.Cu foil" );
694}
695
696
697// An unset fill means "use the board default", not "unfilled".
698BOOST_FIXTURE_TEST_CASE( FillFromBoardHonoursTheBoardDefault, VIA_STACK_DRC_FIXTURE )
699{
700 loadBoard();
701
702 run();
703
704 BOOST_CHECK_MESSAGE( m_notFilled == 0, "board default is filled, but got " << m_notFilled << " not-filled errors" );
705}
706
707
708// Two overlapping hops can both land on the one below them, and it must not be reported once
709// for each.
710BOOST_FIXTURE_TEST_CASE( AViaCarriedTwiceIsReportedOnce, VIA_STACK_DRC_FIXTURE )
711{
712 loadBoard();
713
714 run();
715
716 BOOST_CHECK_EQUAL( m_notFilled, 1 );
717}
718
719
720// Holes a drill diameter apart touch, leaving no wall between them.
722{
723 loadBoard();
724
725 run();
726
727 BOOST_CHECK_EQUAL( m_notFilled, 1 );
728}
729
730
731// Laser drilling needs the resin to ablate, so a microvia belongs in the build-up layers
732// rather than through the glass reinforced core.
733BOOST_FIXTURE_TEST_CASE( MicroviaThroughCoreIsReported, VIA_STACK_DRC_FIXTURE )
734{
735 m_board = std::make_unique<BOARD>();
736 m_board->SetCopperLayerCount( 6 );
737 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
738
739 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
740 bds.SetCopperLayerCount( 6 );
742 bds.m_HasStackup = true;
743
744 const std::vector<BOARD_STACKUP_ITEM*>& stack = bds.GetStackupDescriptor().GetList();
745
746 // Name the copper layers either side of the first core, and of the first prepreg.
747 PCB_LAYER_ID coreTop = UNDEFINED_LAYER, coreBot = UNDEFINED_LAYER;
748 PCB_LAYER_ID pregTop = UNDEFINED_LAYER, pregBot = UNDEFINED_LAYER;
749 PCB_LAYER_ID lastCopper = UNDEFINED_LAYER;
750
751 for( size_t i = 0; i < stack.size(); ++i )
752 {
753 if( stack[i]->GetType() == BS_ITEM_TYPE_COPPER )
754 {
755 lastCopper = stack[i]->GetBrdLayerId();
756 continue;
757 }
758
759 if( stack[i]->GetType() != BS_ITEM_TYPE_DIELECTRIC )
760 continue;
761
763
764 for( size_t j = i + 1; j < stack.size(); ++j )
765 {
766 if( stack[j]->GetType() == BS_ITEM_TYPE_COPPER )
767 {
768 below = stack[j]->GetBrdLayerId();
769 break;
770 }
771 }
772
773 if( stack[i]->GetTypeName() == KEY_CORE && coreTop == UNDEFINED_LAYER )
774 {
775 coreTop = lastCopper;
776 coreBot = below;
777 }
778 else if( stack[i]->GetTypeName() == KEY_PREPREG && pregTop == UNDEFINED_LAYER )
779 {
780 pregTop = lastCopper;
781 pregBot = below;
782 }
783 }
784
785 BOOST_REQUIRE( coreTop != UNDEFINED_LAYER && coreBot != UNDEFINED_LAYER );
786 BOOST_REQUIRE( pregTop != UNDEFINED_LAYER && pregBot != UNDEFINED_LAYER );
787
788 VECTOR2I overCore( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) );
789 VECTOR2I overPrepreg( pcbIUScale.mmToIU( 30 ), pcbIUScale.mmToIU( 10 ) );
790
791 makeMicrovia( m_board.get(), overCore, coreTop, coreBot, true );
792 makeMicrovia( m_board.get(), overPrepreg, pregTop, pregBot, true );
793
794 run();
795
796 // Only the one crossing core is reported, and it does not need an aspect ratio limit set.
797 BOOST_CHECK_EQUAL( m_crossesCore, 1 );
798}
799
800
801// Two hops landing on one shared via below are two structures. The second must still be
802// fill checked rather than dropped for sharing.
803BOOST_FIXTURE_TEST_CASE( ASecondHopSharingALandingViaIsStillChecked, VIA_STACK_DRC_FIXTURE )
804{
805 loadBoard();
806
807 run();
808
809 BOOST_CHECK_EQUAL( m_notFilled, 2 );
810}
811
812
813// The core check shares the aspect ratio walk, so an exhausted aspect limit must not end it.
814BOOST_FIXTURE_TEST_CASE( AnIgnoredAspectRatioDoesNotStopTheCoreCheck, VIA_STACK_DRC_FIXTURE )
815{
816 m_board = std::make_unique<BOARD>();
817 m_board->SetCopperLayerCount( 6 );
818 m_board->SetEnabledLayers( LSET::AllCuMask( 6 ) | LSET::AllTechMask() );
819
820 BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
821 bds.SetCopperLayerCount( 6 );
823 bds.m_HasStackup = true;
824
825 // A limit is set, but its severity is off. The first via would otherwise end the walk.
826 setRule( "hole_aspect_ratio (max 0.1)" );
827 m_ignored = { DRCE_HOLE_ASPECT_RATIO };
828
829 const std::vector<BOARD_STACKUP_ITEM*>& stack = bds.GetStackupDescriptor().GetList();
830 PCB_LAYER_ID coreTop = UNDEFINED_LAYER, coreBot = UNDEFINED_LAYER, lastCopper = UNDEFINED_LAYER;
831
832 for( size_t i = 0; i < stack.size(); ++i )
833 {
834 if( stack[i]->GetType() == BS_ITEM_TYPE_COPPER )
835 {
836 lastCopper = stack[i]->GetBrdLayerId();
837 continue;
838 }
839
840 if( stack[i]->GetType() == BS_ITEM_TYPE_DIELECTRIC && stack[i]->GetTypeName() == KEY_CORE
841 && coreTop == UNDEFINED_LAYER )
842 {
843 coreTop = lastCopper;
844
845 for( size_t j = i + 1; j < stack.size(); ++j )
846 {
847 if( stack[j]->GetType() == BS_ITEM_TYPE_COPPER )
848 {
849 coreBot = stack[j]->GetBrdLayerId();
850 break;
851 }
852 }
853 }
854 }
855
856 BOOST_REQUIRE( coreTop != UNDEFINED_LAYER && coreBot != UNDEFINED_LAYER );
857
858 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), coreTop, coreBot, true );
859 makeMicrovia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 30 ), pcbIUScale.mmToIU( 10 ) ), coreTop, coreBot, true );
860
861 run();
862
863 BOOST_CHECK_EQUAL( m_aspect, 0 );
864 BOOST_CHECK_MESSAGE( m_crossesCore == 2, "the walk stopped early, only " << m_crossesCore << " reported" );
865}
866
867
868// 0.035 mm copper and 0.1 mm dielectric on 4 layers, 0.44 mm in all.
870{
871 bds.SetCopperLayerCount( 4 );
873 bds.m_HasStackup = true;
874
875 for( BOARD_STACKUP_ITEM* item : bds.GetStackupDescriptor().GetList() )
876 {
877 if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
878 {
879 item->SetThickness( pcbIUScale.mmToIU( 0.1 ) );
880 item->SetTypeName( KEY_PREPREG );
881 }
882 else if( item->GetType() == BS_ITEM_TYPE_COPPER )
883 {
884 item->SetThickness( pcbIUScale.mmToIU( 0.035 ) );
885 }
886 }
887}
888
889
890BOOST_FIXTURE_TEST_CASE( ThroughViaTooDeepForItsDrillIsReported, VIA_STACK_DRC_FIXTURE )
891{
892 m_board = std::make_unique<BOARD>();
893 m_board->SetCopperLayerCount( 4 );
894 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
895
896 setUniformStackup( m_board->GetDesignSettings() );
897 setRule( "hole_aspect_ratio (max 6.0)" );
898
899 // 0.44 / 0.05 = 8.8 fails, 0.44 / 0.1 = 4.4 passes.
900 makeVia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), VIATYPE::THROUGH, F_Cu, B_Cu,
901 pcbIUScale.mmToIU( 0.05 ) );
902 makeVia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 20 ), pcbIUScale.mmToIU( 10 ) ), VIATYPE::THROUGH, F_Cu, B_Cu,
903 pcbIUScale.mmToIU( 0.1 ) );
904
905 run();
906 BOOST_CHECK_EQUAL( m_aspect, 1 );
907}
908
909
910BOOST_FIXTURE_TEST_CASE( BlindViaMeasuresItsSpanNotTheBoard, VIA_STACK_DRC_FIXTURE )
911{
912 m_board = std::make_unique<BOARD>();
913 m_board->SetCopperLayerCount( 4 );
914 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
915
916 setUniformStackup( m_board->GetDesignSettings() );
917 setRule( "hole_aspect_ratio (max 6.0)" );
918
919 // 0.135 / 0.05 = 2.7 passes where the whole board would give 8.8.
920 makeVia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), VIATYPE::BLIND, F_Cu, In1_Cu,
921 pcbIUScale.mmToIU( 0.05 ) );
922
923 run();
924 BOOST_CHECK_EQUAL( m_aspect, 0 );
925}
926
927
928BOOST_FIXTURE_TEST_CASE( PlatedPadHoleUsesItsNarrowDimension, VIA_STACK_DRC_FIXTURE )
929{
930 m_board = std::make_unique<BOARD>();
931 m_board->SetCopperLayerCount( 4 );
932 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
933
934 setUniformStackup( m_board->GetDesignSettings() );
935 setRule( "hole_aspect_ratio (max 6.0)" );
936
937 // 0.44 / 0.05 = 8.8 fails on the narrow side.
938 makePthPad( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ),
939 VECTOR2I( pcbIUScale.mmToIU( 0.2 ), pcbIUScale.mmToIU( 0.05 ) ) );
940
941 // 0.44 / 0.1 = 4.4 passes.
942 makePthPad( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 20 ), pcbIUScale.mmToIU( 10 ) ),
943 VECTOR2I( pcbIUScale.mmToIU( 0.1 ), pcbIUScale.mmToIU( 0.1 ) ) );
944
945 run();
946 BOOST_CHECK_EQUAL( m_aspect, 1 );
947}
948
949
950BOOST_FIXTURE_TEST_CASE( AViaTypeConditionScopesTheLimit, VIA_STACK_DRC_FIXTURE )
951{
952 m_board = std::make_unique<BOARD>();
953 m_board->SetCopperLayerCount( 4 );
954 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
955
956 setUniformStackup( m_board->GetDesignSettings() );
957 setRule( "hole_aspect_ratio (max 1.0)", "A.Via_Type == 'Micro'" );
958
959 // 0.135 / 0.1 = 1.35 fails. The through via matches no rule, so it is not checked.
960 makeVia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), VIATYPE::MICROVIA, F_Cu,
961 In1_Cu, pcbIUScale.mmToIU( 0.1 ) );
962 makeVia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 20 ), pcbIUScale.mmToIU( 10 ) ), VIATYPE::THROUGH, F_Cu, B_Cu,
963 pcbIUScale.mmToIU( 0.1 ) );
964
965 run();
966 BOOST_CHECK_EQUAL( m_aspect, 1 );
967}
968
969
970BOOST_FIXTURE_TEST_CASE( BuriedViaCountsTheFoilItDrillsOutOf, VIA_STACK_DRC_FIXTURE )
971{
972 m_board = std::make_unique<BOARD>();
973 m_board->SetCopperLayerCount( 4 );
974 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
975
976 setUniformStackup( m_board->GetDesignSettings() );
977 setRule( "hole_aspect_ratio (max 3.0)" );
978
979 // The drill leaves through the far foil, so 0.17 over 0.05 is 3.4 and not the 2.7 one foil gives.
980 makeVia( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ), VIATYPE::BURIED, In1_Cu,
981 In2_Cu, pcbIUScale.mmToIU( 0.05 ) );
982
983 run();
984 BOOST_CHECK_EQUAL( m_aspect, 1 );
985}
986
987
989{
990 m_board = std::make_unique<BOARD>();
991 m_board->SetCopperLayerCount( 4 );
992 m_board->SetEnabledLayers( LSET::AllCuMask( 4 ) | LSET::AllTechMask() );
993
994 setUniformStackup( m_board->GetDesignSettings() );
995 setRule( "hole_aspect_ratio (max 6.0)" );
996
997 // The same 0.44 over 0.05 that a plated hole fails on, with nothing to plate.
998 PAD* pad = makePthPad( m_board.get(), VECTOR2I( pcbIUScale.mmToIU( 10 ), pcbIUScale.mmToIU( 10 ) ),
999 VECTOR2I( pcbIUScale.mmToIU( 0.05 ), pcbIUScale.mmToIU( 0.05 ) ) );
1000 pad->SetAttribute( PAD_ATTRIB::NPTH );
1001 pad->SetLayerSet( PAD::UnplatedHoleMask() );
1002
1003 run();
1004 BOOST_CHECK_EQUAL( m_aspect, 0 );
1005}
1006
1007
1008// With no core to cross, the core check cannot be what catches this hop.
1009BOOST_FIXTURE_TEST_CASE( MicroviaSpanningTwoBuildUpDielectricsIsReported, VIA_STACK_DRC_FIXTURE )
1010{
1011 buildBoard( 6 );
1012 makeBuildUpStackup();
1013
1014 // F_Cu to In2_Cu steps over In1_Cu, so the hole spans two dielectrics.
1015 makeMicrovia( m_board.get(), VIA_POS, F_Cu, In2_Cu, true );
1016
1017 run();
1018
1019 BOOST_CHECK_EQUAL( m_spansDielectrics, 1 );
1020 BOOST_CHECK_EQUAL( m_crossesCore, 0 );
1021 BOOST_CHECK( m_spanMessage.Contains( wxT( "2 dielectrics" ) ) );
1022
1023 // No aspect ratio rule is set, so the span is what reported it.
1024 BOOST_CHECK_EQUAL( m_aspect, 0 );
1025}
1026
1027
1028// One dielectric per hop is what IPC-2226 asks for, so it has to stay silent.
1029BOOST_FIXTURE_TEST_CASE( MicroviaSpanningOneDielectricIsSilent, VIA_STACK_DRC_FIXTURE )
1030{
1031 buildBoard( 6 );
1032 makeBuildUpStackup();
1033
1034 makeMicrovia( m_board.get(), VIA_POS, F_Cu, In1_Cu, true );
1035
1036 run();
1037
1038 BOOST_CHECK_EQUAL( m_spansDielectrics, 0 );
1039}
1040
1041
1042// Only a microvia is laser drilled, so nothing else answers to the one hop rule.
1043BOOST_FIXTURE_TEST_CASE( NonMicroviaSpanningSeveralDielectricsIsSilent, VIA_STACK_DRC_FIXTURE )
1044{
1045 buildBoard( 6 );
1046
1047 PCB_VIA* via = makeVia( m_board.get(), VIA_POS, VIATYPE::BURIED, In1_Cu, In4_Cu, pcbIUScale.mmToIU( 0.3 ) );
1048
1049 run();
1050
1051 BOOST_CHECK_EQUAL( m_spansDielectrics, 0 );
1052
1053 // The same hole as a microvia reports three, so the via type is what silenced it.
1054 via->SetViaType( VIATYPE::MICROVIA );
1055 run();
1056
1057 BOOST_CHECK_EQUAL( m_spansDielectrics, 1 );
1058 BOOST_CHECK( m_spanMessage.Contains( wxT( "3 dielectrics" ) ) );
1059}
1060
1061
1062// The two checks are independent, so a core in the way must not hide the span.
1063BOOST_FIXTURE_TEST_CASE( MicroviaCrossingCoreAlsoReportsItsSpan, VIA_STACK_DRC_FIXTURE )
1064{
1065 buildBoard( 6 );
1066
1067 // The default stackup alternates core and prepreg, so this span holds one of each.
1068 makeMicrovia( m_board.get(), VIA_POS, F_Cu, In2_Cu, true );
1069
1070 run();
1071
1072 BOOST_CHECK_EQUAL( m_crossesCore, 1 );
1073 BOOST_CHECK_EQUAL( m_spansDielectrics, 1 );
1074}
1075
1076
1077// Ignoring one check must leave the other alone.
1078BOOST_FIXTURE_TEST_CASE( IgnoredSpanLeavesTheCoreCheckAlone, VIA_STACK_DRC_FIXTURE )
1079{
1080 buildBoard( 6 );
1081
1082 m_ignored.push_back( DRCE_MICROVIA_SPANS_DIELECTRICS );
1083
1084 makeMicrovia( m_board.get(), VIA_POS, F_Cu, In2_Cu, true );
1085
1086 run();
1087
1088 BOOST_CHECK_EQUAL( m_spansDielectrics, 0 );
1089 BOOST_CHECK_EQUAL( m_crossesCore, 1 );
1090}
1091
1092
1093// Depth comes from stacking single dielectric hops, so a deep structure built the way IPC-2226
1094// asks for must stay silent however many layers it crosses.
1095BOOST_FIXTURE_TEST_CASE( StackedColumnGoingDeepIsSilent, VIA_STACK_DRC_FIXTURE )
1096{
1097 buildBoard( 6 );
1098 makeBuildUpStackup();
1099
1100 makeMicrovia( m_board.get(), VIA_POS, F_Cu, In1_Cu, true );
1101 makeMicrovia( m_board.get(), VIA_POS, In1_Cu, In2_Cu, true );
1102 makeMicrovia( m_board.get(), VIA_POS, In2_Cu, In3_Cu, true );
1103 makeMicrovia( m_board.get(), VIA_POS, In3_Cu, In4_Cu, true );
1104
1105 BOOST_REQUIRE_EQUAL( m_board->Tracks().size(), 4u );
1106
1107 run();
1108
1109 BOOST_CHECK_EQUAL( m_spansDielectrics, 0 );
1110}
1111
1112
1113// A buried microvia is drilled from an inner layer, so the span is counted the same way there.
1114BOOST_FIXTURE_TEST_CASE( BuriedMicroviaSpanningTwoDielectricsIsReported, VIA_STACK_DRC_FIXTURE )
1115{
1116 buildBoard( 6 );
1117 makeBuildUpStackup();
1118
1119 // In1_Cu to In3_Cu steps over In2_Cu.
1120 makeMicrovia( m_board.get(), VIA_POS, In1_Cu, In3_Cu, true );
1121
1122 run();
1123
1124 BOOST_CHECK_EQUAL( m_spansDielectrics, 1 );
1125 BOOST_CHECK_EQUAL( m_crossesCore, 0 );
1126 BOOST_CHECK( m_spanMessage.Contains( wxT( "2 dielectrics" ) ) );
1127}
1128
1129
1130BOOST_FIXTURE_TEST_CASE( BuriedMicroviaSpanningOneDielectricIsSilent, VIA_STACK_DRC_FIXTURE )
1131{
1132 buildBoard( 6 );
1133 makeBuildUpStackup();
1134
1135 makeMicrovia( m_board.get(), VIA_POS, In1_Cu, In2_Cu, true );
1136
1137 run();
1138
1139 BOOST_CHECK_EQUAL( m_spansDielectrics, 0 );
1140}
1141
1142
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
General utilities for PCB file IO for QA programs.
@ BS_ITEM_TYPE_COPPER
@ BS_ITEM_TYPE_DIELECTRIC
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
BOARD_STACKUP & GetStackupDescriptor()
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
Manage one layer needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1548
void RunTests(EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints, BOARD_COMMIT *aCommit=nullptr)
Run the DRC tests.
void SetViolationHandler(DRC_VIOLATION_HANDLER aHandler)
Set an optional DRC violation handler (receives DRC_ITEMs and positions).
Definition drc_engine.h:164
void ClearViolationHandler()
Definition drc_engine.h:169
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
void AddItem(EDA_ITEM *aItem)
Add item to group.
Definition eda_group.cpp:58
void SetPosition(const VECTOR2I &aPos) override
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Adds an item to the container.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition lset.cpp:672
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:595
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
Definition padstack.h:184
Definition pad.h:61
static LSET PTHMask()
layer set for a through hole pad
Definition pad.cpp:620
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition pad.cpp:641
void SetPosition(const VECTOR2I &aPos) override
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
void Regenerate(BOARD *aBoard, BOARD_COMMIT *aCommit)
Rebuild the member vias (and, for a staggered stack, the connecting traces) from the current stack se...
void SetStartLayer(PCB_LAYER_ID aLayer)
void SetViaSize(int aSize)
void SetViaDrill(int aDrill)
void SetStyle(VIA_STACK_STYLE aStyle)
void SetEndLayer(PCB_LAYER_ID aLayer)
@ DRCE_MICROVIA_STACK_DEPTH
Definition drc_item.h:76
@ DRCE_HOLE_ASPECT_RATIO
Definition drc_item.h:77
@ DRCE_MICROVIA_CROSSES_CORE
Definition drc_item.h:78
@ DRCE_MALFORMED_MICROVIA_STACK_SPAN
Definition drc_item.h:74
@ DRCE_MICROVIA_STACK_NOT_FILLED
Definition drc_item.h:75
@ DRCE_FIRST
Definition drc_item.h:47
@ DRCE_LAST
Definition drc_item.h:145
@ DRCE_MICROVIA_SPANS_DIELECTRICS
Definition drc_item.h:79
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ B_Cu
Definition layer_ids.h:61
@ In2_Cu
Definition layer_ids.h:63
@ In4_Cu
Definition layer_ids.h:65
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ In1_Cu
Definition layer_ids.h:62
@ In3_Cu
Definition layer_ids.h:64
@ F_Cu
Definition layer_ids.h:60
std::unique_ptr< BOARD > RequireBoardFromPcbnewQAData(const std::filesystem::path &aFilename)
Require a board from the path relative to the pcbnew QA data directory.
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition padstack.h:104
@ PTH
Plated through hole pad.
Definition padstack.h:99
VIATYPE
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_IGNORE
#define KEY_PREPREG
#define KEY_CORE
void buildBoard(int aCopperLayers)
std::unique_ptr< BOARD > m_board
SETTINGS_MANAGER m_settingsManager
void setRule(const std::string &aConstraint, const std::string &aCondition="", const std::string &aSeverity="")
std::vector< int > m_ignored
std::unique_ptr< KI_TEST::SCOPED_TEMP_DIR > m_ruleDir
BOOST_FIXTURE_TEST_CASE(ServerStartsAndResponds, API_SERVER_E2E_FIXTURE)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
static PCB_VIA_STACK * makeStack(BOARD *aBoard, PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd)
static PCB_VIA * makeMicrovia(BOARD *aBoard, const VECTOR2I &aPos, PCB_LAYER_ID aTop, PCB_LAYER_ID aBottom, bool aFilled)
static PCB_VIA * makeVia(BOARD *aBoard, const VECTOR2I &aPos, VIATYPE aType, PCB_LAYER_ID aTop, PCB_LAYER_ID aBottom, int aDrill)
static const VECTOR2I VIA_POS(pcbIUScale.mmToIU(10), pcbIUScale.mmToIU(10))
static PAD * makePthPad(BOARD *aBoard, const VECTOR2I &aPos, const VECTOR2I &aDrill)
BOOST_FIXTURE_TEST_CASE(GoodStackNoViolations, VIA_STACK_DRC_FIXTURE)
static void setUniformStackup(BOARD_DESIGN_SETTINGS &bds)
BOOST_AUTO_TEST_SUITE_END()
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708