KiCad PCB EDA Suite
eeschema/erc.cpp File Reference
#include <fctsys.h>
#include <sch_draw_panel.h>
#include <kicad_string.h>
#include <sch_edit_frame.h>
#include <netlist_object.h>
#include <lib_pin.h>
#include <erc.h>
#include <sch_marker.h>
#include <sch_sheet.h>
#include <sch_reference_list.h>
#include <wx/ffile.h>

Go to the source code of this file.

Classes

struct  compare_labels
 
struct  compare_label_names
 
struct  compare_paths
 

Functions

int TestDuplicateSheetNames (bool aCreateMarker)
 Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated). More...
 
int TestConflictingBusAliases ()
 Checks that there are not conflicting bus alias definitions in the schematic. More...
 
int TestMultiunitFootprints (SCH_SHEET_LIST &aSheetList)
 Test if all units of each multiunit component have the same footprint assigned. More...
 
void Diagnose (NETLIST_OBJECT *aNetItemRef, NETLIST_OBJECT *aNetItemTst, int aMinConn, int aDiag)
 Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef or between aNetItemRef and aNetItemTst. More...
 
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...
 
static int countIndenticalLabels (std::vector< NETLIST_OBJECT * > &aList, NETLIST_OBJECT *aRef)
 
static void SimilarLabelsDiagnose (NETLIST_OBJECT *aItemA, NETLIST_OBJECT *aItemB)
 

Variables

const wxString CommentERC_H []
 
const wxString CommentERC_V []
 
