KiCad PCB EDA Suite
NETLIST_OBJECT_LIST Class Reference

NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected items in a full schematic hierarchy. More...

#include <netlist_object.h>

Inheritance diagram for NETLIST_OBJECT_LIST:

Public Member Functions

 NETLIST_OBJECT_LIST ()
 Constructor. More...
 
 ~NETLIST_OBJECT_LIST ()
 
bool BuildNetListInfo (SCH_SHEET_LIST &aSheets)
 Function BuildNetListInfo the master function of tgis class. More...
 
NETLIST_OBJECTGetItem (unsigned aIdx) const
 Acces to an item in list. More...
 
NETLIST_ITEM GetItemType (unsigned aIdx) const
 Acces to an item type. More...
 
int GetItemNet (unsigned aIdx) const
 Acces to an item net code. More...
 
NET_CONNECTION GetConnectionType (unsigned aIdx)
 
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 Pin not connected but have a NoConnect symbol on it (no error) PAD_CONNECT Normal connection (no error) More...
 
void Clear ()
 Delete all objects in list and clear list. More...
 
void ResetConnectionsType ()
 Reset the connection type of all items to UNCONNECTED type. More...
 
void SortListbyNetcode ()
 
void SortListbySheet ()
 
int CountPinsInNet (unsigned aNetStart)
 Counts number of pins connected on the same net. More...
 
void TestforNonOrphanLabel (unsigned aNetItemRef, unsigned aStartNet)
 Function TestforNonOrphanLabel Sheet labels are expected to be connected to a hierarchical label. More...
 
void TestforSimilarLabels ()
 Function TestforSimilarLabels detects labels which are different when using case sensitive comparisons but are equal when using case insensitive comparisons It can be due to a mistake from designer, so this kind of labels is reported by TestforSimilarLabels. More...
 

Private Member Functions

void propagateNetCode (int aOldNetCode, int aNewNetCode, bool aIsBus)
 
void labelConnect (NETLIST_OBJECT *aLabelRef)
 
void sheetLabelConnect (NETLIST_OBJECT *aSheetLabel)
 Propagate net codes from a parent sheet to an include sheet, from a pin sheet connection. More...
 
void pointToPointConnect (NETLIST_OBJECT *aRef, bool aIsBus, int start)
 
void segmentToPointConnect (NETLIST_OBJECT *aJonction, bool aIsBus, int aIdxStart)
 Search connections between a junction and segments Propagate the junction net code to objects connected by this junction. More...
 
void connectBusLabels ()
 Function connectBusLabels Propagate the net code (and create it, if not yet existing) between all bus label member objects connected by they name. More...
 
void setUnconnectedFlag ()
 Set the m_FlagOfConnection member of items in list depending on the connection type: UNCONNECTED, PAD_CONNECT or NOCONNECT_SYMBOL_PRESENT The list is expected sorted by order of net code, i.e. More...
 
void findBestNetNameForEachNet ()
 Function findBestNetNameForEachNet fill the .m_NetNameCandidate member of each item of aNetItemBuffer with a reference to the "best" NETLIST_OBJECT usable to give a name to the net If no suitable object found, .m_NetNameCandidate is filled with 0. More...
 

Static Private Member Functions

static bool sortItemsbyNetcode (const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)
 
static bool sortItemsBySheet (const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)
 

Private Attributes

int m_lastNetCode
 
int m_lastBusNetCode
 

Detailed Description

NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected items in a full schematic hierarchy.

It is helpful for netlist and ERC calculations.

Definition at line 302 of file netlist_object.h.

Constructor & Destructor Documentation

◆ NETLIST_OBJECT_LIST()

NETLIST_OBJECT_LIST::NETLIST_OBJECT_LIST ( )
inline

Constructor.

NETLIST_OBJECT_LIST handle a list of connected items. these NETLIST_OBJECT items are freeed by the destructor

Definition at line 314 of file netlist_object.h.

315  {
316  // Do not leave some members uninitialized:
317  m_lastNetCode = 0;
318  m_lastBusNetCode = 0;
319  }

References m_lastBusNetCode, and m_lastNetCode.

◆ ~NETLIST_OBJECT_LIST()

NETLIST_OBJECT_LIST::~NETLIST_OBJECT_LIST ( )

Definition at line 40 of file netlist_object_list.cpp.

41 {
42  Clear();
43 }
void Clear()
Delete all objects in list and clear list.

References Clear().

Member Function Documentation

◆ BuildNetListInfo()

bool NETLIST_OBJECT_LIST::BuildNetListInfo ( SCH_SHEET_LIST aSheets)

Function BuildNetListInfo the master function of tgis class.

Build the list of connected objects (pins, labels ...) and all info to generate netlists or run ERC diags

Parameters
aSheets= the flattened sheet list
Returns
true if OK, false is not item found

Definition at line 72 of file netlist_object_list.cpp.

