KiCad PCB EDA Suite
Loading...
Searching...
No Matches
connection_graph.cpp File Reference
#include <algorithm>
#include <list>
#include <future>
#include <vector>
#include <unordered_map>
#include <app_monitor.h>
#include <core/profile.h>
#include <core/kicad_algo.h>
#include <common.h>
#include <erc/erc.h>
#include <pin_type.h>
#include <sch_bus_entry.h>
#include <sch_symbol.h>
#include <sch_edit_frame.h>
#include <sch_line.h>
#include <sch_marker.h>
#include <sch_pin.h>
#include <sch_rule_area.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_sheet_pin.h>
#include <sch_text.h>
#include <schematic.h>
#include <symbol.h>
#include <connection_graph.h>
#include <project/project_file.h>
#include <project/net_settings.h>
#include <widgets/ui_common.h>
#include <string_utils.h>
#include <thread_pool.h>
#include <wx/log.h>
#include <advanced_config.h>

Go to the source code of this file.

Functions

static int compareDrivers (SCH_ITEM *aA, SCH_CONNECTION *aAConn, const wxString &aAName, SCH_ITEM *aB, SCH_CONNECTION *aBConn, const wxString &aBName)
 Unified driver ranking used by CONNECTION_SUBGRAPH::ResolveDrivers (within a single subgraph) and by buildConnectionGraph's global-label transitive-closure pre-pass (across subgraphs).
 

Variables

static const wxChar DanglingProfileMask [] = wxT( "CONN_PROFILE" )
 Flag to enable connectivity profiling.
 
static const wxChar ConnTrace [] = wxT( "CONN" )
 Flag to enable connectivity tracing.
 

Function Documentation

◆ compareDrivers()

static int compareDrivers ( SCH_ITEM * aA,
SCH_CONNECTION * aAConn,
const wxString & aAName,
SCH_ITEM * aB,
SCH_CONNECTION * aBConn,
const wxString & aBName )
static

Unified driver ranking used by CONNECTION_SUBGRAPH::ResolveDrivers (within a single subgraph) and by buildConnectionGraph's global-label transitive-closure pre-pass (across subgraphs).

Returns -1 if aA wins, +1 if aB wins, 0 if the two are tied.

Rules are applied in priority order and each rule short-circuits if it distinguishes the candidates.

  1. Higher CONNECTION_SUBGRAPH driver priority wins. ResolveDrivers pre-filters candidates to a single priority, so this rule is a no-op there; the pre-pass relies on it to break ties across subgraphs with different primary-driver priorities.
  2. For two bus connections, the superset wins. Without this, a wider bus can be silently canonicalized to a narrower one and lose members.
  3. For two pins, a pin on a global power symbol beats a local power pin beats a regular pin.
  4. For two sheet pins, an OUTPUT shape beats an INPUT shape.
  5. Names containing "-Pad" are treated as low quality and demoted.
  6. Alphabetical fallback for deterministic ordering.

Definition at line 151 of file connection_graph.cpp.

References CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_PIN::GetLibPin(), SCH_ITEM::GetParentSymbol(), SCH_LABEL_BASE::GetShape(), SCH_CONNECTION::IsBus(), SYMBOL::IsGlobalPower(), SYMBOL::IsLocalPower(), SCH_CONNECTION::IsSubsetOf(), L_OUTPUT, SCH_PIN_T, SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by CONNECTION_GRAPH::buildConnectionGraph(), and CONNECTION_SUBGRAPH::ResolveDrivers().