int PinMap [ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
 
int DefaultPinMap [ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
 Default Look up table which gives the ERC error level for a pair of connected pins Same as DiagErc, but cannot be modified. More...
 
static int MinimalReq [ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
 Look up table which gives the minimal drive for a pair of connected pins on a net. More...
 

Function Documentation

◆ countIndenticalLabels()

static int countIndenticalLabels ( std::vector< NETLIST_OBJECT * > &  aList,
NETLIST_OBJECT aRef 
)
static

Definition at line 632 of file eeschema/erc.cpp.

633 {
634  int count = 0;
635 
636  if( aRef->IsLabelGlobal() )
637  {
638  for( auto i : aList)
639  {
640  if( i->IsLabelGlobal() && i->m_Label == aRef->m_Label )
641  count++;
642  }
643  }
644  else
645  {
646  for( auto i : aList)
647  {
648  if( i->m_Label == aRef->m_Label && i->m_SheetPath.Path() == aRef->m_SheetPath.Path() )
649  count++;
650  }
651  }
652 
653  return count;
654 }
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SHEET_PATH m_SheetPath
bool IsLabelGlobal() const
Function IsLabelGlobal.

References NETLIST_OBJECT::IsLabelGlobal(), NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_SheetPath, and SCH_SHEET_PATH::Path().

Referenced by NETLIST_OBJECT_LIST::TestforSimilarLabels().

◆ Diagnose()

void Diagnose ( NETLIST_OBJECT NetItemRef,
NETLIST_OBJECT NetItemTst,
int  MinConnexion,
int  Diag 
)

Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef or between aNetItemRef and aNetItemTst.

if MinConn < 0: this is an error on labels

Definition at line 304 of file eeschema/erc.cpp.

305 {
306  if( aDiag == OK || aMinConn < 1 || aNetItemRef->m_Type != NETLIST_ITEM::PIN )
307  return;
308 
309  SCH_PIN* pin = static_cast<SCH_PIN*>( aNetItemRef->m_Comp );
310 
311  /* Create new marker for ERC error. */
313  aNetItemRef->m_SheetPath.LastScreen()->Append( marker );
314 
315  if( aNetItemTst == NULL)
316  {
317  if( aMinConn == NOD ) /* Nothing driving the net. */
318  {
319  marker->SetData( ERCE_PIN_NOT_DRIVEN, aNetItemRef->m_Start,
320  pin->GetDescription( &aNetItemRef->m_SheetPath ), pin->m_Uuid );
321  return;
322  }
323  }
324 
325  if( aNetItemTst && aNetItemTst->m_Type == NETLIST_ITEM::PIN ) /* Error between 2 pins */
326  {
327  SCH_PIN* pinB = static_cast<SCH_PIN*>( aNetItemTst->m_Comp );
328 
330  aNetItemRef->m_Start,
331  pin->GetDescription( &aNetItemRef->m_SheetPath ), pin->m_Uuid,
332  pinB->GetDescription( &aNetItemTst->m_SheetPath ), pinB->m_Uuid );
333  }
334 }
wxString GetDescription(const SCH_SHEET_PATH *aSheet)
Definition: sch_pin.cpp:84
SCH_SHEET_PATH m_SheetPath
EDA_ITEM * m_Comp
Definition: erc.h:42
Definition: erc.h:44
#define NULL
const KIID m_Uuid
Definition: base_struct.h:169
SCH_SCREEN * LastScreen()
Function LastScreen.
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:175
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91
NETLIST_ITEM m_Type
#define NOD
Definition: erc.h:82

References SCH_SCREEN::Append(), ERCE_PIN_NOT_DRIVEN, ERCE_PIN_TO_PIN_ERROR, ERCE_PIN_TO_PIN_WARNING, ERR, SCH_PIN::GetDescription(), SCH_SHEET_PATH::LastScreen(), NETLIST_OBJECT::m_Comp, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, EDA_ITEM::m_Uuid, MARKER_BASE::MARKER_ERC, NOD, NULL, OK, PIN, and MARKER_BASE::SetData().

Referenced by TestOthersItems().

◆ SimilarLabelsDiagnose()

static void SimilarLabelsDiagnose ( NETLIST_OBJECT aItemA,
NETLIST_OBJECT aItemB 
)
static

Definition at line 658 of file eeschema/erc.cpp.

659 {
660  // Create new marker for ERC.
663  aItemA->m_Comp, aItemB->m_Comp );
664  aItemA->m_SheetPath.LastScreen()->Append( marker );
665 }
SCH_SHEET_PATH m_SheetPath
EDA_ITEM * m_Comp
SCH_SCREEN * LastScreen()
Function LastScreen.
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:175
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91

References SCH_SCREEN::Append(), ERCE_SIMILAR_LABELS, SCH_SHEET_PATH::LastScreen(), NETLIST_OBJECT::m_Comp, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Start, MARKER_BASE::MARKER_ERC, MARKER_BASE::SetData(), and UNSCALED.

Referenced by NETLIST_OBJECT_LIST::TestforSimilarLabels().

◆ TestConflictingBusAliases()

int TestConflictingBusAliases ( )

Checks that there are not 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 201 of file eeschema/erc.cpp.

202 {
203  wxString msg;
204  int err_count = 0;
205  SCH_SCREENS screens;
206  std::vector< std::shared_ptr<BUS_ALIAS> > aliases;
207 
208  for( auto screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
209  {
210  std::unordered_set< std::shared_ptr<BUS_ALIAS> > screen_aliases = screen->GetBusAliases();
211 
212  for( const std::shared_ptr<BUS_ALIAS>& alias : screen_aliases )
213  {
214  for( const std::shared_ptr<BUS_ALIAS>& test : aliases )
215  {
216  if( alias->GetName() == test->GetName() && alias->Members() != test->Members() )
217  {
218  msg.Printf( _( "Bus alias %s has conflicting definitions on %s and %s" ),
219  alias->GetName(),
220  alias->GetParent()->GetFileName(),
221  test->GetParent()->GetFileName() );
222 
224  marker->SetData( ERCE_BUS_ALIAS_CONFLICT, wxPoint(), msg );
225  test->GetParent()->Append( marker );
226 
227  ++err_count;
228  }
229  }
230  }
231 
232  aliases.insert( aliases.end(), screen_aliases.begin(), screen_aliases.end() );
233  }
234 
235  return err_count;
236 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:970
#define NULL
#define _(s)
Definition: 3d_actions.cpp:33
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:959
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:491

References _, ERCE_BUS_ALIAS_CONFLICT, SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), MARKER_BASE::MARKER_ERC, NULL, and MARKER_BASE::SetData().

Referenced by DIALOG_ERC::TestErc().

◆ TestDuplicateSheetNames()

int TestDuplicateSheetNames ( bool  aCreateMarker)

Function TestDuplicateSheetNames( ) 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 157 of file eeschema/erc.cpp.

158 {
159  SCH_SCREEN* screen;
160  int err_count = 0;
161  SCH_SCREENS screenList; // Created the list of screen
162 
163  for( screen = screenList.GetFirst(); screen != NULL; screen = screenList.GetNext() )
164  {
165  std::vector<SCH_SHEET*> list;
166 
167  for( SCH_ITEM* item : screen->Items().OfType( SCH_SHEET_T ) )
168  list.push_back( static_cast<SCH_SHEET*>( item ) );
169 
170  for( size_t i = 0; i < list.size(); i++ )
171  {
172  SCH_SHEET* item = list[i];
173 
174  for( size_t j = i + 1; j < list.size(); j++ )
175  {
176  SCH_SHEET* test_item = list[j];
177 
178  // We have found a second sheet: compare names
179  // we are using case insensitive comparison to avoid mistakes between
180  // similar names like Mysheet and mysheet
181  if( item->GetName().CmpNoCase( test_item->GetName() ) == 0 )
182  {
183  if( aCreateMarker )
184  {
187  item->GetPosition(), item, test_item );
188  screen->Append( marker );
189  }
190 
191  err_count++;
192  }
193  }
194  }
195  }
196 
197  return err_count;
198 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:970
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
wxString GetName() const
Definition: sch_sheet.h:280
#define NULL
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:565
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:215
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:175
EE_RTREE & Items()
Definition: sch_screen.h:127
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:959
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:491

References SCH_SCREEN::Append(), ERCE_DUPLICATE_SHEET_NAME, SCH_SCREENS::GetFirst(), SCH_SHEET::GetName(), SCH_SCREENS::GetNext(), SCH_SHEET::GetPosition(), SCH_SCREEN::Items(), MARKER_BASE::MARKER_ERC, NULL, EE_RTREE::OfType(), SCH_SHEET_T, MARKER_BASE::SetData(), and UNSCALED.

Referenced by highlightNet(), SCH_EDIT_FRAME::prepareForNetlist(), and DIALOG_ERC::TestErc().

◆ TestMultiunitFootprints()

int TestMultiunitFootprints ( SCH_SHEET_LIST aSheetList)

Test if all units of each multiunit component have the same footprint assigned.

Parameters
aSheetListcontains components to be validated.
Returns
The error count.

Definition at line 239 of file eeschema/erc.cpp.

240 {
241  int errors = 0;
242  std::map<wxString, LIB_ID> footprints;
244  aSheetList.GetMultiUnitComponents( refMap, true );
245 
246  for( auto& component : refMap )
247  {
248  auto& refList = component.second;
249 
250  if( refList.GetCount() == 0 )
251  {
252  wxFAIL; // it should not happen
253  continue;
254  }
255 
256  // Reference footprint
257  wxString fp;
258  wxString unitName;
259  KIID unitID;
260 
261  for( unsigned i = 0; i < component.second.GetCount(); ++i )
262  {
263  SCH_COMPONENT* unit = refList.GetItem( i ).GetComp();
264  SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
265  fp = unit->GetField( FOOTPRINT )->GetText();
266 
267  if( !fp.IsEmpty() )
268  {
269  unitName = unit->GetRef( &sheetPath, true );
270  unitID = unit->m_Uuid;
271  break;
272  }
273  }
274 
275  for( unsigned i = 0; i < component.second.GetCount(); ++i )
276  {
277  SCH_REFERENCE& secondRef = refList.GetItem( i );
278  SCH_COMPONENT* secondUnit = secondRef.GetComp();
279  SCH_SHEET_PATH sheetPath = secondRef.GetSheetPath();
280 
281  const wxString secondFp = secondUnit->GetField( FOOTPRINT )->GetText();
282  wxString secondName = secondUnit->GetRef( &sheetPath, true );
283  KIID secondID = secondUnit->m_Uuid;
284 
285  if( !secondFp.IsEmpty() && fp != secondFp )
286  {
287  wxString description = _( "%s has '%s' assigned" );
288 
290  marker->SetData( ERCE_DIFFERENT_UNIT_FP, secondUnit->GetPosition(),
291  wxString::Format( description, unitName, fp ), unitID,
292  wxString::Format( description, secondName, secondFp ), secondID );
293  secondRef.GetSheetPath().LastScreen()->Append( marker );
294 
295  ++errors;
296  }
297  }
298  }
299 
300  return errors;
301 }
const SCH_SHEET_PATH & GetSheetPath() const
SCH_COMPONENT * GetComp() const
Field Name Module PCB, i.e. "16DIP300".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
Definition: common.h:65
SCH_SHEET_PATH.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false)
Return the reference for the given sheet path.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Type SCH_MULTI_UNIT_REFERENCE_MAP is used to create a map of reference designators for multi-unit par...
void GetMultiUnitComponents(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true)
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
const KIID m_Uuid
Definition: base_struct.h:169
SCH_SCREEN * LastScreen()
Function LastScreen.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:175
#define _(s)
Definition: 3d_actions.cpp:33
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:99
wxPoint GetPosition() const override
Function GetPosition.
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123
SCH_REFERENCE is used as a helper to define a component's reference designator in a schematic.

References _, SCH_SCREEN::Append(), ERCE_DIFFERENT_UNIT_FP, FOOTPRINT, Format(), SCH_REFERENCE::GetComp(), SCH_COMPONENT::GetField(), SCH_SHEET_LIST::GetMultiUnitComponents(), SCH_COMPONENT::GetPosition(), SCH_COMPONENT::GetRef(), SCH_REFERENCE::GetSheetPath(), EDA_TEXT::GetText(), SCH_SHEET_PATH::LastScreen(), EDA_ITEM::m_Uuid, MARKER_BASE::MARKER_ERC, and MARKER_BASE::SetData().

Referenced by DIALOG_ERC::TestErc().

◆ TestOthersItems()

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.

Parameters
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)

