KiCad PCB EDA Suite
|
#include <erc.h>
Public Member Functions | |
ERC_TESTER (SCHEMATIC *aSchematic) | |
void | TestOthersItems (NETLIST_OBJECT_LIST *aList, unsigned aNetItemRef, unsigned aNetStart, int *aMinConnexion) |
Perform ERC testing for electrical conflicts between NetItemRef and other items (mainly pin) on the same net. More... | |
int | TestDuplicateSheetNames (bool aCreateMarker) |
Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated). More... | |
void | TestTextVars (DS_PROXY_VIEW_ITEM *aDrawingSheet) |
Check for any unresolved text variable references. More... | |
int | TestConflictingBusAliases () |
Check that there are no conflicting bus alias definitions in the schematic. More... | |
int | TestMultiunitFootprints () |
Test if all units of each multiunit symbol have the same footprint assigned. More... | |
int | TestNoConnectPins () |
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type. More... | |
int | TestPinToPin () |
Checks the full netlist against the pin-to-pin connectivity requirements. More... | |
int | TestMultUnitPinConflicts () |
Checks if shared pins on multi-unit symbols have been connected to different nets. More... | |
int | TestSimilarLabels () |
Checks for labels that differ only in capitalization. More... | |
int | TestLibSymbolIssues () |
Test symbols for changed library symbols and broken symbol library links. More... | |
int | TestOffGridEndpoints (int aGridSize) |
Test pins and wire ends for being off grid. More... | |
int | TestSimModelIssues () |
Test SPICE models for various issues. More... | |
int | TestMissingUnits () |
Test for uninstantiated units of multi unit symbols. More... | |
void | RunTests (DS_PROXY_VIEW_ITEM *aDrawingSheet, SCH_EDIT_FRAME *aEditFrame, PROGRESS_REPORTER *aProgressReporter) |
Private Attributes | |
SCHEMATIC * | m_schematic |
void ERC_TESTER::RunTests | ( | DS_PROXY_VIEW_ITEM * | aDrawingSheet, |
SCH_EDIT_FRAME * | aEditFrame, | ||
PROGRESS_REPORTER * | aProgressReporter | ||
) |
Definition at line 1098 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_LIB_SYMBOL_ISSUES, 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_SIMILAR_LABELS, ERCE_SIMULATION_MODEL, ERCE_UNRESOLVED_VARIABLE, SCHEMATIC::ErcSettings(), SCH_BASE_FRAME::GetCanvas(), ADVANCED_CFG::GetCfg(), KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridSize(), SCH_DRAW_PANEL::GetView(), GLOBAL_CLEANUP, ERC_SETTINGS::IsTestEnabled(), m_schematic, NO_CLEANUP, SCH_EDIT_FRAME::RecalculateConnections(), SCHEMATIC::ResolveERCExclusionsPostUpdate(), CONNECTION_GRAPH::RunERC(), TestConflictingBusAliases(), TestDuplicateSheetNames(), TestLibSymbolIssues(), TestMissingUnits(), TestMultiunitFootprints(), TestMultUnitPinConflicts(), TestNoConnectPins(), TestOffGridEndpoints(), TestPinToPin(), TestSimilarLabels(), TestSimModelIssues(), TestTextVars(), and VECTOR2< T >::x.
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 299 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 129 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().
int ERC_TESTER::TestLibSymbolIssues | ( | ) |
Test symbols for changed library symbols and broken symbol library links.
Definition at line 885 of file erc.cpp.
References _, ERC_ITEM::Create(), LIB_ITEM::EQUALITY, LIB_ITEM::ERC, ERCE_LIB_SYMBOL_ISSUES, 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(), m_schematic, SCHEMATIC::Prj(), SCHEMATIC::Root(), SCH_SYMBOL_T, SchGetLibSymbol(), PROJECT_SCH::SchSymbolLibTable(), and UnescapeString().
Referenced by RunTests().
int ERC_TESTER::TestMissingUnits | ( | ) |
Test for uninstantiated units of multi unit symbols.
Definition at line 411 of file erc.cpp.
References _, SCH_SCREEN::Append(), convert, ERC_ITEM::Create(), ERCE_MISSING_BIDI_PIN, ERCE_MISSING_INPUT_PIN, ERCE_MISSING_POWER_INPUT_PIN, ERCE_MISSING_UNIT, SCHEMATIC::ErcSettings(), SCH_SYMBOL::GetConvert(), 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 346 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 769 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 551 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 | ( | int | aGridSize | ) |
Test pins and wire ends for being off grid.
Definition at line 975 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(), m_schematic, EDA_IU_SCALE::MilsToIU(), pin, SCHEMATIC::Root(), SCH_LINE_T, SCH_SYMBOL_T, schIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by RunTests().
void ERC_TESTER::TestOthersItems | ( | NETLIST_OBJECT_LIST * | aList, |
unsigned | aNetItemRef, | ||
unsigned | aNetStart, | ||
int * | aMinConnexion | ||
) |
Perform ERC testing for electrical conflicts between NetItemRef and other items (mainly pin) on the same net.
aList | = a reference to the list of connected objects |
aNetItemRef | = index in list of the current object |
aNetStart | = index in list of net objects of the first item |
aMinConnexion | = a pointer to a variable to store the minimal connection found( NOD, DRV, NPI, NET_NC) |
int ERC_TESTER::TestPinToPin | ( | ) |
Checks the full netlist against the pin-to-pin connectivity requirements.
Definition at line 619 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(), CONNECTION_SUBGRAPH::GetSheet(), SCH_PIN::GetTransformedPosition(), SCH_PIN::GetType(), 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::TestSimilarLabels | ( | ) |
Checks for labels that differ only in capitalization.
Definition at line 829 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 1047 of file erc.cpp.
References ERC_ITEM::Create(), SIM_LIB_MGR::CreateModel(), ERCE_SIMULATION_MODEL, SCH_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 175 of file erc.cpp.
References _, SCH_SCREEN::Append(), DS_DRAW_ITEM_LIST::BuildDrawItemsList(), ERC_ITEM::Create(), SCHEMATIC::CurrentSheet(), 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(), SCHEMATIC::GetSheets(), DS_PROXY_VIEW_ITEM::GetTitleBlock(), SCH_SCREEN::Items(), m_schematic, EE_RTREE::OfType(), pin, SCHEMATIC::Prj(), SCH_LOCATE_ANY_T, SCH_SHEET_T, SCH_SYMBOL_T, schIUScale, SCHEMATIC::SetCurrentSheet(), 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 RunTests().
|
private |
Definition at line 154 of file erc.h.
Referenced by RunTests(), TestConflictingBusAliases(), TestDuplicateSheetNames(), TestLibSymbolIssues(), TestMissingUnits(), TestMultiunitFootprints(), TestMultUnitPinConflicts(), TestNoConnectPins(), TestOffGridEndpoints(), TestPinToPin(), TestSimilarLabels(), TestSimModelIssues(), and TestTextVars().