73 {
74  SCH_SHEET_PATH* sheet;
75 
76  // Fill list with connected items from the flattened sheet list
77  for( unsigned i = 0; i < aSheets.size(); i++ )
78  {
79  sheet = &aSheets[i];
80 
81  for( auto item : sheet->LastScreen()->Items() )
82  item->GetNetListItem( *this, sheet );
83  }
84 
85  if( size() == 0 )
86  return false;
87 
88  // Sort objects by Sheet
90 
91  sheet = &(GetItem( 0 )->m_SheetPath);
93 
94  for( unsigned ii = 0, istart = 0; ii < size(); ii++ )
95  {
96  NETLIST_OBJECT* net_item = GetItem( ii );
97 
98  if( net_item->m_SheetPath != *sheet ) // Sheet change
99  {
100  sheet = &(net_item->m_SheetPath);
101  istart = ii;
102  }
103 
104  switch( net_item->m_Type )
105  {
107  wxMessageBox( wxT( "BuildNetListInfo() error" ) );
108  break;
109 
110  case NETLIST_ITEM::PIN:
114  if( net_item->GetNet() != 0 )
115  break;
116 
117  // Intentionally fall through if there is no net assigned
118 
120  // Test connections point to point type without bus.
121  if( net_item->GetNet() == 0 )
122  {
123  net_item->SetNet( m_lastNetCode );
124  m_lastNetCode++;
125  }
126 
127  pointToPointConnect( net_item, IS_WIRE, istart );
128  break;
129 
131  // Control of the junction outside BUS.
132  if( net_item->GetNet() == 0 )
133  {
134  net_item->SetNet( m_lastNetCode );
135  m_lastNetCode++;
136  }
137 
138  segmentToPointConnect( net_item, IS_WIRE, istart );
139 
140  // Control of the junction, on BUS.
141  if( net_item->m_BusNetCode == 0 )
142  {
143  net_item->m_BusNetCode = m_lastBusNetCode;
145  }
146 
147  segmentToPointConnect( net_item, IS_BUS, istart );
148  break;
149 
150  case NETLIST_ITEM::LABEL:
153  // Test connections type junction without bus.
154  if( net_item->GetNet() == 0 )
155  {
156  net_item->SetNet( m_lastNetCode );
157  m_lastNetCode++;
158  }
159 
160  segmentToPointConnect( net_item, IS_WIRE, istart );
161  break;
162 
164  if( net_item->m_BusNetCode != 0 )
165  break;
166 
167  // Intentionally fall through if there is no bus assigned
168 
169  case NETLIST_ITEM::BUS:
170  // Control type connections point to point mode bus
171  if( net_item->m_BusNetCode == 0 )
172  {
173  net_item->m_BusNetCode = m_lastBusNetCode;
175  }
176 
177  pointToPointConnect( net_item, IS_BUS, istart );
178  break;
179 
183  // Control connections similar has on BUS
184  if( net_item->GetNet() == 0 )
185  {
186  net_item->m_BusNetCode = m_lastBusNetCode;
188  }
189 
190  segmentToPointConnect( net_item, IS_BUS, istart );
191  break;
192  }
193  }
194 
195 #if defined(NETLIST_DEBUG) && defined(DEBUG)
196  std::cout << "\n\nafter sheet local\n\n";
197  DumpNetTable();
198 #endif
199 
200  // Updating the Bus Labels Netcode connected by Bus
202 
203  // Group objects by label.
204  for( unsigned ii = 0; ii < size(); ii++ )
205  {
206  switch( GetItem( ii )->m_Type )
207  {
208  case NETLIST_ITEM::PIN:
212  case NETLIST_ITEM::BUS:
214  break;
215 
216  case NETLIST_ITEM::LABEL:
221  labelConnect( GetItem( ii ) );
222  break;
223 
227  break;
228 
230  break;
231  }
232  }
233 
234 #if defined(NETLIST_DEBUG) && defined(DEBUG)
235  std::cout << "\n\nafter sheet global\n\n";
236  DumpNetTable();
237 #endif
238 
239  // Connection between hierarchy sheets
240  for( unsigned ii = 0; ii < size(); ii++ )
241  {
244  sheetLabelConnect( GetItem( ii ) );
245  }
246 
247  // Sort objects by NetCode
249 
250 #if defined(NETLIST_DEBUG) && defined(DEBUG)
251  std::cout << "\n\nafter qsort()\n";
252  DumpNetTable();
253 #endif
254 
255  // Compress numbers of Netcode having consecutive values.
256  int NetCode = 0;
257  m_lastNetCode = 0;
258 
259  for( unsigned ii = 0; ii < size(); ii++ )
260  {
261  if( GetItem( ii )->GetNet() != m_lastNetCode )
262  {
263  NetCode++;
264  m_lastNetCode = GetItem( ii )->GetNet();
265  }
266 
267  GetItem( ii )->SetNet( NetCode );
268  }
269 
270  // Set the minimal connection info:
272 
273  // find the best label object to give the best net name to each net
275 
276  return true;
277 }
void setUnconnectedFlag()
Set the m_FlagOfConnection member of items in list depending on the connection type: UNCONNECTED,...
void connectBusLabels()
Function connectBusLabels Propagate the net code (and create it, if not yet existing) between all bus...
int GetNet() const
#define IS_BUS
SCH_SHEET_PATH m_SheetPath
void findBestNetNameForEachNet()
Function findBestNetNameForEachNet fill the .m_NetNameCandidate member of each item of aNetItemBuffer...
void labelConnect(NETLIST_OBJECT *aLabelRef)
void sheetLabelConnect(NETLIST_OBJECT *aSheetLabel)
Propagate net codes from a parent sheet to an include sheet, from a pin sheet connection.
void segmentToPointConnect(NETLIST_OBJECT *aJonction, bool aIsBus, int aIdxStart)
Search connections between a junction and segments Propagate the junction net code to objects connect...
#define IS_WIRE
SCH_SHEET_PATH.
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SCREEN * LastScreen()
Function LastScreen.
void SetNet(int aNetCode)
EE_RTREE & Items()
Definition: sch_screen.h:127
void pointToPointConnect(NETLIST_OBJECT *aRef, bool aIsBus, int start)
NETLIST_ITEM m_Type

References BUS, BUSLABELMEMBER, connectBusLabels(), findBestNetNameForEachNet(), GetItem(), NETLIST_OBJECT::GetNet(), GLOBBUSLABELMEMBER, GLOBLABEL, HIERBUSLABELMEMBER, HIERLABEL, IS_BUS, IS_WIRE, ITEM_UNSPECIFIED, SCH_SCREEN::Items(), JUNCTION, LABEL, labelConnect(), SCH_SHEET_PATH::LastScreen(), NETLIST_OBJECT::m_BusNetCode, m_lastBusNetCode, m_lastNetCode, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Type, NOCONNECT, PIN, PINLABEL, pointToPointConnect(), SEGMENT, segmentToPointConnect(), NETLIST_OBJECT::SetNet(), setUnconnectedFlag(), SHEETBUSLABELMEMBER, SHEETLABEL, sheetLabelConnect(), SortListbyNetcode(), and SortListbySheet().