Definition at line 337 of file eeschema/erc.cpp.

339 {
340  unsigned netItemTst = aNetStart;
342  int erc = OK;
343 
344  /* Analysis of the table of connections. */
345  ELECTRICAL_PINTYPE ref_elect_type = aList->GetItem( aNetItemRef )->m_ElectricalPinType;
346  int local_minconn = NOC;
347 
348  if( ref_elect_type == ELECTRICAL_PINTYPE::PT_NC )
349  local_minconn = NPI;
350 
351  /* Test pins connected to NetItemRef */
352  for( ; ; netItemTst++ )
353  {
354  if( aNetItemRef == netItemTst )
355  continue;
356 
357  // We examine only a given net. We stop the search if the net changes
358  if( ( netItemTst >= aList->size() ) // End of list
359  || ( aList->GetItemNet( aNetItemRef ) !=
360  aList->GetItemNet( netItemTst ) ) ) // End of net
361  {
362  /* End net code found: minimum connection test. */
363  if( ( *aMinConnexion < NET_NC ) && ( local_minconn < NET_NC ) )
364  {
365  /* Not connected or not driven pin. */
366  bool seterr = true;
367 
368  if( local_minconn == NOC && aList->GetItemType( aNetItemRef ) == NETLIST_ITEM::PIN )
369  {
370  /* This pin is not connected: for multiple part per
371  * package, and duplicated pin,
372  * search for another instance of this pin
373  * this will be flagged only if all instances of this pin
374  * are not connected
375  * TODO test also if instances connected are connected to
376  * the same net
377  */
378  for( unsigned duplicate = 0; duplicate < aList->size(); duplicate++ )
379  {
380  if( aList->GetItemType( duplicate ) != NETLIST_ITEM::PIN )
381  continue;
382 
383  if( duplicate == aNetItemRef )
384  continue;
385 
386  if( aList->GetItem( aNetItemRef )->m_PinNum !=
387  aList->GetItem( duplicate )->m_PinNum )
388  continue;
389 
390  if( ( (SCH_COMPONENT*) aList->GetItem( aNetItemRef )->
391  m_Link )->GetRef( &aList->GetItem( aNetItemRef )-> m_SheetPath ) !=
392  ( (SCH_COMPONENT*) aList->GetItem( duplicate )->m_Link )
393  ->GetRef( &aList->GetItem( duplicate )->m_SheetPath ) )
394  continue;
395 
396  // Same component and same pin. Do dot create error for this pin
397  // if the other pin is connected (i.e. if duplicate net has another
398  // item)
399  if( (duplicate > 0)
400  && ( aList->GetItemNet( duplicate ) ==
401  aList->GetItemNet( duplicate - 1 ) ) )
402  seterr = false;
403 
404  if( (duplicate < aList->size() - 1)
405  && ( aList->GetItemNet( duplicate ) ==
406  aList->GetItemNet( duplicate + 1 ) ) )
407  seterr = false;
408  }
409  }
410 
411  if( seterr )
412  Diagnose( aList->GetItem( aNetItemRef ), NULL, local_minconn, WAR );
413 
414  *aMinConnexion = DRV; // inhibiting other messages of this
415  // type for the net.
416  }
417  return;
418  }
419 
420  switch( aList->GetItemType( netItemTst ) )
421  {
424  case NETLIST_ITEM::BUS:
426  case NETLIST_ITEM::LABEL:
435  break;
436 
438  local_minconn = std::max( NET_NC, local_minconn );
439  break;
440 
441  case NETLIST_ITEM::PIN:
442  jj = aList->GetItem( netItemTst )->m_ElectricalPinType;
443  local_minconn = std::max(
444  MinimalReq[static_cast<int>( ref_elect_type )][static_cast<int>( jj )],
445  local_minconn );
446 
447  if( netItemTst <= aNetItemRef )
448  break;
449 
450  if( erc == OK )
451  {
452  erc = PinMap[static_cast<int>( ref_elect_type )][static_cast<int>( jj )];
453 
454  if( erc != OK )
455  {
456  if( aList->GetConnectionType( netItemTst ) == NET_CONNECTION::UNCONNECTED )
457  {
458  Diagnose( aList->GetItem( aNetItemRef ), aList->GetItem( netItemTst ),
459  0, erc );
460  aList->SetConnectionType( netItemTst,
462  }
463  }
464  }
465 
466  break;
467  }
468  }
469 }
Definition: erc.h:43
void Diagnose(NETLIST_OBJECT *aNetItemRef, NETLIST_OBJECT *aNetItemTst, int aMinConn, int aDiag)
Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef or between aNe...
SCH_SHEET_PATH m_SheetPath
ELECTRICAL_PINTYPE m_ElectricalPinType
int GetItemNet(unsigned aIdx) const
Acces to an item net code.
#define DRV
Definition: erc.h:80
Definition: erc.h:42
#define NULL
NETLIST_ITEM GetItemType(unsigned aIdx) const
Acces to an item type.
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
#define NOC
Definition: erc.h:83
ELECTRICAL_PINTYPE
The component library pin object electrical types used in ERC tests.
Definition: pin_type.h:37
#define NPI
Definition: erc.h:79
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:99
void SetConnectionType(unsigned aIdx, NET_CONNECTION aFlg=NET_CONNECTION::UNCONNECTED)
Set the item connection type: UNCONNECTED Pin or Label not connected (error) NOCONNECT_SYMBOL_PRESENT...
NET_CONNECTION GetConnectionType(unsigned aIdx)
#define NET_NC
Definition: erc.h:81
not connected (must be left open)
SCH_ITEM * m_Link
int PinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
static int MinimalReq[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
Look up table which gives the minimal drive for a pair of connected pins on a net.

References BUS, BUSLABELMEMBER, Diagnose(), DRV, NETLIST_OBJECT_LIST::GetConnectionType(), NETLIST_OBJECT_LIST::GetItem(), NETLIST_OBJECT_LIST::GetItemNet(), NETLIST_OBJECT_LIST::GetItemType(), GLOBBUSLABELMEMBER, GLOBLABEL, HIERBUSLABELMEMBER, HIERLABEL, ITEM_UNSPECIFIED, JUNCTION, LABEL, NETLIST_OBJECT::m_ElectricalPinType, NETLIST_OBJECT::m_Link, NETLIST_OBJECT::m_PinNum, NETLIST_OBJECT::m_SheetPath, MinimalReq, NET_NC, NOC, NOCONNECT, NOCONNECT_SYMBOL_PRESENT, NPI, NULL, OK, PIN, PINLABEL, PinMap, PT_NC, SEGMENT, NETLIST_OBJECT_LIST::SetConnectionType(), SHEETBUSLABELMEMBER, SHEETLABEL, UNCONNECTED, and WAR.

Referenced by DIALOG_ERC::TestErc().

Variable Documentation

◆ CommentERC_H

const wxString CommentERC_H[]
Initial value:
=
{
_( "Input Pin" ),
_( "Output Pin" ),
_( "Bidirectional Pin" ),
_( "Tri-State Pin" ),
_( "Passive Pin" ),
_( "Unspecified Pin" ),
_( "Power Input Pin" ),
_( "Power Output Pin" ),
_( "Open Collector" ),
_( "Open Emitter" ),
_( "No Connection" )
}
#define _(s)
Definition: 3d_actions.cpp:33

Definition at line 67 of file eeschema/erc.cpp.

Referenced by PANEL_SETUP_PINMAP::ReBuildMatrixPanel().

◆ CommentERC_V

const wxString CommentERC_V[]
Initial value:
=
{
_( "Input Pin" ),
_( "Output Pin" ),
_( "Bidirectional Pin" ),
_( "Tri-State Pin" ),
_( "Passive Pin" ),
_( "Unspecified Pin" ),
_( "Power Input Pin" ),
_( "Power Output Pin" ),
_( "Open Collector" ),
_( "Open Emitter" ),
_( "No Connection" )
}
#define _(s)
Definition: 3d_actions.cpp:33

Definition at line 83 of file eeschema/erc.cpp.

Referenced by PANEL_SETUP_PINMAP::ReBuildMatrixPanel().

◆ DefaultPinMap

Initial value:
=
{
{ OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
{ OK, ERR, OK, WAR, OK, WAR, OK, ERR, ERR, ERR, ERR },
{ OK, OK, OK, OK, OK, WAR, OK, WAR, OK, WAR, ERR },
{ OK, WAR, OK, OK, OK, WAR, WAR, ERR, WAR, WAR, ERR },
{ OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
{ WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, ERR },
{ OK, OK, OK, WAR, OK, WAR, OK, OK, OK, OK, ERR },
{ OK, ERR, WAR, ERR, OK, WAR, OK, ERR, ERR, ERR, ERR },
{ OK, ERR, OK, WAR, OK, WAR, OK, ERR, OK, OK, ERR },
{ OK, ERR, WAR, WAR, OK, WAR, OK, ERR, OK, OK, ERR },
{ ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR }
}
Definition: erc.h:43
Definition: erc.h:42
Definition: erc.h:44

Default Look up table which gives the ERC error level for a pair of connected pins Same as DiagErc, but cannot be modified.

Used to init or reset DiagErc note also, to avoid inconsistancy: DefaultDiagErc[i][j] = DefaultDiagErc[j][i]

Definition at line 113 of file eeschema/erc.cpp.

Referenced by PANEL_SETUP_PINMAP::OnResetMatrixClick(), and PANEL_SETUP_PINMAP::ReBuildMatrixPanel().

◆ MinimalReq

Initial value:
=
{
{ NOD, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ NOD, DRV, NOD, NOD, NOD, NOD, NOD, DRV, NOD, NOD, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
{ NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI }
}
#define DRV
Definition: erc.h:80
#define NPI
Definition: erc.h:79
#define NOD
Definition: erc.h:82

Look up table which gives the minimal drive for a pair of connected pins on a net.

The initial state of a net is NOC (Net with No Connection). It can be updated to NPI (Pin Isolated), NET_NC (Net with a no connect symbol), NOD (Not Driven) or DRV (DRIven). It can be updated to NET_NC with no error only if there is only one pin in net. Nets are OK when their final state is NET_NC or DRV. Nets with the state NOD have no valid source signal.

Definition at line 140 of file eeschema/erc.cpp.

Referenced by TestOthersItems().

◆ PinMap