KiCad PCB EDA Suite
NETLIST_OBJECT_LIST Class Reference

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

#include <class_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_T GetItemType (unsigned aIdx) const
 Acces to an item type. More...
 
int GetItemNet (unsigned aIdx) const
 Acces to an item net code. More...
 
NET_CONNECTION_T GetConnectionType (unsigned aIdx)
 
void SetConnectionType (unsigned aIdx, NET_CONNECTION_T aFlg=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

Class 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 285 of file class_netlist_object.h.

Constructor & Destructor Documentation

NETLIST_OBJECT_LIST::NETLIST_OBJECT_LIST ( )
inline

Constructor.

NETLIST_OBJECT_LIST handle a list of connected items. the instance can be owner of items or not. If it is the owner, the items are freeed by the destructor

Parameters
aIsOwnertrue if the instance is the owner of item list (default = false)

Definition at line 300 of file class_netlist_object.h.

301  {
302  // Do not leave some members uninitialized:
303  m_lastNetCode = 0;
304  m_lastBusNetCode = 0;
305  }
NETLIST_OBJECT_LIST::~NETLIST_OBJECT_LIST ( )

Definition at line 126 of file eeschema/netlist.cpp.

References Clear().

127 {
128  Clear();
129 }
void Clear()
Delete all objects in list and clear list.

Member Function Documentation

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 185 of file eeschema/netlist.cpp.

References connectBusLabels(), findBestNetNameForEachNet(), SCH_SCREEN::GetDrawItems(), GetItem(), NETLIST_OBJECT::GetNet(), IS_BUS, IS_WIRE, labelConnect(), SCH_SHEET_PATH::LastScreen(), NETLIST_OBJECT::m_BusNetCode, m_lastBusNetCode, m_lastNetCode, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Type, NET_BUS, NET_BUSLABELMEMBER, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_HIERBUSLABELMEMBER, NET_HIERLABEL, NET_ITEM_UNSPECIFIED, NET_JUNCTION, NET_LABEL, NET_NOCONNECT, NET_PIN, NET_PINLABEL, NET_SEGMENT, NET_SHEETBUSLABELMEMBER, NET_SHEETLABEL, SCH_ITEM::Next(), pointToPointConnect(), segmentToPointConnect(), NETLIST_OBJECT::SetNet(), setUnconnectedFlag(), sheetLabelConnect(), SortListbyNetcode(), and SortListbySheet().

186 {
187  SCH_SHEET_PATH* sheet;
188 
189  // Fill list with connected items from the flattened sheet list
190  for( unsigned i = 0; i < aSheets.size(); i++ )
191  {
192  sheet = &aSheets[i];
193 
194  for( SCH_ITEM* item = sheet->LastScreen()->GetDrawItems(); item; item = item->Next() )
195  {
196  item->GetNetListItem( *this, sheet );
197  }
198  }
199 
200  if( size() == 0 )
201  return false;
202 
203  // Sort objects by Sheet
204  SortListbySheet();
205 
206  sheet = &(GetItem( 0 )->m_SheetPath);
208 
209  for( unsigned ii = 0, istart = 0; ii < size(); ii++ )
210  {
211  NETLIST_OBJECT* net_item = GetItem( ii );
212 
213  if( net_item->m_SheetPath != *sheet ) // Sheet change
214  {
215  sheet = &(net_item->m_SheetPath);
216  istart = ii;
217  }
218 
219  switch( net_item->m_Type )
220  {
222  wxMessageBox( wxT( "BuildNetListInfo() error" ) );
223  break;
224 
225  case NET_PIN:
226  case NET_PINLABEL:
227  case NET_SHEETLABEL:
228  case NET_NOCONNECT:
229  if( net_item->GetNet() != 0 )
230  break;
231 
232  case NET_SEGMENT:
233  // Test connections point to point type without bus.
234  if( net_item->GetNet() == 0 )
235  {
236  net_item->SetNet( m_lastNetCode );
237  m_lastNetCode++;
238  }
239 
240  pointToPointConnect( net_item, IS_WIRE, istart );
241  break;
242 
243  case NET_JUNCTION:
244  // Control of the junction outside BUS.
245  if( net_item->GetNet() == 0 )
246  {
247  net_item->SetNet( m_lastNetCode );
248  m_lastNetCode++;
249  }
250 
251  segmentToPointConnect( net_item, IS_WIRE, istart );
252 
253  // Control of the junction, on BUS.
254  if( net_item->m_BusNetCode == 0 )
255  {
256  net_item->m_BusNetCode = m_lastBusNetCode;
258  }
259 
260  segmentToPointConnect( net_item, IS_BUS, istart );
261  break;
262 
263  case NET_LABEL:
264  case NET_HIERLABEL:
265  case NET_GLOBLABEL:
266  // Test connections type junction without bus.
267  if( net_item->GetNet() == 0 )
268  {
269  net_item->SetNet( m_lastNetCode );
270  m_lastNetCode++;
271  }
272 
273  segmentToPointConnect( net_item, IS_WIRE, istart );
274  break;
275 
277  if( net_item->m_BusNetCode != 0 )
278  break;
279 
280  case NET_BUS:
281  // Control type connections point to point mode bus
282  if( net_item->m_BusNetCode == 0 )
283  {
284  net_item->m_BusNetCode = m_lastBusNetCode;
286  }
287 
288  pointToPointConnect( net_item, IS_BUS, istart );
289  break;
290 
291  case NET_BUSLABELMEMBER:
294  // Control connections similar has on BUS
295  if( net_item->GetNet() == 0 )
296  {
297  net_item->m_BusNetCode = m_lastBusNetCode;
299  }
300 
301  segmentToPointConnect( net_item, IS_BUS, istart );
302  break;
303  }
304  }
305 
306 #if defined(NETLIST_DEBUG) && defined(DEBUG)
307  std::cout << "\n\nafter sheet local\n\n";
308  DumpNetTable();
309 #endif
310 
311  // Updating the Bus Labels Netcode connected by Bus
313 
314  // Group objects by label.
315  for( unsigned ii = 0; ii < size(); ii++ )
316  {
317  switch( GetItem( ii )->m_Type )
318  {
319  case NET_PIN:
320  case NET_SHEETLABEL:
321  case NET_SEGMENT:
322  case NET_JUNCTION:
323  case NET_BUS:
324  case NET_NOCONNECT:
325  break;
326 
327  case NET_LABEL:
328  case NET_GLOBLABEL:
329  case NET_PINLABEL:
330  case NET_BUSLABELMEMBER:
332  labelConnect( GetItem( ii ) );
333  break;
334 
336  case NET_HIERLABEL:
338  break;
339 
341  break;
342  }
343  }
344 
345 #if defined(NETLIST_DEBUG) && defined(DEBUG)
346  std::cout << "\n\nafter sheet global\n\n";
347  DumpNetTable();
348 #endif
349 
350  // Connection between hierarchy sheets
351  for( unsigned ii = 0; ii < size(); ii++ )
352  {
353  if( GetItem( ii )->m_Type == NET_SHEETLABEL
354  || GetItem( ii )->m_Type == NET_SHEETBUSLABELMEMBER )
355  sheetLabelConnect( GetItem( ii ) );
356  }
357 
358  // Sort objects by NetCode
360 
361 #if defined(NETLIST_DEBUG) && defined(DEBUG)
362  std::cout << "\n\nafter qsort()\n";
363  DumpNetTable();
364 #endif
365 
366  // Compress numbers of Netcode having consecutive values.
367  int NetCode = 0;
368  m_lastNetCode = 0;
369 
370  for( unsigned ii = 0; ii < size(); ii++ )
371  {
372  if( GetItem( ii )->GetNet() != m_lastNetCode )
373  {
374  NetCode++;
375  m_lastNetCode = GetItem( ii )->GetNet();
376  }
377 
378  GetItem( ii )->SetNet( NetCode );
379  }
380 
381  // Set the minimal connection info:
383 
384  // find the best label object to give the best net name to each net
386 
387  return true;
388 }
void setUnconnectedFlag()
Set the m_FlagOfConnection member of items in list depending on the connection type: UNCONNECTED...
#define IS_WIRE
void connectBusLabels()
Function connectBusLabels Propagate the net code (and create it, if not yet existing) between all bus...
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SHEET_PATH m_SheetPath
void findBestNetNameForEachNet()
Function findBestNetNameForEachNet fill the .m_NetNameCandidate member of each item of aNetItemBuffer...
SCH_SCREEN * LastScreen() const
Function LastScreen.
NETLIST_ITEM_T m_Type
void labelConnect(NETLIST_OBJECT *aLabelRef)
SCH_ITEM * Next() const
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_BUS
Class SCH_SHEET_PATH.
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
void SetNet(int aNetCode)
void pointToPointConnect(NETLIST_OBJECT *aRef, bool aIsBus, int start)
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void NETLIST_OBJECT_LIST::Clear ( )

Delete all objects in list and clear list.

Definition at line 132 of file eeschema/netlist.cpp.

Referenced by ~NETLIST_OBJECT_LIST().

133 {
134  NETLIST_OBJECTS::iterator iter;
135 
136  for( iter = begin(); iter != end(); iter++ )
137  {
138  NETLIST_OBJECT* item = *iter;
139  delete item;
140  }
141 
142  clear();
143 }
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 635 of file eeschema/netlist.cpp.

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().

636 {
637  // Propagate the net code between all bus label member objects connected by they name.
638  // If the net code is not yet existing, a new one is created
639  // Search is done in the entire list
640  for( unsigned ii = 0; ii < size(); ii++ )
641  {
642  NETLIST_OBJECT* Label = GetItem( ii );
643 
644  if( Label->IsLabelBusMemberType() )
645  {
646  if( Label->GetNet() == 0 )
647  {
648  // Not yet existiing net code: create a new one.
649  Label->SetNet( m_lastNetCode );
650  m_lastNetCode++;
651  }
652 
653  for( unsigned jj = ii + 1; jj < size(); jj++ )
654  {
655  NETLIST_OBJECT* LabelInTst = GetItem( jj );
656 
657  if( LabelInTst->IsLabelBusMemberType() )
658  {
659  if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
660  continue;
661 
662  if( LabelInTst->m_Member != Label->m_Member )
663  continue;
664 
665  if( LabelInTst->GetNet() == 0 )
666  // Append this object to the current net
667  LabelInTst->SetNet( Label->GetNet() );
668  else
669  // Merge the 2 net codes, they are connected.
670  propagateNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
671  }
672  }
673  }
674  }
675 }
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
bool IsLabelBusMemberType() const
Function IsLabelBusMemberType.
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
void SetNet(int aNetCode)
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 506 of file erc.cpp.

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

507 {
508  int count = 0;
509  int curr_net = GetItemNet( aNetStart );
510 
511  /* Test pins connected to NetItemRef */
512  for( unsigned item = aNetStart; item < size(); item++ )
513  {
514  // We examine only a given net. We stop the search if the net changes
515  if( curr_net != GetItemNet( item ) ) // End of net
516  break;
517 
518  if( GetItemType( item ) == NET_PIN )
519  count++;
520  }
521 
522  return count;
523 }
NETLIST_ITEM_T GetItemType(unsigned aIdx) const
Acces to an item type.
int GetItemNet(unsigned aIdx) const
Acces to an item net code.
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 457 of file eeschema/netlist.cpp.

References evalLabelsPriority(), NETLIST_OBJECT::GetComponentParent(), GetItem(), NETLIST_OBJECT::GetNet(), NETLIST_OBJECT::GetShortNetName(), NETLIST_OBJECT::HasNetNameCandidate(), SCH_COMPONENT::IsInNetlist(), NETLIST_OBJECT::m_Type, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_HIERLABEL, NET_LABEL, NET_PIN, NET_PINLABEL, and NETLIST_OBJECT::SetNetNameCandidate().

Referenced by BuildNetListInfo().

458 {
459  // Important note: NET_SHEETLABEL items of sheet items should *NOT* be considered,
460  // because they live in a sheet but their names are actually used in the subsheet.
461  // Moreover, in the parent sheet, the name of NET_SHEETLABEL can be not unique,
462  // ( for instance when 2 different sheets share the same schematic in complex hierarchies
463  // and 2 identical NET_SHEETLABEL labels can be connected to 2 different nets
464 
465  int netcode = 0; // current netcode for tested items
466  unsigned idxstart = 0; // index of the first item of this net
467  NETLIST_OBJECT* item;
468  NETLIST_OBJECT* candidate;
469 
470  // Pass 1: find the best name for labelled nets:
471  candidate = NULL;
472  for( unsigned ii = 0; ii <= size(); ii++ )
473  {
474  if( ii == size() ) // last item already tested
475  item = NULL;
476  else
477  item = GetItem( ii );
478 
479  if( !item || netcode != item->GetNet() ) // End of net found
480  {
481  if( candidate ) // One or more labels exists, find the best
482  {
483  for (unsigned jj = idxstart; jj < ii; jj++ )
484  GetItem( jj )->SetNetNameCandidate( candidate );
485  }
486 
487  if( item == NULL ) // End of list
488  break;
489 
490  // Prepare next net analysis:
491  netcode = item->GetNet();
492  candidate = NULL;
493  idxstart = ii;
494  }
495 
496  switch( item->m_Type )
497  {
498  case NET_HIERLABEL:
499  case NET_LABEL:
500  case NET_PINLABEL:
501  case NET_GLOBLABEL:
503  // A candidate is found: select the better between the previous
504  // and this one
505  if( candidate == NULL )
506  candidate = item;
507  else
508  {
509  if( evalLabelsPriority( item, candidate ) )
510  // item has a highter priority than candidate
511  // so update the best candidate
512  candidate = item;
513  }
514  break;
515 
516  default:
517  break;
518  }
519  }
520 
521  // Pass 2: find the best name for not labelled nets:
522  // The "default" net name is Net-<<Ref cmp>_Pad<num pad>>
523  // (see NETLIST_OBJECT::GetShortNetName())
524  // therefore the "best" is the short net name alphabetically classed first
525  // (to avoid net names changes when the net is not modified,
526  // even if components are moved or deleted and undelete or replaced, as long
527  // the reference is kept)
528 
529  // Build a list of items with no net names
530  NETLIST_OBJECTS list; // no ownership of elements being pointed at
531 
532  for( unsigned ii = 0; ii < size(); ii++ )
533  {
534  item = GetItem( ii );
535 
536  if( !item->HasNetNameCandidate() )
537  list.push_back( item );
538  }
539 
540  if( list.size() == 0 )
541  return;
542 
543  idxstart = 0;
544  candidate = NULL;
545  netcode = list[0]->GetNet();
546 
547  for( unsigned ii = 0; ii <= list.size(); ii++ )
548  {
549  if( ii < list.size() )
550  item = list[ii];
551  else
552  item = NULL;
553 
554  if( !item || netcode != item->GetNet() ) // End of net found
555  {
556  if( candidate )
557  {
558  for (unsigned jj = idxstart; jj < ii; jj++ )
559  {
560  NETLIST_OBJECT* obj = list[jj];
561  obj->SetNetNameCandidate( candidate );
562  }
563  }
564 
565  if( !item )
566  break;
567 
568  netcode = item->GetNet();
569  candidate = NULL;
570  idxstart = ii;
571  }
572 
573  // Examine all pins of the net to find the best candidate,
574  // i.e. the first net name candidate, by alphabetic order
575  // the net names are built by GetShortNetName
576  // (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
577  // Not named nets do not have usually a lot of members.
578  // Many have only 2 members(a pad and a non connection symbol)
579  if( item->m_Type == NET_PIN )
580  {
581  // A candidate is found, however components which are not in
582  // netlist are not candidate because some have their reference
583  // changed each time the netlist is built (power components)
584  // and anyway obviously they are not a good candidate
585  SCH_COMPONENT* link = item->GetComponentParent();
586 
587  if( link && link->IsInNetlist() )
588  {
589  // select the better between the previous and this one
590  item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName
591 
592  if( candidate == NULL )
593  candidate = item;
594  else
595  {
596  if( item->GetShortNetName().Cmp( candidate->GetShortNetName() ) < 0 )
597  candidate = item;
598  }
599  }
600  }
601  }
602 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
NETLIST_ITEM_T m_Type
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
SCH_COMPONENT * GetComponentParent() const
For Pins (NET_PINS):
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...
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:68
wxString GetShortNetName(bool adoptTimestamp=false) const
Function GetShortNetName.
static bool evalLabelsPriority(const NETLIST_OBJECT *aLabel1, const NETLIST_OBJECT *aLabel2)
NET_CONNECTION_T NETLIST_OBJECT_LIST::GetConnectionType ( unsigned  aIdx)
inline

Definition at line 343 of file class_netlist_object.h.

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

Referenced by TestOthersItems().

344  {
345  return GetItem( aIdx )->GetConnectionType();
346  }
NET_CONNECTION_T GetConnectionType() const
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
int NETLIST_OBJECT_LIST::GetItemNet ( unsigned  aIdx) const
inline

Acces to an item net code.

Definition at line 338 of file class_netlist_object.h.

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

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

339  {
340  return GetItem( aIdx )->GetNet();
341  }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
NETLIST_ITEM_T NETLIST_OBJECT_LIST::GetItemType ( unsigned  aIdx) const
inline

Acces to an item type.

Definition at line 330 of file class_netlist_object.h.

References GetItem(), and NETLIST_OBJECT::m_Type.

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

331  {
332  return GetItem( aIdx )->m_Type;
333  }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
NETLIST_ITEM_T m_Type
void NETLIST_OBJECT_LIST::labelConnect ( NETLIST_OBJECT aLabelRef)
private

Definition at line 845 of file eeschema/netlist.cpp.

References GetItem(), NETLIST_OBJECT::GetNet(), IS_WIRE, NETLIST_OBJECT::IsLabelType(), NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Type, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_PINLABEL, propagateNetCode(), and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

846 {
847  if( aLabelRef->GetNet() == 0 )
848  return;
849 
850  for( unsigned i = 0; i < size(); i++ )
851  {
852  NETLIST_OBJECT* item = GetItem( i );
853 
854  if( item->GetNet() == aLabelRef->GetNet() )
855  continue;
856 
857  if( item->m_SheetPath != aLabelRef->m_SheetPath )
858  {
859  if( item->m_Type != NET_PINLABEL && item->m_Type != NET_GLOBLABEL
860  && item->m_Type != NET_GLOBBUSLABELMEMBER )
861  continue;
862 
863  if( (item->m_Type == NET_GLOBLABEL
864  || item->m_Type == NET_GLOBBUSLABELMEMBER)
865  && item->m_Type != aLabelRef->m_Type )
866  //global labels only connect other global labels.
867  continue;
868  }
869 
870  // NET_HIERLABEL are used to connect sheets.
871  // NET_LABEL are local to a sheet
872  // NET_GLOBLABEL are global.
873  // NET_PINLABEL is a kind of global label (generated by a power pin invisible)
874  if( item->IsLabelType() )
875  {
876  if( item->m_Label != aLabelRef->m_Label )
877  continue;
878 
879  if( item->GetNet() )
880  propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
881  else
882  item->SetNet( aLabelRef->GetNet() );
883  }
884  }
885 }
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
bool IsLabelType() const
Function IsLabelType.
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::pointToPointConnect ( NETLIST_OBJECT aRef,
bool  aIsBus,
int  start 
)
private

Definition at line 706 of file eeschema/netlist.cpp.

References GetItem(), NETLIST_OBJECT::GetNet(), IS_BUS, IS_WIRE, NETLIST_OBJECT::m_BusNetCode, NETLIST_OBJECT::m_End, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, NET_BUS, NET_BUSLABELMEMBER, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_HIERBUSLABELMEMBER, NET_HIERLABEL, NET_ITEM_UNSPECIFIED, NET_JUNCTION, NET_LABEL, NET_NOCONNECT, NET_PIN, NET_PINLABEL, NET_SEGMENT, NET_SHEETBUSLABELMEMBER, NET_SHEETLABEL, propagateNetCode(), and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

707 {
708  int netCode;
709 
710  if( aIsBus == false ) // Objects other than BUS and BUSLABELS
711  {
712  netCode = aRef->GetNet();
713 
714  for( unsigned i = start; i < size(); i++ )
715  {
716  NETLIST_OBJECT* item = GetItem( i );
717 
718  if( item->m_SheetPath != aRef->m_SheetPath ) //used to be > (why?)
719  continue;
720 
721  switch( item->m_Type )
722  {
723  case NET_SEGMENT:
724  case NET_PIN:
725  case NET_LABEL:
726  case NET_HIERLABEL:
727  case NET_GLOBLABEL:
728  case NET_SHEETLABEL:
729  case NET_PINLABEL:
730  case NET_JUNCTION:
731  case NET_NOCONNECT:
732  if( aRef->m_Start == item->m_Start
733  || aRef->m_Start == item->m_End
734  || aRef->m_End == item->m_Start
735  || aRef->m_End == item->m_End )
736  {
737  if( item->GetNet() == 0 )
738  item->SetNet( netCode );
739  else
740  propagateNetCode( item->GetNet(), netCode, IS_WIRE );
741  }
742  break;
743 
744  case NET_BUS:
745  case NET_BUSLABELMEMBER:
750  break;
751  }
752  }
753  }
754  else // Object type BUS, BUSLABELS, and junctions.
755  {
756  netCode = aRef->m_BusNetCode;
757 
758  for( unsigned i = start; i < size(); i++ )
759  {
760  NETLIST_OBJECT* item = GetItem( i );
761 
762  if( item->m_SheetPath != aRef->m_SheetPath )
763  continue;
764 
765  switch( item->m_Type )
766  {
768  case NET_SEGMENT:
769  case NET_PIN:
770  case NET_LABEL:
771  case NET_HIERLABEL:
772  case NET_GLOBLABEL:
773  case NET_SHEETLABEL:
774  case NET_PINLABEL:
775  case NET_NOCONNECT:
776  break;
777 
778  case NET_BUS:
779  case NET_BUSLABELMEMBER:
783  case NET_JUNCTION:
784  if( aRef->m_Start == item->m_Start
785  || aRef->m_Start == item->m_End
786  || aRef->m_End == item->m_Start
787  || aRef->m_End == item->m_End )
788  {
789  if( item->m_BusNetCode == 0 )
790  item->m_BusNetCode = netCode;
791  else
792  propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
793  }
794  break;
795  }
796  }
797  }
798 }
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_BUS
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::propagateNetCode ( int  aOldNetCode,
int  aNewNetCode,
bool  aIsBus 
)
private

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

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

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

679 {
680  if( aOldNetCode == aNewNetCode )
681  return;
682 
683  if( aIsBus == false ) // Propagate NetCode
684  {
685  for( unsigned jj = 0; jj < size(); jj++ )
686  {
687  NETLIST_OBJECT* object = GetItem( jj );
688 
689  if( object->GetNet() == aOldNetCode )
690  object->SetNet( aNewNetCode );
691  }
692  }
693  else // Propagate BusNetCode
694  {
695  for( unsigned jj = 0; jj < size(); jj++ )
696  {
697  NETLIST_OBJECT* object = GetItem( jj );
698 
699  if( object->m_BusNetCode == aOldNetCode )
700  object->m_BusNetCode = aNewNetCode;
701  }
702  }
703 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::ResetConnectionsType ( )
inline

Reset the connection type of all items to UNCONNECTED type.

Definition at line 366 of file class_netlist_object.h.

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

367  {
368  for( unsigned ii = 0; ii < size(); ii++ )
370  }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetConnectionType(NET_CONNECTION_T aFlg=UNCONNECTED)
Set the item connection type: UNCONNECTED Pin or Label not connected (error) NOCONNECT_SYMBOL_PRESENT...
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 801 of file eeschema/netlist.cpp.

References 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, NET_BUS, NET_SEGMENT, propagateNetCode(), and NETLIST_OBJECT::SetNet().

Referenced by BuildNetListInfo().

803 {
804  for( unsigned i = aIdxStart; i < size(); i++ )
805  {
806  NETLIST_OBJECT* segment = GetItem( i );
807 
808  // if different sheets, obviously no physical connection between elements.
809  if( segment->m_SheetPath != aJonction->m_SheetPath )
810  continue;
811 
812  if( aIsBus == IS_WIRE )
813  {
814  if( segment->m_Type != NET_SEGMENT )
815  continue;
816  }
817  else
818  {
819  if( segment->m_Type != NET_BUS )
820  continue;
821  }
822 
823  if( IsPointOnSegment( segment->m_Start, segment->m_End, aJonction->m_Start ) )
824  {
825  // Propagation Netcode has all the objects of the same Netcode.
826  if( aIsBus == IS_WIRE )
827  {
828  if( segment->GetNet() )
829  propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
830  else
831  segment->SetNet( aJonction->GetNet() );
832  }
833  else
834  {
835  if( segment->m_BusNetCode )
836  propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
837  else
838  segment->m_BusNetCode = aJonction->m_BusNetCode;
839  }
840  }
841  }
842 }
#define IS_WIRE
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Function IsPointOnSegment.
Definition: trigo.cpp:39
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::SetConnectionType ( unsigned  aIdx,
NET_CONNECTION_T  aFlg = 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 355 of file class_netlist_object.h.

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

Referenced by TestOthersItems().

356  {
357  GetItem( aIdx )->SetConnectionType( aFlg );
358  }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
void SetConnectionType(NET_CONNECTION_T aFlg=UNCONNECTED)
Set the item connection type: UNCONNECTED Pin or Label not connected (error) NOCONNECT_SYMBOL_PRESENT...
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 888 of file eeschema/netlist.cpp.

References GetItem(), NETLIST_OBJECT::GetNet(), NETLIST_OBJECT::m_ConnectionType, NETLIST_OBJECT::m_Type, NET_BUS, NET_BUSLABELMEMBER, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_HIERBUSLABELMEMBER, NET_HIERLABEL, NET_ITEM_UNSPECIFIED, NET_JUNCTION, NET_LABEL, NET_NOCONNECT, NET_PIN, NET_PINLABEL, NET_SEGMENT, NET_SHEETBUSLABELMEMBER, NET_SHEETLABEL, NOCONNECT_SYMBOL_PRESENT, PAD_CONNECT, and UNCONNECTED.

Referenced by BuildNetListInfo().

889 {
890  NETLIST_OBJECT* NetItemRef;
891  unsigned NetStart, NetEnd;
892  NET_CONNECTION_T StateFlag;
893 
894  NetStart = NetEnd = 0;
895  StateFlag = UNCONNECTED;
896  for( unsigned ii = 0; ii < size(); ii++ )
897  {
898  NetItemRef = GetItem( ii );
899  if( NetItemRef->m_Type == NET_NOCONNECT && StateFlag != PAD_CONNECT )
900  StateFlag = NOCONNECT_SYMBOL_PRESENT;
901 
902  // Analysis of current net.
903  unsigned idxtoTest = ii + 1;
904 
905  if( ( idxtoTest >= size() )
906  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
907  {
908  // Net analysis to update m_ConnectionType
909  NetEnd = idxtoTest;
910 
911  /* set m_ConnectionType member to StateFlag for all items of
912  * this net: */
913  for( unsigned kk = NetStart; kk < NetEnd; kk++ )
914  GetItem( kk )->m_ConnectionType = StateFlag;
915 
916  if( idxtoTest >= size() )
917  return;
918 
919  // Start Analysis next Net
920  StateFlag = UNCONNECTED;
921  NetStart = idxtoTest;
922  continue;
923  }
924 
925  /* test the current item: if this is a pin and if the reference item
926  * is also a pin, then 2 pins are connected, so set StateFlag to
927  * PAD_CONNECT (can be already done) Of course, if the current
928  * item is a no connect symbol, set StateFlag to
929  * NOCONNECT_SYMBOL_PRESENT to inhibit error diags. However if
930  * StateFlag is already set to PAD_CONNECT this state is kept (the
931  * no connect symbol was surely an error and an ERC will report this)
932  */
933  for( ; ; idxtoTest++ )
934  {
935  if( ( idxtoTest >= size() )
936  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
937  break;
938 
939  switch( GetItem( idxtoTest )->m_Type )
940  {
942  wxMessageBox( wxT( "BuildNetListBase() error" ) );
943  break;
944 
945  case NET_SEGMENT:
946  case NET_LABEL:
947  case NET_HIERLABEL:
948  case NET_GLOBLABEL:
949  case NET_SHEETLABEL:
950  case NET_PINLABEL:
951  case NET_BUS:
952  case NET_BUSLABELMEMBER:
956  case NET_JUNCTION:
957  break;
958 
959  case NET_PIN:
960  if( NetItemRef->m_Type == NET_PIN )
961  StateFlag = PAD_CONNECT;
962 
963  break;
964 
965  case NET_NOCONNECT:
966  if( StateFlag != PAD_CONNECT )
967  StateFlag = NOCONNECT_SYMBOL_PRESENT;
968 
969  break;
970  }
971  }
972  }
973 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
NET_CONNECTION_T m_ConnectionType
NETLIST_ITEM_T m_Type
NET_CONNECTION_T
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 605 of file eeschema/netlist.cpp.

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

Referenced by BuildNetListInfo().

606 {
607  if( SheetLabel->GetNet() == 0 )
608  return;
609 
610  for( unsigned ii = 0; ii < size(); ii++ )
611  {
612  NETLIST_OBJECT* ObjetNet = GetItem( ii );
613 
614  if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
615  continue; //use SheetInclude, not the sheet!!
616 
617  if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
618  continue;
619 
620  if( ObjetNet->GetNet() == SheetLabel->GetNet() )
621  continue; //already connected.
622 
623  if( ObjetNet->m_Label != SheetLabel->m_Label )
624  continue; //different names.
625 
626  // Propagate Netcode having all the objects of the same Netcode.
627  if( ObjetNet->GetNet() )
628  propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
629  else
630  ObjetNet->SetNet( SheetLabel->GetNet() );
631  }
632 }
#define IS_WIRE
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
void SetNet(int aNetCode)
static bool NETLIST_OBJECT_LIST::sortItemsbyNetcode ( const NETLIST_OBJECT Objet1,
const NETLIST_OBJECT Objet2 
)
inlinestaticprivate

Definition at line 439 of file class_netlist_object.h.

References NETLIST_OBJECT::GetNet().

Referenced by SortListbyNetcode().

440  {
441  return Objet1->GetNet() < Objet2->GetNet();
442  }
static bool NETLIST_OBJECT_LIST::sortItemsBySheet ( const NETLIST_OBJECT Objet1,
const NETLIST_OBJECT Objet2 
)
inlinestaticprivate

Definition at line 446 of file class_netlist_object.h.

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

Referenced by SortListbySheet().

447  {
448  return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
449  }
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.
void NETLIST_OBJECT_LIST::SortListbyNetcode ( )

Definition at line 146 of file eeschema/netlist.cpp.

References sortItemsbyNetcode().

Referenced by BuildNetListInfo().

147 {
148  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsbyNetcode );
149 }
static bool sortItemsbyNetcode(const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)
void NETLIST_OBJECT_LIST::SortListbySheet ( )

Definition at line 152 of file eeschema/netlist.cpp.

References sortItemsBySheet().

Referenced by BuildNetListInfo().

153 {
154  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsBySheet );
155 }
static bool sortItemsBySheet(const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)
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 an other suitable label

Definition at line 584 of file erc.cpp.

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

585 {
586  unsigned netItemTst = aStartNet;
587  int erc = 1;
588 
589  // Review the list of labels connected to NetItemRef:
590  for( ; ; netItemTst++ )
591  {
592  if( netItemTst == aNetItemRef )
593  continue;
594 
595  /* Is always in the same net? */
596  if( ( netItemTst == size() )
597  || ( GetItemNet( aNetItemRef ) != GetItemNet( netItemTst ) ) )
598  {
599  /* End Netcode found. */
600  if( erc )
601  {
602  /* Glabel or SheetLabel orphaned. */
603  Diagnose( GetItem( aNetItemRef ), NULL, -1, WAR );
604  }
605 
606  return;
607  }
608 
609  if( GetItem( aNetItemRef )->IsLabelConnected( GetItem( netItemTst ) ) )
610  erc = 0;
611 
612  //same thing, different order.
613  if( GetItem( netItemTst )->IsLabelConnected( GetItem( aNetItemRef ) ) )
614  erc = 0;
615  }
616 }
Definition: erc.h:43
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
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...
Definition: erc.cpp:228
int GetItemNet(unsigned aIdx) const
Acces to an item net code.
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 658 of file erc.cpp.

References countIndenticalLabels(), GetItem(), GetItemType(), NETLIST_OBJECT::IsLabelGlobal(), NETLIST_OBJECT::m_Label, NET_BUSLABELMEMBER, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_HIERBUSLABELMEMBER, NET_HIERLABEL, NET_LABEL, NET_PINLABEL, NET_SHEETBUSLABELMEMBER, NET_SHEETLABEL, and SimilarLabelsDiagnose().

659 {
660  // Similar labels which are different when using case sensitive comparisons
661  // but are equal when using case insensitive comparisons
662 
663  // list of all labels (used the better item to build diag messages)
664  std::vector<NETLIST_OBJECT*> fullLabelList;
665  // list of all labels , each label appears only once (used to to detect similar labels)
666  std::set<NETLIST_OBJECT*, compare_labels> uniqueLabelList;
667  wxString msg;
668 
669  // Build a list of differents labels. If inside a given sheet there are
670  // more than one given label, only one label is stored.
671  // not also the sheet labels are not taken in account for 2 reasons:
672  // * they are in the root sheet but they are seen only from the child sheet
673  // * any mismatch between child sheet hierarchical labels and the sheet label
674  // already detected by ERC
675  for( unsigned netItem = 0; netItem < size(); ++netItem )
676  {
677  switch( GetItemType( netItem ) )
678  {
679  case NET_LABEL:
680  case NET_BUSLABELMEMBER:
681  case NET_PINLABEL:
683  case NET_HIERLABEL:
685  case NET_GLOBLABEL:
686  // add this label in lists
687  uniqueLabelList.insert( GetItem( netItem ) );
688  fullLabelList.push_back( GetItem( netItem ) );
689  break;
690 
691  case NET_SHEETLABEL:
693  default:
694  break;
695  }
696  }
697 
698  // build global labels and compare
699  std::set<NETLIST_OBJECT*, compare_label_names> loc_labelList;
700  std::set<NETLIST_OBJECT*>::const_iterator it;
701 
702  for( it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
703  {
704  if( (*it)->IsLabelGlobal() )
705  loc_labelList.insert( *it );
706  }
707 
708  // compare global labels (same label names appears only once in list)
709  for( it = loc_labelList.begin(); it != loc_labelList.end(); ++it )
710  {
711  std::set<NETLIST_OBJECT*>::const_iterator it_aux = it;
712 
713  for( ++it_aux; it_aux != loc_labelList.end(); ++it_aux )
714  {
715  if( (*it)->m_Label.CmpNoCase( (*it_aux)->m_Label ) == 0 )
716  {
717  // Create new marker for ERC.
718  int cntA = countIndenticalLabels( fullLabelList, *it );
719  int cntB = countIndenticalLabels( fullLabelList, *it_aux );
720 
721  if( cntA <= cntB )
722  SimilarLabelsDiagnose( (*it), (*it_aux) );
723  else
724  SimilarLabelsDiagnose( (*it_aux), (*it) );
725  }
726  }
727  }
728 
729  // Build paths list
730  std::set<NETLIST_OBJECT*, compare_paths> pathsList;
731 
732  for( it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
733  pathsList.insert( *it );
734 
735  // Examine each label inside a sheet path:
736  for( it = pathsList.begin(); it != pathsList.end(); ++it )
737  {
738  loc_labelList.clear();
739 
740  std::set<NETLIST_OBJECT*>::const_iterator it_aux = uniqueLabelList.begin();
741 
742  for( ; it_aux != uniqueLabelList.end(); ++it_aux )
743  {
744  if( (*it)->m_SheetPath.Path() == (*it_aux)->m_SheetPath.Path() )
745  loc_labelList.insert( *it_aux );
746  }
747 
748  // at this point, loc_labelList contains labels of the current sheet path.
749  // Detect similar labels (same label names appears only once in list)
750  std::set<NETLIST_OBJECT*>::const_iterator ref_it;
751 
752  for( ref_it = loc_labelList.begin(); ref_it != loc_labelList.end(); ++ref_it )
753  {
754  NETLIST_OBJECT* ref_item = *ref_it;
755  it_aux = ref_it;
756 
757  for( ++it_aux; it_aux != loc_labelList.end(); ++it_aux )
758  {
759  // global label versus global label was already examined.
760  // here, at least one label must be local
761  if( ref_item->IsLabelGlobal() && (*it_aux)->IsLabelGlobal() )
762  continue;
763 
764  if( ref_item->m_Label.CmpNoCase( (*it_aux)->m_Label ) == 0 )
765  {
766  // Create new marker for ERC.
767  int cntA = countIndenticalLabels( fullLabelList, ref_item );
768  int cntB = countIndenticalLabels( fullLabelList, *it_aux );
769 
770  if( cntA <= cntB )
771  SimilarLabelsDiagnose( ref_item, (*it_aux) );
772  else
773  SimilarLabelsDiagnose( (*it_aux), ref_item );
774  }
775  }
776  }
777  }
778 }
bool IsLabelGlobal() const
Function IsLabelGlobal.
NETLIST_ITEM_T GetItemType(unsigned aIdx) const
Acces to an item type.
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
static int countIndenticalLabels(std::vector< NETLIST_OBJECT * > &aList, NETLIST_OBJECT *aLabel)
Definition: erc.cpp:783
static void SimilarLabelsDiagnose(NETLIST_OBJECT *aItemA, NETLIST_OBJECT *aItemB)
Definition: erc.cpp:813

Member Data Documentation

int NETLIST_OBJECT_LIST::m_lastBusNetCode
private

Definition at line 288 of file class_netlist_object.h.

Referenced by BuildNetListInfo().

int NETLIST_OBJECT_LIST::m_lastNetCode
private

Definition at line 287 of file class_netlist_object.h.

Referenced by BuildNetListInfo(), and connectBusLabels().


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