◆ Clear()

void NETLIST_OBJECT_LIST::Clear ( )

Delete all objects in list and clear list.

Definition at line 46 of file netlist_object_list.cpp.

47 {
48  NETLIST_OBJECTS::iterator iter;
49 
50  for( iter = begin(); iter != end(); iter++ )
51  {
52  NETLIST_OBJECT* item = *iter;
53  delete item;
54  }
55 
56  clear();
57 }

Referenced by ~NETLIST_OBJECT_LIST().

◆ connectBusLabels()

void NETLIST_OBJECT_LIST::connectBusLabels ( )
private

Function connectBusLabels Propagate the net code (and create it, if not yet existing) between all bus label member objects connected by they name.

Search is done in the entire list

Definition at line 530 of file netlist_object_list.cpp.

531 {
532  // Propagate the net code between all bus label member objects connected by they name.
533  // If the net code is not yet existing, a new one is created
534  // Search is done in the entire list
535  for( unsigned ii = 0; ii < size(); ii++ )
536  {
537  NETLIST_OBJECT* Label = GetItem( ii );
538 
539  if( Label->IsLabelBusMemberType() )
540  {
541  if( Label->GetNet() == 0 )
542  {
543  // Not yet existiing net code: create a new one.
544  Label->SetNet( m_lastNetCode );
545  m_lastNetCode++;
546  }
547 
548  for( unsigned jj = ii + 1; jj < size(); jj++ )
549  {
550  NETLIST_OBJECT* LabelInTst = GetItem( jj );
551 
552  if( LabelInTst->IsLabelBusMemberType() )
553  {
554  if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
555  continue;
556 
557  if( LabelInTst->m_Member != Label->m_Member )
558  continue;
559 
560  if( LabelInTst->GetNet() == 0 )
561  // Append this object to the current net
562  LabelInTst->SetNet( Label->GetNet() );
563  else
564  // Merge the 2 net codes, they are connected.
565  propagateNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
566  }
567  }
568  }
569  }
570 }
int GetNet() const
bool IsLabelBusMemberType() const
Function IsLabelBusMemberType.
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)

References GetItem(), NETLIST_OBJECT::GetNet(), IS_WIRE, NETLIST_OBJECT::IsLabelBusMemberType(), NETLIST_OBJECT::m_BusNetCode, m_lastNetCode, NETLIST_OBJECT::m_Member, propagateNetCode(), and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

◆ CountPinsInNet()

int NETLIST_OBJECT_LIST::CountPinsInNet ( unsigned  aNetStart)

Counts number of pins connected on the same net.

Used to count all pins connected to a no connect symbol

Returns
the pin count of the net starting at aNetStart
Parameters
aNetStart= index in list of net objects of the first item

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

535 {
536  int count = 0;
537  int curr_net = GetItemNet( aNetStart );
538 
539  /* Test pins connected to NetItemRef */
540  for( unsigned item = aNetStart; item < size(); item++ )
541  {
542  // We examine only a given net. We stop the search if the net changes
543  if( curr_net != GetItemNet( item ) ) // End of net
544  break;
545 
546  if( GetItemType( item ) == NETLIST_ITEM::PIN )
547  count++;
548  }
549 
550  return count;
551 }
int GetItemNet(unsigned aIdx) const
Acces to an item net code.
NETLIST_ITEM GetItemType(unsigned aIdx) const
Acces to an item type.

References GetItemNet(), GetItemType(), and PIN.

◆ findBestNetNameForEachNet()

void NETLIST_OBJECT_LIST::findBestNetNameForEachNet ( )
private

Function findBestNetNameForEachNet fill the .m_NetNameCandidate member of each item of aNetItemBuffer with a reference to the "best" NETLIST_OBJECT usable to give a name to the net If no suitable object found, .m_NetNameCandidate is filled with 0.

The "best" NETLIST_OBJECT is a NETLIST_OBJECT that have the type label and by priority order: the label is global or local the label is in the first sheet in a hierarchy (the root sheet has the most priority) alphabetic order.

Definition at line 353 of file netlist_object_list.cpp.

354 {
355  // Important note: NETLIST_ITEM::SHEETLABEL items of sheet items should *NOT* be considered,
356  // because they live in a sheet but their names are actually used in the subsheet.
357  // Moreover, in the parent sheet, the name of NETLIST_ITEM::SHEETLABEL can be not unique,
358  // ( for instance when 2 different sheets share the same schematic in complex hierarchies
359  // and 2 identical NETLIST_ITEM::SHEETLABEL labels can be connected to 2 different nets
360 
361  int netcode = 0; // current netcode for tested items
362  unsigned idxstart = 0; // index of the first item of this net
363  NETLIST_OBJECT* item;
364  NETLIST_OBJECT* candidate;
365 
366  // Pass 1: find the best name for labelled nets:
367  candidate = NULL;
368  for( unsigned ii = 0; ii <= size(); ii++ )
369  {
370  if( ii == size() ) // last item already tested
371  item = NULL;
372  else
373  item = GetItem( ii );
374 
375  if( !item || netcode != item->GetNet() ) // End of net found
376  {
377  if( candidate ) // One or more labels exists, find the best
378  {
379  for (unsigned jj = idxstart; jj < ii; jj++ )
380  GetItem( jj )->SetNetNameCandidate( candidate );
381  }
382 
383  if( item == NULL ) // End of list
384  break;
385 
386  // Prepare next net analysis:
387  netcode = item->GetNet();
388  candidate = NULL;
389  idxstart = ii;
390  }
391 
392  switch( item->m_Type )
393  {
395  case NETLIST_ITEM::LABEL:
399  // A candidate is found: select the better between the previous and this one
400  if( candidate == NULL )
401  candidate = item;
402  else
403  {
404  if( evalLabelsPriority( item, candidate ) )
405  // item has a higher priority than candidate so update the best candidate
406  candidate = item;
407  }
408  break;
409 
410  default:
411  break;
412  }
413  }
414 
415  // Pass 2: find the best name for not labelled nets:
416  // The "default" net name is Net-<<Ref cmp>_Pad<num pad>>
417  // (see NETLIST_OBJECT::GetShortNetName())
418  // therefore the "best" is the short net name alphabetically classed first
419  // (to avoid net names changes when the net is not modified,
420  // even if components are moved or deleted and undelete or replaced, as long
421  // the reference is kept)
422 
423  // Build a list of items with no net names
424  NETLIST_OBJECTS list; // no ownership of elements being pointed at
425 
426  for( unsigned ii = 0; ii < size(); ii++ )
427  {
428  item = GetItem( ii );
429 
430  if( !item->HasNetNameCandidate() )
431  list.push_back( item );
432  }
433 
434  if( list.size() == 0 )
435  return;
436 
437  idxstart = 0;
438  candidate = NULL;
439  netcode = list[0]->GetNet();
440 
441  for( unsigned ii = 0; ii <= list.size(); ii++ )
442  {
443  if( ii < list.size() )
444  item = list[ii];
445  else
446  item = NULL;
447 
448  if( !item || netcode != item->GetNet() ) // End of net found
449  {
450  if( candidate )
451  {
452  for (unsigned jj = idxstart; jj < ii; jj++ )
453  {
454  NETLIST_OBJECT* obj = list[jj];
455  obj->SetNetNameCandidate( candidate );
456  }
457  }
458 
459  if( !item )
460  break;
461 
462  netcode = item->GetNet();
463  candidate = NULL;
464  idxstart = ii;
465  }
466 
467  // Examine all pins of the net to find the best candidate,
468  // i.e. the first net name candidate, by alphabetic order
469  // the net names are built by GetShortNetName
470  // (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
471  // Not named nets do not have usually a lot of members.
472  // Many have only 2 members(a pad and a non connection symbol)
473  if( item->m_Type == NETLIST_ITEM::PIN )
474  {
475  // A candidate is found, however components which are not in
476  // netlist are not candidate because some have their reference
477  // changed each time the netlist is built (power components)
478  // and anyway obviously they are not a good candidate
479  SCH_COMPONENT* link = item->GetComponentParent();
480 
481  if( link && link->IsInNetlist() )
482  {
483  // select the better between the previous and this one
484  item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName
485 
486  if( candidate == NULL )
487  candidate = item;
488  else
489  {
490  if( item->GetShortNetName().Cmp( candidate->GetShortNetName() ) < 0 )
491  candidate = item;
492  }
493  }
494  }
495  }
496 }
SCH_COMPONENT * GetComponentParent() const
For Pins (NET_PINS):
static bool evalLabelsPriority(const NETLIST_OBJECT *aLabel1, const NETLIST_OBJECT *aLabel2)
int GetNet() const
std::vector< NETLIST_OBJECT * > NETLIST_OBJECTS
Type NETLIST_OBJECTS is a container referring to (not owning) NETLIST_OBJECTs, which are connected it...
bool IsInNetlist() const
#define NULL
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNetNameCandidate(NETLIST_OBJECT *aCandidate)
Set m_netNameCandidate to a connected item which will be used to calcule the net name of the item Obv...
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
wxString GetShortNetName(bool adoptTimestamp=false) const
Function GetShortNetName.
bool HasNetNameCandidate()
NETLIST_ITEM m_Type

References evalLabelsPriority(), NETLIST_OBJECT::GetComponentParent(), GetItem(), NETLIST_OBJECT::GetNet(), NETLIST_OBJECT::GetShortNetName(), GLOBBUSLABELMEMBER, GLOBLABEL, NETLIST_OBJECT::HasNetNameCandidate(), HIERLABEL, SCH_COMPONENT::IsInNetlist(), LABEL, NETLIST_OBJECT::m_Type, NULL, PIN, PINLABEL, and NETLIST_OBJECT::SetNetNameCandidate().

Referenced by BuildNetListInfo().

◆ GetConnectionType()

NET_CONNECTION NETLIST_OBJECT_LIST::GetConnectionType ( unsigned  aIdx)
inline

Definition at line 357 of file netlist_object.h.

358  {
359  return GetItem( aIdx )->GetConnectionType();
360  }
NET_CONNECTION GetConnectionType() const
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.

References NETLIST_OBJECT::GetConnectionType(), and GetItem().

Referenced by TestOthersItems().

◆ GetItem()

◆ GetItemNet()

int NETLIST_OBJECT_LIST::GetItemNet ( unsigned  aIdx) const
inline

Acces to an item net code.

Definition at line 352 of file netlist_object.h.

353  {
354  return GetItem( aIdx )->GetNet();
355  }
int GetNet() const
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.

References GetItem(), and NETLIST_OBJECT::GetNet().

Referenced by CountPinsInNet(), TestforNonOrphanLabel(), and TestOthersItems().

◆ GetItemType()

NETLIST_ITEM NETLIST_OBJECT_LIST::GetItemType ( unsigned  aIdx) const
inline

Acces to an item type.

Definition at line 344 of file netlist_object.h.

345  {
346  return GetItem( aIdx )->m_Type;
347  }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
NETLIST_ITEM m_Type

References GetItem(), and NETLIST_OBJECT::m_Type.

Referenced by CountPinsInNet(), TestforSimilarLabels(), and TestOthersItems().

◆ labelConnect()

void NETLIST_OBJECT_LIST::labelConnect ( NETLIST_OBJECT aLabelRef)
private

Definition at line 740 of file netlist_object_list.cpp.

