KiCad PCB EDA Suite
|
#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 | TestSimilarLabels () |
Checks for labels that differ only in capitalization. | |
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 | 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. | |
int | TestRuleAreaOverlappingRuleAreasERC (std::map< SCH_SCREEN *, std::vector< SCH_RULE_AREA * > > &allScreenRuleAreas) |
Runs ERC to check for overlapping rule areas. | |
void | RunTests (DS_PROXY_VIEW_ITEM *aDrawingSheet, SCH_EDIT_FRAME *aEditFrame, KIFACE *aCvPcb, PROJECT *aProject, PROGRESS_REPORTER *aProgressReporter) |
Private Attributes | |
SCHEMATIC * | m_schematic |
int ERC_TESTER::RunRuleAreaERC | ( | ) |
Tests for rule area ERC issues.
Definition at line 1233 of file erc.cpp.
References ERCE_OVERLAPPING_RULE_AREAS, SCHEMATIC::ErcSettings(), SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), ERC_SETTINGS::IsTestEnabled(), m_schematic, SCHEMATIC::Root(), SCH_RULE_AREA_T, and TestRuleAreaOverlappingRuleAreasERC().
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
void ERC_TESTER::RunTests | ( | DS_PROXY_VIEW_ITEM * | aDrawingSheet, |
SCH_EDIT_FRAME * | aEditFrame, | ||
KIFACE * | aCvPcb, | ||
PROJECT * | aProject, | ||
PROGRESS_REPORTER * | aProgressReporter | ||
) |
Definition at line 1300 of file erc.cpp.
References _, PROGRESS_REPORTER::AdvancePhase(), SCHEMATIC::ConnectionGraph(), ERCE_BUS_ALIAS_CONFLICT, ERCE_DIFFERENT_UNIT_FP, ERCE_DIFFERENT_UNIT_NET, ERCE_DUPLICATE_SHEET_NAME, ERCE_ENDPOINT_OFF_GRID, ERCE_FOOTPRINT_LINK_ISSUES, 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_OVERLAPPING_RULE_AREAS, ERCE_PIN_NOT_DRIVEN, ERCE_PIN_TO_PIN_ERROR, ERCE_POWERPIN_NOT_DRIVEN, ERCE_SIMILAR_LABELS, ERCE_SIMULATION_MODEL, ERCE_UNDEFINED_NETCLASS, ERCE_UNRESOLVED_VARIABLE, SCHEMATIC::ErcSettings(), ADVANCED_CFG::GetCfg(), GLOBAL_CLEANUP, ERC_SETTINGS::IsTestEnabled(), m_schematic, NO_CLEANUP, SCH_EDIT_FRAME::RecalculateConnections(), SCHEMATIC::ResolveERCExclusionsPostUpdate(), CONNECTION_GRAPH::RunERC(), RunRuleAreaERC(), TestConflictingBusAliases(), TestDuplicateSheetNames(), TestFootprintLinkIssues(), TestLibSymbolIssues(), TestMissingNetclasses(), TestMissingUnits(), TestMultiunitFootprints(), TestMultUnitPinConflicts(), TestNoConnectPins(), TestOffGridEndpoints(), TestPinToPin(), TestSimilarLabels(), TestSimModelIssues(), and TestTextVars().
Referenced by EESCHEMA_JOBS_HANDLER::JobSchErc(), and DIALOG_ERC::testErc().
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)
Definition at line 303 of file erc.cpp.
References _, ERC_ITEM::Create(), ERCE_BUS_ALIAS_CONFLICT, SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), m_schematic, and SCHEMATIC::Root().
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
int ERC_TESTER::TestDuplicateSheetNames | ( | bool | aCreateMarker | ) |
Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).
aCreateMarker | true = create error markers in schematic, false = calculate error count only |
Definition at line 134 of file erc.cpp.
References SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_DUPLICATE_SHEET_NAME, SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), SCH_SHEET::GetPosition(), SCH_SHEET::GetShownName(), SCH_SCREEN::Items(), m_schematic, EE_RTREE::OfType(), SCHEMATIC::Root(), and SCH_SHEET_T.
Referenced by RunTests().
Test footprint links against the current footprint libraries.
Definition at line 1037 of file erc.cpp.
References _, ERC_ITEM::Create(), ERCE_FOOTPRINT_LINK_ISSUES, SCH_SYMBOL::GetFootprintFieldText(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), SCH_SYMBOL::GetPosition(), SCHEMATIC::GetSheets(), KIFACE::IfaceOrAddress(), KIFACE_TEST_FOOTPRINT_LINK, KIFACE_TEST_FOOTPRINT_LINK_LIBRARY_NOT_ENABLED, KIFACE_TEST_FOOTPRINT_LINK_NO_FOOTPRINT, KIFACE_TEST_FOOTPRINT_LINK_NO_LIBRARY, m_schematic, LIB_ID::Parse(), and SCH_SYMBOL_T.
Referenced by RunTests().
int ERC_TESTER::TestLibSymbolIssues | ( | ) |
Test symbols for changed library symbols and broken symbol library links.
Definition at line 933 of file erc.cpp.
References _, ERC_ITEM::Create(), SCH_ITEM::EQUALITY, SCH_ITEM::ERC, ERCE_LIB_SYMBOL_ISSUES, ERCE_LIB_SYMBOL_MISMATCH, SCHEMATIC::ErcSettings(), SYMBOL_LIB_TABLE::FindRow(), LIB_SYMBOL::Flatten(), SCH_SCREENS::GetFirst(), SCH_SYMBOL::GetLibId(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SCREENS::GetNext(), SCH_SYMBOL::GetPosition(), LIB_TABLE::HasLibrary(), ERC_SETTINGS::IsTestEnabled(), m_schematic, SCHEMATIC::Prj(), SCHEMATIC::Root(), SCH_SYMBOL_T, SchGetLibSymbol(), PROJECT_SCH::SchSymbolLibTable(), and UnescapeString().
Referenced by RunTests().
int ERC_TESTER::TestMissingNetclasses | ( | ) |
Tests for netclasses that are referenced but not defined.
Definition at line 557 of file erc.cpp.
References _, SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_UNDEFINED_NETCLASS, PROJECT::GetProjectFile(), SCHEMATIC::GetSheets(), SCH_SCREEN::Items(), SCH_SHEET_PATH::LastScreen(), m_schematic, PROJECT_FILE::NetSettings(), SCHEMATIC::Prj(), SCH_FIELD_T, and EDA_ITEM::Type().
Referenced by RunTests().
int ERC_TESTER::TestMissingUnits | ( | ) |
Test for uninstantiated units of multi unit symbols.
Definition at line 415 of file erc.cpp.
References _, SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_MISSING_BIDI_PIN, ERCE_MISSING_INPUT_PIN, ERCE_MISSING_POWER_INPUT_PIN, ERCE_MISSING_UNIT, SCHEMATIC::ErcSettings(), SCH_ITEM::GetBodyStyle(), SCH_REFERENCE_LIST::GetCount(), SCH_REFERENCE_LIST::GetItem(), SCH_REFERENCE::GetLibPart(), SCH_SHEET_LIST::GetMultiUnitSymbols(), LIB_SYMBOL::GetPins(), SCH_SYMBOL::GetPosition(), SCH_REFERENCE::GetSheetPath(), SCHEMATIC::GetSheets(), SCH_REFERENCE::GetSymbol(), SCH_REFERENCE::GetUnit(), LIB_SYMBOL::GetUnitCount(), LIB_SYMBOL::GetUnitDisplayName(), ERC_SETTINGS::IsTestEnabled(), SCH_SHEET_PATH::LastScreen(), m_schematic, and pin.
Referenced by RunTests().
int ERC_TESTER::TestMultiunitFootprints | ( | ) |
Test if all units of each multiunit symbol have the same footprint assigned.
Definition at line 350 of file erc.cpp.
References _, SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_DIFFERENT_UNIT_FP, SCH_REFERENCE_LIST::GetCount(), SCH_REFERENCE::GetFootprint(), SCH_REFERENCE_LIST::GetItem(), SCH_SHEET_LIST::GetMultiUnitSymbols(), SCH_SYMBOL::GetPosition(), SCH_SYMBOL::GetRef(), SCH_REFERENCE::GetSheetPath(), SCHEMATIC::GetSheets(), SCH_REFERENCE::GetSymbol(), SCH_SHEET_PATH::LastScreen(), and m_schematic.
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
int ERC_TESTER::TestMultUnitPinConflicts | ( | ) |
Checks if shared pins on multi-unit symbols have been connected to different nets.
Definition at line 813 of file erc.cpp.
References _, SCH_SCREEN::Append(), SCHEMATIC::ConnectionGraph(), ERC_ITEM::Create(), ERCE_DIFFERENT_UNIT_NET, CONNECTION_SUBGRAPH::GetItems(), CONNECTION_GRAPH::GetNetMap(), CONNECTION_SUBGRAPH::GetSheet(), SCH_SHEET_PATH::LastScreen(), m_schematic, name, pin, and SCH_PIN_T.
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
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
Definition at line 610 of file erc.cpp.
References _, ERC_ITEM::Create(), ERCE_NOCONNECT_CONNECTED, SCH_SYMBOL::GetPins(), SCHEMATIC::GetSheets(), m_schematic, pin, and SCH_SYMBOL_T.
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
int ERC_TESTER::TestOffGridEndpoints | ( | ) |
Test pins and wire ends for being off grid.
Definition at line 1117 of file erc.cpp.
References ERC_ITEM::Create(), ERCE_ENDPOINT_OFF_GRID, SCH_LINE::GetEndPoint(), SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), SCH_SYMBOL::GetPins(), SCH_LINE::GetStartPoint(), SCHEMATIC_SETTINGS::m_ConnectionGridSize, m_schematic, pin, SCHEMATIC::Root(), SCH_LINE_T, SCH_SYMBOL_T, SCHEMATIC::Settings(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by RunTests().
int ERC_TESTER::TestPinToPin | ( | ) |
Checks the full netlist against the pin-to-pin connectivity requirements.
Definition at line 679 of file erc.cpp.
References _, SCHEMATIC::ConnectionGraph(), ERC_ITEM::Create(), DrivenPinTypes, DrivingPinTypes, DrivingPowerPinTypes, ElectricalPinTypeGetText(), erc, ERCE_PIN_NOT_DRIVEN, ERCE_PIN_TO_PIN_ERROR, ERCE_PIN_TO_PIN_WARNING, ERCE_POWERPIN_NOT_DRIVEN, SCHEMATIC::ErcSettings(), CONNECTION_SUBGRAPH::GetItems(), CONNECTION_GRAPH::GetNetMap(), CONNECTION_SUBGRAPH::GetNoConnect(), ERC_SETTINGS::GetPinMapValue(), SCH_PIN::GetPosition(), CONNECTION_SUBGRAPH::GetSheet(), SCH_PIN::GetType(), SCH_PIN::IsStacked(), ERC_SETTINGS::IsTestEnabled(), SCH_PIN::IsVisible(), SCH_SHEET_PATH::LastScreen(), m_schematic, ERC_SCH_PIN_CONTEXT::Pin(), SCH_PIN_T, and ERC_SCH_PIN_CONTEXT::Sheet().
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
int ERC_TESTER::TestRuleAreaOverlappingRuleAreasERC | ( | std::map< SCH_SCREEN *, std::vector< SCH_RULE_AREA * > > & | allScreenRuleAreas | ) |
Runs ERC to check for overlapping rule areas.
Definition at line 1260 of file erc.cpp.
References SCH_SCREEN::Append(), SHAPE_POLY_SET::Collide(), ERC_ITEM::Create(), ERCE_OVERLAPPING_RULE_AREAS, and SCH_SCREEN::GetClientSheetPaths().
Referenced by RunRuleAreaERC().
int ERC_TESTER::TestSimilarLabels | ( | ) |
Checks for labels that differ only in capitalization.
Definition at line 872 of file erc.cpp.
References SCH_SCREEN::Append(), SCH_SHEET_PATH::at(), SCHEMATIC::ConnectionGraph(), ERC_ITEM::Create(), ERCE_SIMILAR_LABELS, CONNECTION_SUBGRAPH::GetItems(), CONNECTION_GRAPH::GetNetMap(), SCH_TEXT::GetPosition(), CONNECTION_SUBGRAPH::GetSheet(), SCH_LABEL_BASE::GetShownText(), SCH_SHEET_PATH::LastScreen(), m_schematic, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, and SCH_LABEL_T.
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
int ERC_TESTER::TestSimModelIssues | ( | ) |
Test SPICE models for various issues.
Definition at line 1182 of file erc.cpp.
References ERC_ITEM::Create(), SIM_LIB_MGR::CreateModel(), ERCE_SIMULATION_MODEL, SYMBOL::GetExcludedFromSim(), SCH_SYMBOL::GetPosition(), SCH_SYMBOL::GetRef(), SCHEMATIC::GetSheets(), m_schematic, SCHEMATIC::Prj(), and SCH_SYMBOL_T.
Referenced by RunTests().
void ERC_TESTER::TestTextVars | ( | DS_PROXY_VIEW_ITEM * | aDrawingSheet | ) |
Check for any unresolved text variable references.
Definition at line 181 of file erc.cpp.
References _, SCH_SCREEN::Append(), DS_DRAW_ITEM_LIST::BuildDrawItemsList(), ERC_ITEM::Create(), erc, ERCE_UNRESOLVED_VARIABLE, ExpandEnvVarSubstitutions(), SCH_SHEET::GetFields(), SCH_SYMBOL::GetFields(), DS_DRAW_ITEM_LIST::GetFirst(), DS_DRAW_ITEM_LIST::GetNext(), DS_PROXY_VIEW_ITEM::GetPageInfo(), SCH_SHEET::GetPins(), SCHEMATIC::GetSheets(), DS_PROXY_VIEW_ITEM::GetTitleBlock(), SCH_SCREEN::Items(), m_schematic, EE_RTREE::OfType(), pin, SCHEMATIC::Prj(), SCH_SHEET_PATH::push_back(), SCH_LOCATE_ANY_T, SCH_SHEET_T, SCH_SYMBOL_T, schIUScale, DS_DRAW_ITEM_LIST::SetFileName(), DS_DRAW_ITEM_LIST::SetPageNumber(), DS_DRAW_ITEM_LIST::SetProject(), DS_DRAW_ITEM_LIST::SetSheetCount(), DS_DRAW_ITEM_LIST::SetSheetLayer(), DS_DRAW_ITEM_LIST::SetSheetName(), and text.
Referenced by BOOST_FIXTURE_TEST_CASE(), and RunTests().
|
private |
Definition at line 164 of file erc.h.
Referenced by RunRuleAreaERC(), RunTests(), TestConflictingBusAliases(), TestDuplicateSheetNames(), TestFootprintLinkIssues(), TestLibSymbolIssues(), TestMissingNetclasses(), TestMissingUnits(), TestMultiunitFootprints(), TestMultUnitPinConflicts(), TestNoConnectPins(), TestOffGridEndpoints(), TestPinToPin(), TestSimilarLabels(), TestSimModelIssues(), and TestTextVars().