KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ERC_TESTER Class Reference

#include <erc.h>

Public Member Functions

 ERC_TESTER (SCHEMATIC *aSchematic)
 
int TestDuplicateSheetNames (bool aCreateMarker)
 Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).
 
void TestTextVars (DS_PROXY_VIEW_ITEM *aDrawingSheet)
 Check for any unresolved text variable references.
 
int TestConflictingBusAliases ()
 Check that there are no conflicting bus alias definitions in the schematic.
 
int TestMultiunitFootprints ()
 Test if all units of each multiunit symbol have the same footprint assigned.
 
int TestNoConnectPins ()
 In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
 
int TestPinToPin ()
 Checks the full netlist against the pin-to-pin connectivity requirements.
 
int TestMultUnitPinConflicts ()
 Checks if shared pins on multi-unit symbols have been connected to different nets.
 
int TestSameLocalGlobalLabel ()
 Checks for global and local labels with the same name.
 
int TestSimilarLabels ()
 Checks for labels that differ only in capitalization.
 
int TestFourWayJunction ()
 Test to see if there are potentially confusing 4-way junctions in the schematic.
 
int TestLabelMultipleWires ()
 Test to see if there are labels that are connected to more than one wire.
 
int TestLibSymbolIssues ()
 Test symbols for changed library symbols and broken symbol library links.
 
int TestFootprintLinkIssues (KIFACE *aCvPcb, PROJECT *aProject)
 Test footprint links against the current footprint libraries.
 
int TestFootprintFilters ()
 Test symbols to ensure that assigned footprint passes any given footprint filters.
 
int TestOffGridEndpoints ()
 Test pins and wire ends for being off grid.
 
int TestSimModelIssues ()
 Test SPICE models for various issues.
 
int TestMissingUnits ()
 Test for uninstantiated units of multi unit symbols.
 
int TestMissingNetclasses ()
 Tests for netclasses that are referenced but not defined.
 
int RunRuleAreaERC ()
 Tests for rule area ERC issues.
 
void RunTests (DS_PROXY_VIEW_ITEM *aDrawingSheet, SCH_EDIT_FRAME *aEditFrame, KIFACE *aCvPcb, PROJECT *aProject, PROGRESS_REPORTER *aProgressReporter)
 

Private Attributes

SCHEMATICm_schematic
 
ERC_SETTINGSm_settings
 
SCH_SHEET_LIST m_sheetList
 
SCH_SCREENS m_screens
 
SCH_MULTI_UNIT_REFERENCE_MAP m_refMap
 
const NET_MAPm_nets
 

Detailed Description

Definition at line 51 of file erc.h.

Constructor & Destructor Documentation

◆ ERC_TESTER()

ERC_TESTER::ERC_TESTER ( SCHEMATIC aSchematic)
inline

Definition at line 55 of file erc.h.

References SCH_SHEET_LIST::GetMultiUnitSymbols(), m_refMap, and m_sheetList.

Member Function Documentation

◆ RunRuleAreaERC()

int ERC_TESTER::RunRuleAreaERC ( )

Tests for rule area ERC issues.

◆ RunTests()

void ERC_TESTER::RunTests ( DS_PROXY_VIEW_ITEM aDrawingSheet,
SCH_EDIT_FRAME aEditFrame,
KIFACE aCvPcb,
PROJECT aProject,
PROGRESS_REPORTER aProgressReporter 
)

Definition at line 1751 of file erc.cpp.

References _, PROGRESS_REPORTER::AdvancePhase(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCHEMATIC::ConnectionGraph(), ERCE_BUS_ALIAS_CONFLICT, ERCE_DIFFERENT_UNIT_FP, ERCE_DIFFERENT_UNIT_NET, ERCE_DUPLICATE_SHEET_NAME, ERCE_ENDPOINT_OFF_GRID, ERCE_FOOTPRINT_FILTERS, ERCE_FOOTPRINT_LINK_ISSUES, ERCE_FOUR_WAY_JUNCTION, ERCE_LABEL_MULTIPLE_WIRES, ERCE_LIB_SYMBOL_ISSUES, ERCE_LIB_SYMBOL_MISMATCH, ERCE_MISSING_BIDI_PIN, ERCE_MISSING_INPUT_PIN, ERCE_MISSING_POWER_INPUT_PIN, ERCE_MISSING_UNIT, ERCE_NOCONNECT_CONNECTED, ERCE_PIN_NOT_DRIVEN, ERCE_PIN_TO_PIN_ERROR, ERCE_POWERPIN_NOT_DRIVEN, ERCE_SAME_LOCAL_GLOBAL_LABEL, ERCE_SIMILAR_LABEL_AND_POWER, ERCE_SIMILAR_LABELS, ERCE_SIMILAR_POWER, ERCE_SIMULATION_MODEL, ERCE_UNDEFINED_NETCLASS, ERCE_UNRESOLVED_VARIABLE, ADVANCED_CFG::GetCfg(), GLOBAL_CLEANUP, ERC_SETTINGS::IsTestEnabled(), m_schematic, m_settings, m_sheetList, NO_CLEANUP, SCH_EDIT_FRAME::RecalculateConnections(), SCHEMATIC::ResolveERCExclusionsPostUpdate(), CONNECTION_GRAPH::RunERC(), TestConflictingBusAliases(), TestDuplicateSheetNames(), TestFootprintFilters(), TestFootprintLinkIssues(), TestFourWayJunction(), TestLabelMultipleWires(), TestLibSymbolIssues(), TestMissingNetclasses(), TestMissingUnits(), TestMultiunitFootprints(), TestMultUnitPinConflicts(), TestNoConnectPins(), TestOffGridEndpoints(), TestPinToPin(), TestSameLocalGlobalLabel(), TestSimilarLabels(), TestSimModelIssues(), and TestTextVars().

Referenced by EESCHEMA_JOBS_HANDLER::JobSchErc(), and DIALOG_ERC::testErc().

◆ TestConflictingBusAliases()

int ERC_TESTER::TestConflictingBusAliases ( )

Check that there are no conflicting bus alias definitions in the schematic.

(for example, two hierarchical sub-sheets contain different definitions for the same bus alias)

Returns
the error count

Definition at line 434 of file erc.cpp.

References _, ERC_ITEM::Create(), ERCE_BUS_ALIAS_CONFLICT, SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), and m_screens.

Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().