741 {
742  if( aLabelRef->GetNet() == 0 )
743  return;
744 
745  for( unsigned i = 0; i < size(); i++ )
746  {
747  NETLIST_OBJECT* item = GetItem( i );
748 
749  if( item->GetNet() == aLabelRef->GetNet() )
750  continue;
751 
752  if( item->m_SheetPath != aLabelRef->m_SheetPath )
753  {
756  continue;
757 
758  if( ( item->m_Type == NETLIST_ITEM::GLOBLABEL
760  && item->m_Type != aLabelRef->m_Type )
761  //global labels only connect other global labels.
762  continue;
763  }
764 
765  // NETLIST_ITEM::HIERLABEL are used to connect sheets.
766  // NETLIST_ITEM::LABEL are local to a sheet
767  // NETLIST_ITEM::GLOBLABEL are global.
768  // NETLIST_ITEM::PINLABEL is a kind of global label (generated by a power pin invisible)
769  if( item->IsLabelType() )
770  {
771  if( item->m_Label != aLabelRef->m_Label )
772  continue;
773 
774  if( item->GetNet() )
775  propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
776  else
777  item->SetNet( aLabelRef->GetNet() );
778  }
779  }
780 }
int GetNet() const
SCH_SHEET_PATH m_SheetPath
bool IsLabelType() const
Function IsLabelType.
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)
NETLIST_ITEM m_Type

References GetItem(), NETLIST_OBJECT::GetNet(), GLOBBUSLABELMEMBER, GLOBLABEL, IS_WIRE, NETLIST_OBJECT::IsLabelType(), NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Type, PINLABEL, propagateNetCode(), and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

◆ pointToPointConnect()

void NETLIST_OBJECT_LIST::pointToPointConnect ( NETLIST_OBJECT aRef,
bool  aIsBus,
int  start 
)
private

Definition at line 601 of file netlist_object_list.cpp.

602 {
603  int netCode;
604 
605  if( aIsBus == false ) // Objects other than BUS and BUSLABELS
606  {
607  netCode = aRef->GetNet();
608 
609  for( unsigned i = start; i < size(); i++ )
610  {
611  NETLIST_OBJECT* item = GetItem( i );
612 
613  if( item->m_SheetPath != aRef->m_SheetPath ) //used to be > (why?)
614  continue;
615 
616  switch( item->m_Type )
617  {
619  case NETLIST_ITEM::PIN:
620  case NETLIST_ITEM::LABEL:
627  if( aRef->m_Start == item->m_Start
628  || aRef->m_Start == item->m_End
629  || aRef->m_End == item->m_Start
630  || aRef->m_End == item->m_End )
631  {
632  if( item->GetNet() == 0 )
633  item->SetNet( netCode );
634  else
635  propagateNetCode( item->GetNet(), netCode, IS_WIRE );
636  }
637  break;
638 
639  case NETLIST_ITEM::BUS:
645  break;
646  }
647  }
648  }
649  else // Object type BUS, BUSLABELS, and junctions.
650  {
651  netCode = aRef->m_BusNetCode;
652 
653  for( unsigned i = start; i < size(); i++ )
654  {
655  NETLIST_OBJECT* item = GetItem( i );
656 
657  if( item->m_SheetPath != aRef->m_SheetPath )
658  continue;
659 
660  switch( item->m_Type )
661  {
664  case NETLIST_ITEM::PIN:
665  case NETLIST_ITEM::LABEL:
671  break;
672 
673  case NETLIST_ITEM::BUS:
679  if( aRef->m_Start == item->m_Start
680  || aRef->m_Start == item->m_End
681  || aRef->m_End == item->m_Start
682  || aRef->m_End == item->m_End )
683  {
684  if( item->m_BusNetCode == 0 )
685  item->m_BusNetCode = netCode;
686  else
687  propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
688  }
689  break;
690  }
691  }
692  }
693 }
int GetNet() const
#define IS_BUS
SCH_SHEET_PATH m_SheetPath
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)
NETLIST_ITEM m_Type

References BUS, BUSLABELMEMBER, GetItem(), NETLIST_OBJECT::GetNet(), GLOBBUSLABELMEMBER, GLOBLABEL, HIERBUSLABELMEMBER, HIERLABEL, IS_BUS, IS_WIRE, ITEM_UNSPECIFIED, JUNCTION, LABEL, NETLIST_OBJECT::m_BusNetCode, NETLIST_OBJECT::m_End, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, NOCONNECT, PIN, PINLABEL, propagateNetCode(), SEGMENT, NETLIST_OBJECT::SetNet(), SHEETBUSLABELMEMBER, and SHEETLABEL.

Referenced by BuildNetListInfo().

◆ propagateNetCode()

void NETLIST_OBJECT_LIST::propagateNetCode ( int  aOldNetCode,
int  aNewNetCode,
bool  aIsBus 
)
private

Definition at line 573 of file netlist_object_list.cpp.

574 {
575  if( aOldNetCode == aNewNetCode )
576  return;
577 
578  if( aIsBus == false ) // Propagate NetCode
579  {
580  for( unsigned jj = 0; jj < size(); jj++ )
581  {
582  NETLIST_OBJECT* object = GetItem( jj );
583 
584  if( object->GetNet() == aOldNetCode )
585  object->SetNet( aNewNetCode );
586  }
587  }
588  else // Propagate BusNetCode
589  {
590  for( unsigned jj = 0; jj < size(); jj++ )
591  {
592  NETLIST_OBJECT* object = GetItem( jj );
593 
594  if( object->m_BusNetCode == aOldNetCode )
595  object->m_BusNetCode = aNewNetCode;
596  }
597  }
598 }
int GetNet() const
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)

References GetItem(), NETLIST_OBJECT::GetNet(), NETLIST_OBJECT::m_BusNetCode, and NETLIST_OBJECT::SetNet().

Referenced by connectBusLabels(), labelConnect(), pointToPointConnect(), segmentToPointConnect(), and sheetLabelConnect().

◆ ResetConnectionsType()

void NETLIST_OBJECT_LIST::ResetConnectionsType ( )
inline

Reset the connection type of all items to UNCONNECTED type.

Definition at line 380 of file netlist_object.h.

381  {
382  for( unsigned ii = 0; ii < size(); ii++ )
384  }
void SetConnectionType(NET_CONNECTION aFlg=NET_CONNECTION::UNCONNECTED)
Set the item connection type: UNCONNECTED Pin or Label not connected (error) NOCONNECT_SYMBOL_PRESENT...
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.

References GetItem(), NETLIST_OBJECT::SetConnectionType(), and UNCONNECTED.

◆ segmentToPointConnect()

void NETLIST_OBJECT_LIST::segmentToPointConnect ( NETLIST_OBJECT aJonction,
bool  aIsBus,
int  aIdxStart 
)
private

Search connections between a junction and segments Propagate the junction net code to objects connected by this junction.

The junction must have a valid net code The list of objects is expected sorted by sheets. Search is done from index aIdxStart to the last element of list

Definition at line 696 of file netlist_object_list.cpp.

698 {
699  for( unsigned i = aIdxStart; i < size(); i++ )
700  {
701  NETLIST_OBJECT* segment = GetItem( i );
702 
703  // if different sheets, obviously no physical connection between elements.
704  if( segment->m_SheetPath != aJonction->m_SheetPath )
705  continue;
706 
707  if( aIsBus == IS_WIRE )
708  {
709  if( segment->m_Type != NETLIST_ITEM::SEGMENT )
710  continue;
711  }
712  else
713  {
714  if( segment->m_Type != NETLIST_ITEM::BUS )
715  continue;
716  }
717 
718  if( IsPointOnSegment( segment->m_Start, segment->m_End, aJonction->m_Start ) )
719  {
720  // Propagation Netcode has all the objects of the same Netcode.
721  if( aIsBus == IS_WIRE )
722  {
723  if( segment->GetNet() )
724  propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
725  else
726  segment->SetNet( aJonction->GetNet() );
727  }
728  else
729  {
730  if( segment->m_BusNetCode )
731  propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
732  else
733  segment->m_BusNetCode = aJonction->m_BusNetCode;
734  }
735  }
736  }
737 }
int GetNet() const
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Function IsPointOnSegment.
Definition: trigo.cpp:42
SCH_SHEET_PATH m_SheetPath
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)
NETLIST_ITEM m_Type

References BUS, GetItem(), NETLIST_OBJECT::GetNet(), IS_WIRE, IsPointOnSegment(), NETLIST_OBJECT::m_BusNetCode, NETLIST_OBJECT::m_End, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, propagateNetCode(), SEGMENT, and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

◆ SetConnectionType()

void NETLIST_OBJECT_LIST::SetConnectionType ( unsigned  aIdx,
NET_CONNECTION  aFlg = NET_CONNECTION::UNCONNECTED 
)
inline

Set the item connection type: UNCONNECTED Pin or Label not connected (error) NOCONNECT_SYMBOL_PRESENT Pin not connected but have a NoConnect symbol on it (no error) PAD_CONNECT Normal connection (no error)

Definition at line 369 of file netlist_object.h.

370  {
371  GetItem( aIdx )->SetConnectionType( aFlg );
372  }
void SetConnectionType(NET_CONNECTION aFlg=NET_CONNECTION::UNCONNECTED)
Set the item connection type: UNCONNECTED Pin or Label not connected (error) NOCONNECT_SYMBOL_PRESENT...
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.

References GetItem(), and NETLIST_OBJECT::SetConnectionType().

Referenced by TestOthersItems().

◆ setUnconnectedFlag()

void NETLIST_OBJECT_LIST::setUnconnectedFlag ( )
private

Set the m_FlagOfConnection member of items in list depending on the connection type: UNCONNECTED, PAD_CONNECT or NOCONNECT_SYMBOL_PRESENT The list is expected sorted by order of net code, i.e.

items having the same net code are grouped

Definition at line 783 of file netlist_object_list.cpp.

784 {
785  NETLIST_OBJECT* NetItemRef;
786  unsigned NetStart, NetEnd;
787  NET_CONNECTION StateFlag;
788 
789  NetStart = NetEnd = 0;
790  StateFlag = NET_CONNECTION::UNCONNECTED;
791  for( unsigned ii = 0; ii < size(); ii++ )
792  {
793  NetItemRef = GetItem( ii );
794  if( NetItemRef->m_Type == NETLIST_ITEM::NOCONNECT
795  && StateFlag != NET_CONNECTION::PAD_CONNECT )
797 
798  // Analysis of current net.
799  unsigned idxtoTest = ii + 1;
800 
801  if( ( idxtoTest >= size() )
802  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
803  {
804  // Net analysis to update m_ConnectionType
805  NetEnd = idxtoTest;
806 
807  /* set m_ConnectionType member to StateFlag for all items of
808  * this net: */
809  for( unsigned kk = NetStart; kk < NetEnd; kk++ )
810  GetItem( kk )->m_ConnectionType = StateFlag;
811 
812  if( idxtoTest >= size() )
813  return;
814 
815  // Start Analysis next Net
816  StateFlag = NET_CONNECTION::UNCONNECTED;
817  NetStart = idxtoTest;
818  continue;
819  }
820 
821  /* test the current item: if this is a pin and if the reference item
822  * is also a pin, then 2 pins are connected, so set StateFlag to
823  * PAD_CONNECT (can be already done) Of course, if the current
824  * item is a no connect symbol, set StateFlag to
825  * NOCONNECT_SYMBOL_PRESENT to inhibit error diags. However if
826  * StateFlag is already set to PAD_CONNECT this state is kept (the
827  * no connect symbol was surely an error and an ERC will report this)
828  */
829  for( ; ; idxtoTest++ )
830  {
831  if( ( idxtoTest >= size() )
832  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
833  break;
834 
835  switch( GetItem( idxtoTest )->m_Type )
836  {
838  wxMessageBox( wxT( "BuildNetListBase() error" ) );
839  break;
840 
842  case NETLIST_ITEM::LABEL:
847  case NETLIST_ITEM::BUS:
853  break;
854 
855  case NETLIST_ITEM::PIN:
856  if( NetItemRef->m_Type == NETLIST_ITEM::PIN )
857  StateFlag = NET_CONNECTION::PAD_CONNECT;
858 
859  break;
860 
862  if( StateFlag != NET_CONNECTION::PAD_CONNECT )
864 
865  break;
866  }
867  }
868  }
869 }
int GetNet() const
NET_CONNECTION
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
NET_CONNECTION m_ConnectionType
NETLIST_ITEM m_Type

References BUS, BUSLABELMEMBER, GetItem(), NETLIST_OBJECT::GetNet(), GLOBBUSLABELMEMBER, GLOBLABEL, HIERBUSLABELMEMBER, HIERLABEL, ITEM_UNSPECIFIED, JUNCTION, LABEL, NETLIST_OBJECT::m_ConnectionType, NETLIST_OBJECT::m_Type, NOCONNECT, NOCONNECT_SYMBOL_PRESENT, PAD_CONNECT, PIN, PINLABEL, SEGMENT, SHEETBUSLABELMEMBER, SHEETLABEL, and UNCONNECTED.

Referenced by BuildNetListInfo().

◆ sheetLabelConnect()

void NETLIST_OBJECT_LIST::sheetLabelConnect ( NETLIST_OBJECT aSheetLabel)
private

Propagate net codes from a parent sheet to an include sheet, from a pin sheet connection.

Definition at line 499 of file netlist_object_list.cpp.

500 {
501  if( SheetLabel->GetNet() == 0 )
502  return;
503 
504  for( unsigned ii = 0; ii < size(); ii++ )
505  {
506  NETLIST_OBJECT* ObjetNet = GetItem( ii );
507 
508  if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
509  continue; //use SheetInclude, not the sheet!!
510 
511  if( ( ObjetNet->m_Type != NETLIST_ITEM::HIERLABEL )
512  && ( ObjetNet->m_Type != NETLIST_ITEM::HIERBUSLABELMEMBER ) )
513  continue;
514 
515  if( ObjetNet->GetNet() == SheetLabel->GetNet() )
516  continue; //already connected.
517 
518  if( ObjetNet->m_Label != SheetLabel->m_Label )
519  continue; //different names.
520 
521  // Propagate Netcode having all the objects of the same Netcode.
522  if( ObjetNet->GetNet() )
523  propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
524  else
525  ObjetNet->SetNet( SheetLabel->GetNet() );
526  }
527 }
int GetNet() const
SCH_SHEET_PATH m_SheetPath
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)
NETLIST_ITEM m_Type

References GetItem(), NETLIST_OBJECT::GetNet(), HIERBUSLABELMEMBER, HIERLABEL, IS_WIRE, NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_SheetPathInclude, NETLIST_OBJECT::m_Type, propagateNetCode(), and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

◆ sortItemsbyNetcode()

static bool NETLIST_OBJECT_LIST::sortItemsbyNetcode ( const NETLIST_OBJECT Objet1,
const NETLIST_OBJECT Objet2 
)
inlinestaticprivate

Definition at line 453 of file netlist_object.h.

454  {
455  return Objet1->GetNet() < Objet2->GetNet();
456  }
int GetNet() const

References NETLIST_OBJECT::GetNet().

Referenced by SortListbyNetcode().

◆ sortItemsBySheet()

static bool NETLIST_OBJECT_LIST::sortItemsBySheet ( const NETLIST_OBJECT Objet1,
const NETLIST_OBJECT Objet2 
)
inlinestaticprivate

Definition at line 460 of file netlist_object.h.

461  {
462  return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
463  }
SCH_SHEET_PATH m_SheetPath
int Cmp(const SCH_SHEET_PATH &aSheetPathToTest) const
Function Cmp Compare if this is the same sheet path as aSheetPathToTest.

References SCH_SHEET_PATH::Cmp(), and NETLIST_OBJECT::m_SheetPath.

Referenced by SortListbySheet().

◆ SortListbyNetcode()

void NETLIST_OBJECT_LIST::SortListbyNetcode ( )

Definition at line 60 of file netlist_object_list.cpp.

61 {
62  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsbyNetcode );
63 }
static bool sortItemsbyNetcode(const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)

References sortItemsbyNetcode().

Referenced by BuildNetListInfo().

◆ SortListbySheet()

void NETLIST_OBJECT_LIST::SortListbySheet ( )

Definition at line 66 of file netlist_object_list.cpp.

67 {
68  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsBySheet );
69 }
static bool sortItemsBySheet(const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)

References sortItemsBySheet().

Referenced by BuildNetListInfo().

◆ TestforNonOrphanLabel()

void NETLIST_OBJECT_LIST::TestforNonOrphanLabel ( unsigned  aNetItemRef,
unsigned  aStartNet 
)

Function TestforNonOrphanLabel Sheet labels are expected to be connected to a hierarchical label.

Hierarchical labels are expected to be connected to a sheet label. Global labels are expected to be not orphan (connected to at least one other global label. This function tests the connection to another suitable label.

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

605 {
606  unsigned netItemTst = aStartNet;
607  int erc = 1;
608 
609  // Review the list of labels connected to NetItemRef:
610  for( ; ; netItemTst++ )
611  {
612  if( netItemTst == aNetItemRef )
613  continue;
614 
615  /* Is always in the same net? */
616  if( ( netItemTst == size() )
617  || ( GetItemNet( aNetItemRef ) != GetItemNet( netItemTst ) ) )
618  {
619  /* End Netcode found. */
620  if( erc )
621  {
622  /* Glabel or SheetLabel orphaned. */
623  Diagnose( GetItem( aNetItemRef ), NULL, -1, WAR );
624  }
625 
626  return;
627  }
628 
629  if( GetItem( aNetItemRef )->IsLabelConnected( GetItem( netItemTst ) ) )
630  erc = 0;
631 
632  //same thing, different order.
633  if( GetItem( netItemTst )->IsLabelConnected( GetItem( aNetItemRef ) ) )
634  erc = 0;
635  }
636 }
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...
int GetItemNet(unsigned aIdx) const
Acces to an item net code.
#define NULL
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.

References Diagnose(), GetItem(), GetItemNet(), NULL, and WAR.

◆ TestforSimilarLabels()

void NETLIST_OBJECT_LIST::TestforSimilarLabels ( )

Function TestforSimilarLabels detects labels which are different when using case sensitive comparisons but are equal when using case insensitive comparisons It can be due to a mistake from designer, so this kind of labels is reported by TestforSimilarLabels.

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

679 {
680  // Similar labels which are different when using case sensitive comparisons
681  // but are equal when using case insensitive comparisons
682 
683  // list of all labels (used the better item to build diag messages)
684  std::vector<NETLIST_OBJECT*> fullLabelList;
685  // list of all labels , each label appears only once (used to to detect similar labels)
686  std::set<NETLIST_OBJECT*, compare_labels> uniqueLabelList;
687  wxString msg;
688 
689  // Build a list of differents labels. If inside a given sheet there are
690  // more than one given label, only one label is stored.
691  // not also the sheet labels are not taken in account for 2 reasons:
692  // * they are in the root sheet but they are seen only from the child sheet
693  // * any mismatch between child sheet hierarchical labels and the sheet label
694  // already detected by ERC
695  for( unsigned netItem = 0; netItem < size(); ++netItem )
696  {
697  switch( GetItemType( netItem ) )
698  {
699  case NETLIST_ITEM::LABEL:
706  // add this label in lists
707  uniqueLabelList.insert( GetItem( netItem ) );
708  fullLabelList.push_back( GetItem( netItem ) );
709  break;
710 
713  default:
714  break;
715  }
716  }
717 
718  // build global labels and compare
719  std::set<NETLIST_OBJECT*, compare_label_names> loc_labelList;
720 
721  for( auto it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
722  {
723  if( (*it)->IsLabelGlobal() )
724  loc_labelList.insert( *it );
725  }
726 
727  // compare global labels (same label names appears only once in list)
728  for( auto it = loc_labelList.begin(); it != loc_labelList.end(); ++it )
729  {
730  auto it_aux = it;
731 
732  for( ++it_aux; it_aux != loc_labelList.end(); ++it_aux )
733  {
734  if( (*it)->m_Label.CmpNoCase( (*it_aux)->m_Label ) == 0 )
735  {
736  // Create new marker for ERC.
737  int cntA = countIndenticalLabels( fullLabelList, *it );
738  int cntB = countIndenticalLabels( fullLabelList, *it_aux );
739 
740  if( cntA <= cntB )
741  SimilarLabelsDiagnose( (*it), (*it_aux) );
742  else
743  SimilarLabelsDiagnose( (*it_aux), (*it) );
744  }
745  }
746  }
747 
748  // Build paths list
749  std::set<NETLIST_OBJECT*, compare_paths> pathsList;
750 
751  for( auto it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
752  pathsList.insert( *it );
753 
754  // Examine each label inside a sheet path:
755  for( auto it = pathsList.begin(); it != pathsList.end(); ++it )
756  {
757  loc_labelList.clear();
758 
759  auto it_uniq = uniqueLabelList.begin();
760 
761  for( ; it_uniq != uniqueLabelList.end(); ++it_uniq )
762  {
763  if( ( *it )->m_SheetPath.Path() == ( *it_uniq )->m_SheetPath.Path() )
764  loc_labelList.insert( *it_uniq );
765  }
766 
767  // at this point, loc_labelList contains labels of the current sheet path.
768  // Detect similar labels (same label names appears only once in list)
769 
770  for( auto ref_it = loc_labelList.begin(); ref_it != loc_labelList.end(); ++ref_it )
771  {
772  NETLIST_OBJECT* ref_item = *ref_it;
773  auto it_aux = ref_it;
774 
775  for( ++it_aux; it_aux != loc_labelList.end(); ++it_aux )
776  {
777  // global label versus global label was already examined.
778  // here, at least one label must be local
779  if( ref_item->IsLabelGlobal() && ( *it_aux )->IsLabelGlobal() )
780  continue;
781 
782  if( ref_item->m_Label.CmpNoCase( ( *it_aux )->m_Label ) == 0 )
783  {
784  // Create new marker for ERC.
785  int cntA = countIndenticalLabels( fullLabelList, ref_item );
786  int cntB = countIndenticalLabels( fullLabelList, *it_aux );
787 
788  if( cntA <= cntB )
789  SimilarLabelsDiagnose( ref_item, ( *it_aux ) );
790  else
791  SimilarLabelsDiagnose( ( *it_aux ), ref_item );
792  }
793  }
794  }
795  }
796 }
static int countIndenticalLabels(std::vector< NETLIST_OBJECT * > &aList, NETLIST_OBJECT *aRef)
bool IsLabelGlobal() const
Function IsLabelGlobal.
NETLIST_ITEM GetItemType(unsigned aIdx) const
Acces to an item type.
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
static void SimilarLabelsDiagnose(NETLIST_OBJECT *aItemA, NETLIST_OBJECT *aItemB)

References BUSLABELMEMBER, countIndenticalLabels(), GetItem(), GetItemType(), GLOBBUSLABELMEMBER, GLOBLABEL, HIERBUSLABELMEMBER, HIERLABEL, NETLIST_OBJECT::IsLabelGlobal(), LABEL, NETLIST_OBJECT::m_Label, PINLABEL, SHEETBUSLABELMEMBER, SHEETLABEL, and SimilarLabelsDiagnose().

Member Data Documentation

◆ m_lastBusNetCode

int NETLIST_OBJECT_LIST::m_lastBusNetCode
private

Definition at line 305 of file netlist_object.h.

Referenced by BuildNetListInfo(), and NETLIST_OBJECT_LIST().

◆ m_lastNetCode

int NETLIST_OBJECT_LIST::m_lastNetCode
private

Definition at line 304 of file netlist_object.h.

Referenced by BuildNetListInfo(), connectBusLabels(), and NETLIST_OBJECT_LIST().


The documentation for this class was generated from the following files: