![]() |
KiCad PCB EDA Suite
|
Calculates the connectivity of a schematic and generates netlists. More...
#include <connection_graph.h>
Public Member Functions | |
CONNECTION_GRAPH (SCHEMATIC *aSchematic=nullptr) | |
~CONNECTION_GRAPH () | |
void | Reset () |
void | SetSchematic (SCHEMATIC *aSchematic) |
void | Recalculate (const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr) |
Updates the connection graph for the given list of sheets. More... | |
std::shared_ptr< BUS_ALIAS > | GetBusAlias (const wxString &aName) |
Returns a bus alias pointer for the given name if it exists (from cache) More... | |
std::vector< const CONNECTION_SUBGRAPH * > | GetBusesNeedingMigration () |
Determines which subgraphs have more than one conflicting bus label. More... | |
int | RunERC () |
Runs electrical rule checks on the connectivity graph. More... | |
const NET_MAP & | GetNetMap () const |
CONNECTION_SUBGRAPH * | FindSubgraphByName (const wxString &aNetName, const SCH_SHEET_PATH &aPath) |
Returns the subgraph for a given net name on a given sheet. More... | |
CONNECTION_SUBGRAPH * | FindFirstSubgraphByName (const wxString &aNetName) |
Retrieves a subgraph for the given net name, if one exists. More... | |
CONNECTION_SUBGRAPH * | GetSubgraphForItem (SCH_ITEM *aItem) |
Static Public Attributes | |
static bool | m_allowRealTime = true |
Private Member Functions | |
void | updateItemConnectivity (const SCH_SHEET_PATH &aSheet, const std::vector< SCH_ITEM * > &aItemList) |
Updates the graphical connectivity between items (i.e. More... | |
void | buildConnectionGraph () |
Generates the connection graph (after all item connectivity has been updated) More... | |
void | buildItemSubGraphs () |
Generates individual item subgraphs on a per-sheet basis. More... | |
void | resolveAllDrivers () |
Finds all subgraphs in the connection graph and calls ResolveDrivers() in parallel. More... | |
void | collectAllDriverValues () |
Maps the driver values for each subgraph. More... | |
void | generateInvisiblePinSubGraphs () |
Iterate through the invisible power pins to collect the global labels as drivers. More... | |
void | processSubGraphs () |
Process all subgraphs to assign netcodes and merge subgraphs based on labels. More... | |
int | assignNewNetCode (SCH_CONNECTION &aConnection) |
Helper to assign a new net code to a connection. More... | |
void | assignNetCodesToBus (SCH_CONNECTION *aConnection) |
Ensures all members of the bus connection have a valid net code assigned. More... | |
void | propagateToNeighbors (CONNECTION_SUBGRAPH *aSubgraph) |
Updates all neighbors of a subgraph with this one's connectivity info. More... | |
std::shared_ptr< SCH_CONNECTION > | getDefaultConnection (SCH_ITEM *aItem, CONNECTION_SUBGRAPH *aSubgraph) |
Builds a new default connection for the given item based on its properties. More... | |
void | recacheSubgraphName (CONNECTION_SUBGRAPH *aSubgraph, const wxString &aOldName) |
bool | ercCheckMultipleDrivers (const CONNECTION_SUBGRAPH *aSubgraph) |
If the subgraph has multiple drivers of equal priority that are graphically connected, ResolveDrivers() will have stored the second driver for use by this function, which actually creates the markers. More... | |
bool | ercCheckBusToNetConflicts (const CONNECTION_SUBGRAPH *aSubgraph) |
Checks one subgraph for conflicting connections between net and bus labels. More... | |
bool | ercCheckBusToBusConflicts (const CONNECTION_SUBGRAPH *aSubgraph) |
Checks one subgraph for conflicting connections between two bus items. More... | |
bool | ercCheckBusToBusEntryConflicts (const CONNECTION_SUBGRAPH *aSubgraph) |
Checks one subgraph for conflicting bus entry to bus connections. More... | |
bool | ercCheckNoConnects (const CONNECTION_SUBGRAPH *aSubgraph) |
Checks one subgraph for proper presence or absence of no-connect symbols. More... | |
bool | ercCheckFloatingWires (const CONNECTION_SUBGRAPH *aSubgraph) |
Checks one subgraph for floating wires. More... | |
bool | ercCheckLabels (const CONNECTION_SUBGRAPH *aSubgraph) |
Checks one subgraph for proper connection of labels. More... | |
int | ercCheckHierSheets () |
Checks that a hierarchical sheet has at least one matching label inside the sheet for each port on the parent sheet object. More... | |
Static Private Member Functions | |
static SCH_CONNECTION * | matchBusMember (SCH_CONNECTION *aBusConnection, SCH_CONNECTION *aSearch) |
Search for a matching bus member inside a bus connection. More... | |
Calculates the connectivity of a schematic and generates netlists.
Definition at line 248 of file connection_graph.h.
|
inline |
Definition at line 251 of file connection_graph.h.
|
inline |
Definition at line 258 of file connection_graph.h.
References Reset().
|
private |
Ensures all members of the bus connection have a valid net code assigned.
aConnection | is a bus connection |
Definition at line 1690 of file connection_graph.cpp.
References assignNewNetCode(), and SCH_CONNECTION::Members().
Referenced by processSubGraphs().
|
private |
Helper to assign a new net code to a connection.
Definition at line 1668 of file connection_graph.cpp.
References m_last_net_code, m_net_name_to_code_map, SCH_CONNECTION::Name(), and SCH_CONNECTION::SetNetCode().
Referenced by assignNetCodesToBus(), generateInvisiblePinSubGraphs(), and processSubGraphs().
|
private |
Generates the connection graph (after all item connectivity has been updated)
In the first phase, the algorithm iterates over all items, and then over all items that are connected (graphically) to each item, placing them into CONNECTION_SUBGRAPHs. Items that can potentially drive connectivity (i.e. labels, pins, etc.) are added to the m_drivers vector of the subgraph.
In the second phase, each subgraph is resolved. To resolve a subgraph, the driver is first selected by CONNECTION_SUBGRAPH::ResolveDrivers(), and then the connection for the chosen driver is propagated to all the other items in the subgraph.
TODO(JE): Net codes are non-deterministic. Fortunately, they are also not really used for anything. We should consider removing them entirely and just using net names everywhere.
Definition at line 1356 of file connection_graph.cpp.
References buildItemSubGraphs(), BUS, SCH_CONNECTION::Clone(), collectAllDriverValues(), SCH_CONNECTION::ConfigureFromLabel(), SCH_ITEM::Connection(), ConnProfileMask, ConnTrace, alg::delete_if(), generateInvisiblePinSubGraphs(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCHEMATIC::GetSheets(), EDA_TEXT::GetText(), SCH_CONNECTION::IsBus(), SCH_CONNECTION::IsNet(), SCH_SCREEN::Items(), CONNECTION_SUBGRAPH::m_absorbed, CONNECTION_SUBGRAPH::m_absorbed_by, m_bus_alias_cache, CONNECTION_SUBGRAPH::m_code, CONNECTION_SUBGRAPH::m_dirty, CONNECTION_SUBGRAPH::m_driver, CONNECTION_SUBGRAPH::m_driver_connection, m_driver_subgraphs, CONNECTION_SUBGRAPH::m_drivers, CONNECTION_SUBGRAPH::m_local_driver, m_net_code_to_subgraphs_map, m_net_name_to_subgraphs_map, m_schematic, CONNECTION_SUBGRAPH::m_sheet, m_sheet_to_subgraphs_map, CONNECTION_SUBGRAPH::m_strong_driver, m_subgraphs, matchBusMember(), name, SCH_CONNECTION::Name(), EE_RTREE::OfType(), path, pin, CONNECTION_SUBGRAPH::POWER_PIN, processSubGraphs(), propagateToNeighbors(), resolveAllDrivers(), SCH_HIER_LABEL_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_CONNECTION::SetType(), PROF_TIMER::Show(), EDA_ITEM::Type(), and CONNECTION_SUBGRAPH::UpdateItemConnections().
Referenced by Recalculate().
|
private |
Generates individual item subgraphs on a per-sheet basis.
Definition at line 730 of file connection_graph.cpp.
References CONNECTION_SUBGRAPH::AddItem(), CANDIDATE, CONNECTION_SUBGRAPH::m_code, CONNECTION_SUBGRAPH::m_dirty, m_item_to_subgraph_map, m_items, m_last_subgraph_code, CONNECTION_SUBGRAPH::m_no_connect, CONNECTION_SUBGRAPH::m_sheet, m_subgraphs, SCH_NO_CONNECT_T, SCH_CONNECTION::SetSubgraphCode(), and SCH_CONNECTION::SubgraphCode().
Referenced by buildConnectionGraph().
|
private |
Maps the driver values for each subgraph.
Definition at line 893 of file connection_graph.cpp.
References BUS, ConnTrace, EDA_ITEM::GetSelectMenuText(), m_driver_subgraphs, m_global_label_cache, m_local_label_cache, m_net_name_to_subgraphs_map, MILLIMETRES, name, pin, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, and EDA_ITEM::Type().
Referenced by buildConnectionGraph().
|
private |
Checks one subgraph for conflicting connections between two bus items.
For example, a labeled bus wire connected to a hierarchical sheet pin where the labeled bus doesn't contain any of the same bus members as the sheet pin
aSubgraph | is the subgraph to examine |
Definition at line 2461 of file connection_graph.cpp.
References SCH_SCREEN::Append(), SCH_ITEM::Connection(), ERC_ITEM::Create(), ERCE_BUS_TO_BUS_CONFLICT, EDA_ITEM::GetPosition(), SCH_CONNECTION::IsBus(), SCH_SHEET_PATH::LastScreen(), CONNECTION_SUBGRAPH::m_items, CONNECTION_SUBGRAPH::m_sheet, SCH_CONNECTION::Members(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_SHEET_PIN_T, and SCH_TEXT_T.
Referenced by RunERC().
|
private |
Checks one subgraph for conflicting bus entry to bus connections.
For example, a wire with label "A0" is connected to a bus labeled "D[8..0]"
Will also check for mistakes related to bus group names, for example: A bus group named "USB{DP DM}" should have bus entry connections like "USB.DP" but someone might accidentally just enter "DP"
aSubgraph | is the subgraph to examine |
Definition at line 2530 of file connection_graph.cpp.
References _, SCH_SCREEN::Append(), BUS, SCH_ITEM::Connection(), ERC_ITEM::Create(), ERCE_BUS_ENTRY_CONFLICT, Format(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_BUS_ENTRY_BASE::GetPosition(), SCH_SHEET_PATH::LastScreen(), SCH_BUS_WIRE_ENTRY::m_connected_bus_item, CONNECTION_SUBGRAPH::m_driver, CONNECTION_SUBGRAPH::m_driver_connection, CONNECTION_SUBGRAPH::m_items, CONNECTION_SUBGRAPH::m_sheet, SCH_CONNECTION::Members(), SCH_CONNECTION::Name(), CONNECTION_SUBGRAPH::POWER_PIN, SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, EDA_ITEM::Type(), and UnescapeString().
Referenced by RunERC().
|
private |
Checks one subgraph for conflicting connections between net and bus labels.
For example, a net wire connected to a bus port/pin, or vice versa
aSubgraph | is the subgraph to examine |
Definition at line 2404 of file connection_graph.cpp.
References SCH_SCREEN::Append(), SCH_CONNECTION::ConfigureFromLabel(), ERC_ITEM::Create(), CTX_NETNAME, ERCE_BUS_TO_NET_CONFLICT, EscapeString(), SCH_ITEM::GetLayer(), EDA_ITEM::GetPosition(), SCH_CONNECTION::IsBus(), SCH_SHEET_PATH::LastScreen(), LAYER_BUS, CONNECTION_SUBGRAPH::m_items, CONNECTION_SUBGRAPH::m_sheet, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_LINE_T, SCH_SHEET_PIN_T, text, and EDA_ITEM::Type().
Referenced by RunERC().
|
private |
Checks one subgraph for floating wires.
Will throw an error for any subgraph that consists of just wires with no driver
aSubgraph | is the subgraph to examine |
Definition at line 2801 of file connection_graph.cpp.
References SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_WIRE_DANGLING, SCH_ITEM::GetLayer(), SCH_SHEET_PATH::LastScreen(), LAYER_WIRE, CONNECTION_SUBGRAPH::m_driver, CONNECTION_SUBGRAPH::m_items, CONNECTION_SUBGRAPH::m_sheet, SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, and EDA_ITEM::Type().
Referenced by RunERC().
|
private |
Checks that a hierarchical sheet has at least one matching label inside the sheet for each port on the parent sheet object.
aSubgraph | is the subgraph to examine |
Definition at line 2993 of file connection_graph.cpp.
References _, SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_HIERACHICAL_LABEL, ERCE_PIN_NOT_CONNECTED, SCHEMATIC::ErcSettings(), Format(), SCH_SHEET::GetPins(), SCH_SHEET::GetScreen(), EDA_TEXT::GetText(), ERC_SETTINGS::IsTestEnabled(), SCH_SCREEN::Items(), m_schematic, m_sheetList, pin, SCH_HIER_LABEL_T, SCH_SHEET_T, and UnescapeString().
Referenced by RunERC().
|
private |
Checks one subgraph for proper connection of labels.
Labels should be connected to something
aSubgraph | is the subgraph to examine |
aCheckGlobalLabels | is true if global labels should be checked for loneliness |
Definition at line 2839 of file connection_graph.cpp.
References SCH_SCREEN::Append(), ERC_ITEM::Create(), CTX_NETNAME, ERCE_GLOBLABEL, ERCE_LABEL_NOT_CONNECTED, SCHEMATIC::ErcSettings(), EscapeString(), SCH_CONNECTION::IsBus(), ERC_SETTINGS::IsTestEnabled(), SCH_SHEET_PATH::LastScreen(), CONNECTION_SUBGRAPH::m_driver_connection, CONNECTION_SUBGRAPH::m_drivers, CONNECTION_SUBGRAPH::m_hier_parent, CONNECTION_SUBGRAPH::m_items, m_local_label_cache, CONNECTION_SUBGRAPH::m_multiple_drivers, m_net_name_to_subgraphs_map, CONNECTION_SUBGRAPH::m_no_connect, m_schematic, CONNECTION_SUBGRAPH::m_sheet, CONNECTION_SUBGRAPH::m_strong_driver, name, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, SCH_SHEET_PIN_T, text, and EDA_ITEM::Type().
Referenced by RunERC().
|
private |
If the subgraph has multiple drivers of equal priority that are graphically connected, ResolveDrivers() will have stored the second driver for use by this function, which actually creates the markers.
aSubgraph | is the subgraph to examine |
Definition at line 2331 of file connection_graph.cpp.
References _, SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_DRIVER_CONFLICT, Format(), CONNECTION_SUBGRAPH::GetNameForDriver(), EDA_ITEM::GetPosition(), SCH_SHEET_PATH::LastScreen(), CONNECTION_SUBGRAPH::m_driver, CONNECTION_SUBGRAPH::m_drivers, CONNECTION_SUBGRAPH::m_first_driver, CONNECTION_SUBGRAPH::m_multiple_drivers, CONNECTION_SUBGRAPH::m_second_driver, CONNECTION_SUBGRAPH::m_sheet, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, and EDA_ITEM::Type().
Referenced by RunERC().
|
private |
Checks one subgraph for proper presence or absence of no-connect symbols.
A pin with a no-connect symbol should not have any connections A pin without a no-connect symbol should have at least one connection
aSubgraph | is the subgraph to examine |
Definition at line 2628 of file connection_graph.cpp.
References SCH_SCREEN::Append(), ERC_ITEM::Create(), ERCE_NOCONNECT_CONNECTED, ERCE_NOCONNECT_NOT_CONNECTED, ERCE_PIN_NOT_CONNECTED, SCHEMATIC::ErcSettings(), CONNECTION_SUBGRAPH::GetDriverPriority(), EDA_ITEM::GetPosition(), SCH_PIN::GetTransformedPosition(), ERC_SETTINGS::IsTestEnabled(), SCH_SHEET_PATH::LastScreen(), m_global_label_cache, CONNECTION_SUBGRAPH::m_items, m_local_label_cache, CONNECTION_SUBGRAPH::m_no_connect, m_schematic, CONNECTION_SUBGRAPH::m_sheet, name, CONNECTION_SUBGRAPH::NONE, pin, PT_NC, PT_NIC, PT_POWER_IN, SCH_JUNCTION_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_PIN_T, and EDA_ITEM::Type().
Referenced by RunERC().
CONNECTION_SUBGRAPH * CONNECTION_GRAPH::FindFirstSubgraphByName | ( | const wxString & | aNetName | ) |
Retrieves a subgraph for the given net name, if one exists.
Searches every sheet
aNetName | is the full net name to search for |
Definition at line 2208 of file connection_graph.cpp.
References m_net_name_to_subgraphs_map.
CONNECTION_SUBGRAPH * CONNECTION_GRAPH::FindSubgraphByName | ( | const wxString & | aNetName, |
const SCH_SHEET_PATH & | aPath | ||
) |
Returns the subgraph for a given net name on a given sheet.
aNetName | is the local net name to look for |
aPath | is a sheet path to look on |
Definition at line 2187 of file connection_graph.cpp.
References CONNECTION_SUBGRAPH::m_absorbed, CONNECTION_SUBGRAPH::m_driver_connection, m_net_name_to_subgraphs_map, CONNECTION_SUBGRAPH::m_sheet, and SCH_CONNECTION::Name().
Referenced by NETLIST_EXPORTER_BASE::CreatePinList(), and NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol().
|
private |
Iterate through the invisible power pins to collect the global labels as drivers.
Definition at line 952 of file connection_graph.cpp.
References CONNECTION_SUBGRAPH::AddItem(), assignNewNetCode(), CONNECTION_SUBGRAPH::GetNetName(), CONNECTION_SUBGRAPH::m_code, m_driver_subgraphs, m_invisible_power_pins, m_last_subgraph_code, m_net_code_to_subgraphs_map, CONNECTION_SUBGRAPH::m_sheet, m_subgraphs, pin, CONNECTION_SUBGRAPH::ResolveDrivers(), SCH_CONNECTION::SetName(), SCH_CONNECTION::SetNetCode(), SCH_CONNECTION::SetSubgraphCode(), and SCH_CONNECTION::SubgraphCode().
Referenced by buildConnectionGraph().
std::shared_ptr< BUS_ALIAS > CONNECTION_GRAPH::GetBusAlias | ( | const wxString & | aName | ) |
Returns a bus alias pointer for the given name if it exists (from cache)
CONNECTION_GRAPH caches these, they are owned by the SCH_SCREEN that the alias was defined on. The cache is only used to update the graph.
Definition at line 2132 of file connection_graph.cpp.
References m_bus_alias_cache.
Referenced by SCH_CONNECTION::AppendInfoToMsgPanel(), and SCH_CONNECTION::ConfigureFromLabel().
std::vector< const CONNECTION_SUBGRAPH * > CONNECTION_GRAPH::GetBusesNeedingMigration | ( | ) |
Determines which subgraphs have more than one conflicting bus label.
Definition at line 2140 of file connection_graph.cpp.
References SCH_ITEM::Connection(), ConnTrace, SCH_CONNECTION::IsBus(), SCH_CONNECTION::m_driver, m_subgraphs, and SCH_CONNECTION::Name().
Referenced by DIALOG_MIGRATE_BUSES::loadGraphData().
|
private |
Builds a new default connection for the given item based on its properties.
Handles strong drivers (power pins and labels) only
aItem | is an item that can generate a connection name |
aSubgraph | is used to determine the sheet to use and retrieve the cached name |
Definition at line 2023 of file connection_graph.cpp.
References CONNECTION_SUBGRAPH::GetNameForDriver(), CONNECTION_SUBGRAPH::m_sheet, pin, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, and EDA_ITEM::Type().
Referenced by processSubGraphs(), and propagateToNeighbors().
|
inline |
Definition at line 306 of file connection_graph.h.
References m_net_code_to_subgraphs_map.
Referenced by SCHEMATIC::GetNetClassAssignmentCandidates(), NETLIST_EXPORTER_XML::makeListOfNets(), ERC_TESTER::TestMultUnitPinConflicts(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().
CONNECTION_SUBGRAPH * CONNECTION_GRAPH::GetSubgraphForItem | ( | SCH_ITEM * | aItem | ) |
Definition at line 2221 of file connection_graph.cpp.
References CONNECTION_SUBGRAPH::m_absorbed, CONNECTION_SUBGRAPH::m_absorbed_by, and m_item_to_subgraph_map.
Referenced by inheritNetclass(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().
|
staticprivate |
Search for a matching bus member inside a bus connection.
For bus groups, this returns a bus member that matches aSearch by name. For bus vectors, this returns a bus member that matches by vector index.
aBusConnection | is the bus connection to search |
aSearch | is the net connection to search for |
Definition at line 2062 of file connection_graph.cpp.
References BUS, SCH_CONNECTION::IsBus(), SCH_CONNECTION::LocalName(), SCH_CONNECTION::Members(), SCH_CONNECTION::Type(), and SCH_CONNECTION::VectorIndex().
Referenced by buildConnectionGraph(), and propagateToNeighbors().
|
private |
Process all subgraphs to assign netcodes and merge subgraphs based on labels.
Definition at line 1013 of file connection_graph.cpp.
References assignNetCodesToBus(), assignNewNetCode(), BUS, BUS_GROUP, ConnTrace, alg::delete_matching(), Format(), getDefaultConnection(), SCH_CONNECTION::IsBus(), m_bus_name_to_code_map, m_driver_subgraphs, m_last_bus_code, m_net_name_to_subgraphs_map, m_sheet_to_subgraphs_map, MILLIMETRES, name, SCH_CONNECTION::Name(), pin, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_CONNECTION::SetBusCode(), and EDA_ITEM::Type().
Referenced by buildConnectionGraph().
|
private |
Updates all neighbors of a subgraph with this one's connectivity info.
If this subgraph contains hierarchical links, this method will descent the hierarchy and propagate the connectivity across all linked sheets.
Definition at line 1711 of file connection_graph.cpp.
References SCH_CONNECTION::Clone(), ConnTrace, getDefaultConnection(), CONNECTION_SUBGRAPH::GetDriverPriority(), CONNECTION_SUBGRAPH::GetNameForDriver(), CONNECTION_SUBGRAPH::HIER_LABEL, SCH_CONNECTION::IsBus(), kv, SCH_CONNECTION::LocalName(), CONNECTION_SUBGRAPH::m_absorbed, CONNECTION_SUBGRAPH::m_absorbed_by, CONNECTION_SUBGRAPH::m_code, CONNECTION_SUBGRAPH::m_dirty, CONNECTION_SUBGRAPH::m_driver, CONNECTION_SUBGRAPH::m_driver_connection, CONNECTION_SUBGRAPH::m_drivers, CONNECTION_SUBGRAPH::m_hier_parent, CONNECTION_SUBGRAPH::m_hier_pins, CONNECTION_SUBGRAPH::m_hier_ports, CONNECTION_SUBGRAPH::m_multiple_drivers, CONNECTION_SUBGRAPH::m_sheet, m_sheet_to_subgraphs_map, CONNECTION_SUBGRAPH::m_strong_driver, matchBusMember(), SCH_CONNECTION::Name(), path, pin, CONNECTION_SUBGRAPH::POWER_PIN, SCH_SHEET_PATH::push_back(), recacheSubgraphName(), SCH_SHEET_PATH::size(), and SCH_CONNECTION::Type().
Referenced by buildConnectionGraph().
|
private |
Definition at line 2114 of file connection_graph.cpp.
References ConnTrace, alg::delete_matching(), CONNECTION_SUBGRAPH::m_driver_connection, m_net_name_to_subgraphs_map, and SCH_CONNECTION::Name().
Referenced by propagateToNeighbors().
void CONNECTION_GRAPH::Recalculate | ( | const SCH_SHEET_LIST & | aSheetList, |
bool | aUnconditional = false , |
||
std::function< void(SCH_ITEM *)> * | aChangedItemHandler = nullptr |
||
) |
Updates the connection graph for the given list of sheets.
aSheetList | is the list of possibly modified sheets |
aUnconditional | is true if an unconditional full recalculation should be done |
aChangedItemHandler | an optional handler to receive any changed items |
Definition at line 440 of file connection_graph.cpp.
References buildConnectionGraph(), ConnProfileMask, ADVANCED_CFG::GetCfg(), m_allowRealTime, m_items, m_sheetList, PROF_TIMER::msecs(), Reset(), PROF_TIMER::Show(), PROF_TIMER::Stop(), and updateItemConnectivity().
Referenced by TEST_NETLISTS_FIXTURE::loadSchematic(), SCH_EDIT_FRAME::RecalculateConnections(), and SCH_SCREENS::UpdateSymbolLinks().
void CONNECTION_GRAPH::Reset | ( | ) |
Definition at line 416 of file connection_graph.cpp.
References m_bus_alias_cache, m_bus_name_to_code_map, m_driver_subgraphs, m_global_label_cache, m_invisible_power_pins, m_item_to_subgraph_map, m_items, m_last_bus_code, m_last_net_code, m_last_subgraph_code, m_local_label_cache, m_net_code_to_subgraphs_map, m_net_name_to_code_map, m_net_name_to_subgraphs_map, m_sheet_to_subgraphs_map, and m_subgraphs.
Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), Recalculate(), SCHEMATIC::Reset(), SCHEMATIC::SetRoot(), and ~CONNECTION_GRAPH().
|
private |
Finds all subgraphs in the connection graph and calls ResolveDrivers() in parallel.
Definition at line 809 of file connection_graph.cpp.
References m_driver_subgraphs, m_subgraphs, pin, PT_NC, SCH_BUS_WIRE_ENTRY_T, SCH_NO_CONNECT_T, and SCH_PIN_T.
Referenced by buildConnectionGraph().
int CONNECTION_GRAPH::RunERC | ( | ) |
Runs electrical rule checks on the connectivity graph.
Precondition: graph is up-to-date
NOTE:
We could check that labels attached to bus subgraphs follow the proper format (i.e. actually define a bus).
This check doesn't need to be here right now because labels won't actually be connected to bus wires if they aren't in the right format due to their TestDanglingEnds() implementation.
Definition at line 2233 of file connection_graph.cpp.
References ercCheckBusToBusConflicts(), ercCheckBusToBusEntryConflicts(), ercCheckBusToNetConflicts(), ercCheckFloatingWires(), ercCheckHierSheets(), ercCheckLabels(), ercCheckMultipleDrivers(), ercCheckNoConnects(), ERCE_BUS_ENTRY_CONFLICT, ERCE_BUS_TO_BUS_CONFLICT, ERCE_BUS_TO_NET_CONFLICT, ERCE_DRIVER_CONFLICT, ERCE_GLOBLABEL, ERCE_HIERACHICAL_LABEL, ERCE_LABEL_NOT_CONNECTED, ERCE_NOCONNECT_CONNECTED, ERCE_NOCONNECT_NOT_CONNECTED, ERCE_PIN_NOT_CONNECTED, ERCE_WIRE_DANGLING, SCHEMATIC::ErcSettings(), ERC_SETTINGS::IsTestEnabled(), m_schematic, and m_subgraphs.
Referenced by DIALOG_ERC::testErc().
|
inline |
Definition at line 265 of file connection_graph.h.
References m_schematic.
|
private |
Updates the graphical connectivity between items (i.e.
where they touch) The items passed in must be on the same sheet.
In the first phase, all items in aItemList have their connections initialized for the given sheet (since they may have connections on more than one sheet, and each needs to be calculated individually). The graphical connection points for the item are added to a map that stores (x, y) -> [list of items].
Any item that is stored in the list of items that have a connection point at a given (x, y) location will eventually be electrically connected. This means that we can't store SCH_SYMBOLs in this map – we must store a structure that links a specific pin on a symbol back to that symbol: a SCH_PIN_CONNECTION. This wrapper class is a convenience for linking a pin and symbol to a specific (x, y) point.
In the second phase, we iterate over each value in the map, which is a vector of items that have overlapping connection points. After some checks to ensure that the items should actually connect, the items are linked together using ConnectedItems().
As a side effect, items are loaded into m_items for BuildConnectionGraph()
aSheet | is the path to the sheet of all items in the list |
aItemList | is a list of items to consider |
Definition at line 498 of file connection_graph.cpp.
References SCH_ITEM::AddConnectionTo(), BUS, SCH_ITEM::ConnectedItems(), SCH_ITEM::ConnectionPropagatesTo(), SCH_SCREEN::GetBus(), SCH_ITEM::GetLayer(), SCH_SYMBOL::GetPins(), SCH_SHEET_PATH::LastScreen(), LAYER_BUS, LAYER_BUS_JUNCTION, LAYER_JUNCTION, m_invisible_power_pins, m_items, NET, pin, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_JUNCTION_T, SCH_LINE_T, SCH_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_ITEM::SetLayer(), SCH_CONNECTION::SetType(), and EDA_ITEM::Type().
Referenced by Recalculate().
|
static |
Definition at line 535 of file connection_graph.h.
Referenced by SCH_CONNECTION::AppendInfoToMsgPanel(), SCH_EDITOR_CONTROL::AssignNetclass(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), SCH_EDITOR_CONTROL::DrawSheetOnClipboard(), SCH_EDITOR_CONTROL::HighlightNetCursor(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::OnModify(), SCH_EDITOR_CONTROL::Plot(), SCH_EDITOR_CONTROL::Print(), Recalculate(), and BUS_UNFOLD_MENU::update().
|
private |
Definition at line 555 of file connection_graph.h.
Referenced by buildConnectionGraph(), GetBusAlias(), and Reset().
|
private |
Definition at line 559 of file connection_graph.h.
Referenced by processSubGraphs(), and Reset().
|
private |
Definition at line 548 of file connection_graph.h.
Referenced by buildConnectionGraph(), collectAllDriverValues(), generateInvisiblePinSubGraphs(), processSubGraphs(), Reset(), and resolveAllDrivers().
|
private |
Definition at line 561 of file connection_graph.h.
Referenced by collectAllDriverValues(), ercCheckNoConnects(), and Reset().
|
private |
Definition at line 553 of file connection_graph.h.
Referenced by generateInvisiblePinSubGraphs(), Reset(), and updateItemConnectivity().
|
private |
Definition at line 568 of file connection_graph.h.
Referenced by buildItemSubGraphs(), GetSubgraphForItem(), and Reset().
|
private |
Definition at line 542 of file connection_graph.h.
Referenced by buildItemSubGraphs(), Recalculate(), Reset(), and updateItemConnectivity().
|
private |
Definition at line 574 of file connection_graph.h.
Referenced by processSubGraphs(), and Reset().
|
private |
Definition at line 572 of file connection_graph.h.
Referenced by assignNewNetCode(), and Reset().
|
private |
Definition at line 576 of file connection_graph.h.
Referenced by buildItemSubGraphs(), generateInvisiblePinSubGraphs(), and Reset().
|
private |
Definition at line 564 of file connection_graph.h.
Referenced by collectAllDriverValues(), ercCheckLabels(), ercCheckNoConnects(), and Reset().
|
private |
Definition at line 570 of file connection_graph.h.
Referenced by buildConnectionGraph(), generateInvisiblePinSubGraphs(), GetNetMap(), and Reset().
|
private |
Definition at line 557 of file connection_graph.h.
Referenced by assignNewNetCode(), and Reset().
|
private |
Definition at line 566 of file connection_graph.h.
Referenced by buildConnectionGraph(), collectAllDriverValues(), ercCheckLabels(), FindFirstSubgraphByName(), FindSubgraphByName(), processSubGraphs(), recacheSubgraphName(), and Reset().
|
private |
The schematic this graph represents.
Definition at line 578 of file connection_graph.h.
Referenced by buildConnectionGraph(), ercCheckHierSheets(), ercCheckLabels(), ercCheckNoConnects(), RunERC(), and SetSchematic().
|
private |
Definition at line 551 of file connection_graph.h.
Referenced by buildConnectionGraph(), processSubGraphs(), propagateToNeighbors(), and Reset().
|
private |
Definition at line 539 of file connection_graph.h.
Referenced by ercCheckHierSheets(), and Recalculate().
|
private |
Definition at line 545 of file connection_graph.h.
Referenced by buildConnectionGraph(), buildItemSubGraphs(), generateInvisiblePinSubGraphs(), GetBusesNeedingMigration(), Reset(), resolveAllDrivers(), and RunERC().