◆ TestDuplicateSheetNames()

int ERC_TESTER::TestDuplicateSheetNames ( bool  aCreateMarker)

Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).

Returns
the error count
Parameters
aCreateMarkertrue = create error markers in schematic, false = calculate error count only

Definition at line 140 of file erc.cpp.

References ERC_ITEM::Create(), ERCE_DUPLICATE_SHEET_NAME, SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), SCH_SHEET::GetPosition(), SCH_SHEET::GetShownName(), m_screens, and SCH_SHEET_T.

Referenced by RunTests().

◆ TestFootprintFilters()

int ERC_TESTER::TestFootprintFilters ( )

Test symbols to ensure that assigned footprint passes any given footprint filters.

Returns
the number of issues found

Definition at line 1565 of file erc.cpp.

References _, ERC_ITEM::Create(), ERCE_FOOTPRINT_LINK_ISSUES, filter, SCH_SYMBOL::GetFootprintFieldText(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetPosition(), LIB_ID::GetUniStringLibItemName(), m_schematic, m_sheetList, LIB_ID::Parse(), and SCH_SYMBOL_T.

Referenced by RunTests().

◆ TestFootprintLinkIssues()

◆ TestFourWayJunction()

int ERC_TESTER::TestFourWayJunction ( )

Test to see if there are potentially confusing 4-way junctions in the schematic.

Definition at line 785 of file erc.cpp.

References _, ERC_ITEM::Create(), ERCE_FOUR_WAY_JUNCTION, SCH_LINE::GetConnectionPoints(), SCH_SYMBOL::GetPins(), SCH_LINE::IsGraphicLine(), SCH_SCREEN::Items(), m_sheetList, EE_RTREE::OfType(), pin, SCH_LINE_T, and SCH_SYMBOL_T.

Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().

◆ TestLabelMultipleWires()

int ERC_TESTER::TestLabelMultipleWires ( )

Test to see if there are labels that are connected to more than one wire.

Definition at line 730 of file erc.cpp.

References _, ERC_ITEM::Create(), ERCE_LABEL_MULTIPLE_WIRES, SCH_LABEL_BASE::GetConnectionPoints(), SCH_LINE::IsEndPoint(), SCH_LINE::IsGraphicLine(), m_sheetList, SCH_LABEL_T, and SCH_LINE_T.

Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().

◆ TestLibSymbolIssues()

◆ TestMissingNetclasses()

int ERC_TESTER::TestMissingNetclasses ( )

◆ TestMissingUnits()

◆ TestMultiunitFootprints()

int ERC_TESTER::TestMultiunitFootprints ( )

◆ TestMultUnitPinConflicts()

int ERC_TESTER::TestMultUnitPinConflicts ( )

Checks if shared pins on multi-unit symbols have been connected to different nets.

Returns
the error count

Definition at line 1147 of file erc.cpp.

References _, SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_DIFFERENT_UNIT_NET, CONNECTION_SUBGRAPH::GetItems(), CONNECTION_SUBGRAPH::GetSheet(), SCH_SHEET_PATH::LastScreen(), m_nets, name, pin, and SCH_PIN_T.

Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().

◆ TestNoConnectPins()

int ERC_TESTER::TestNoConnectPins ( )

In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.

In KiCad 6, this no longer results in those pins joining the net, so we need to warn about it

Returns
the error count

Definition at line 839 of file erc.cpp.

References _, ERC_ITEM::Create(), ERCE_NOCONNECT_CONNECTED, SCH_SYMBOL::GetPins(), m_sheetList, pin, and SCH_SYMBOL_T.

Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().

◆ TestOffGridEndpoints()

◆ TestPinToPin()

◆ TestSameLocalGlobalLabel()

int ERC_TESTER::TestSameLocalGlobalLabel ( )

Checks for global and local labels with the same name.

Returns
the error count

Definition at line 1204 of file erc.cpp.

References ERC_ITEM::Create(), ERCE_SAME_LOCAL_GLOBAL_LABEL, CONNECTION_SUBGRAPH::GetItems(), CONNECTION_SUBGRAPH::GetSheet(), SCH_LABEL_BASE::GetShownText(), m_nets, SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and text.

Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().

◆ TestSimilarLabels()

int ERC_TESTER::TestSimilarLabels ( )

◆ TestSimModelIssues()

◆ TestTextVars()

Member Data Documentation

◆ m_nets

const NET_MAP& ERC_TESTER::m_nets
private

◆ m_refMap

SCH_MULTI_UNIT_REFERENCE_MAP ERC_TESTER::m_refMap
private

Definition at line 190 of file erc.h.

Referenced by ERC_TESTER(), TestMissingUnits(), and TestMultiunitFootprints().

◆ m_schematic

◆ m_screens

SCH_SCREENS ERC_TESTER::m_screens
private

◆ m_settings

ERC_SETTINGS& ERC_TESTER::m_settings
private

Definition at line 187 of file erc.h.

Referenced by RunTests(), TestLibSymbolIssues(), TestMissingUnits(), and TestPinToPin().

◆ m_sheetList


The documentation for this class was generated from the following files: