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. these NETLIST_OBJECT items are freeed by the destructor

Definition at line 297 of file class_netlist_object.h.

298  {
299  // Do not leave some members uninitialized:
300  m_lastNetCode = 0;
301  m_lastBusNetCode = 0;
302  }
NETLIST_OBJECT_LIST::~NETLIST_OBJECT_LIST ( )

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

References Clear().

130 {
131  Clear();
132 }
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 188 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().

189 {
190  SCH_SHEET_PATH* sheet;
191 
192  // Fill list with connected items from the flattened sheet list
193  for( unsigned i = 0; i < aSheets.size(); i++ )
194  {
195  sheet = &aSheets[i];
196 
197  for( SCH_ITEM* item = sheet->LastScreen()->GetDrawItems(); item; item = item->Next() )
198  {
199  item->GetNetListItem( *this, sheet );
200  }
201  }
202 
203  if( size() == 0 )
204  return false;
205 
206  // Sort objects by Sheet
207  SortListbySheet();
208 
209  sheet = &(GetItem( 0 )->m_SheetPath);
211 
212  for( unsigned ii = 0, istart = 0; ii < size(); ii++ )
213  {
214  NETLIST_OBJECT* net_item = GetItem( ii );
215 
216  if( net_item->m_SheetPath != *sheet ) // Sheet change
217  {
218  sheet = &(net_item->m_SheetPath);
219  istart = ii;
220  }
221 
222  switch( net_item->m_Type )
223  {
225  wxMessageBox( wxT( "BuildNetListInfo() error" ) );
226  break;
227 
228  case NET_PIN:
229  case NET_PINLABEL:
230  case NET_SHEETLABEL:
231  case NET_NOCONNECT:
232  if( net_item->GetNet() != 0 )
233  break;
234 
235  case NET_SEGMENT:
236  // Test connections point to point type without bus.
237  if( net_item->GetNet() == 0 )
238  {
239  net_item->SetNet( m_lastNetCode );
240  m_lastNetCode++;
241  }
242 
243  pointToPointConnect( net_item, IS_WIRE, istart );
244  break;
245 
246  case NET_JUNCTION:
247  // Control of the junction outside BUS.
248  if( net_item->GetNet() == 0 )
249  {
250  net_item->SetNet( m_lastNetCode );
251  m_lastNetCode++;
252  }
253 
254  segmentToPointConnect( net_item, IS_WIRE, istart );
255 
256  // Control of the junction, on BUS.
257  if( net_item->m_BusNetCode == 0 )
258  {
259  net_item->m_BusNetCode = m_lastBusNetCode;
261  }
262 
263  segmentToPointConnect( net_item, IS_BUS, istart );
264  break;
265 
266  case NET_LABEL:
267  case NET_HIERLABEL:
268  case NET_GLOBLABEL:
269  // Test connections type junction without bus.
270  if( net_item->GetNet() == 0 )
271  {
272  net_item->SetNet( m_lastNetCode );
273  m_lastNetCode++;
274  }
275 
276  segmentToPointConnect( net_item, IS_WIRE, istart );
277  break;
278 
280  if( net_item->m_BusNetCode != 0 )
281  break;
282 
283  case NET_BUS:
284  // Control type connections point to point mode bus
285  if( net_item->m_BusNetCode == 0 )
286  {
287  net_item->m_BusNetCode = m_lastBusNetCode;
289  }
290 
291  pointToPointConnect( net_item, IS_BUS, istart );
292  break;
293 
294  case NET_BUSLABELMEMBER:
297  // Control connections similar has on BUS
298  if( net_item->GetNet() == 0 )
299  {
300  net_item->m_BusNetCode = m_lastBusNetCode;
302  }
303 
304  segmentToPointConnect( net_item, IS_BUS, istart );
305  break;
306  }
307  }
308 
309 #if defined(NETLIST_DEBUG) && defined(DEBUG)
310  std::cout << "\n\nafter sheet local\n\n";
311  DumpNetTable();
312 #endif
313 
314  // Updating the Bus Labels Netcode connected by Bus
316 
317  // Group objects by label.
318  for( unsigned ii = 0; ii < size(); ii++ )
319  {
320  switch( GetItem( ii )->m_Type )
321  {
322  case NET_PIN:
323  case NET_SHEETLABEL:
324  case NET_SEGMENT:
325  case NET_JUNCTION:
326  case NET_BUS:
327  case NET_NOCONNECT:
328  break;
329 
330  case NET_LABEL:
331  case NET_GLOBLABEL:
332  case NET_PINLABEL:
333  case NET_BUSLABELMEMBER:
335  labelConnect( GetItem( ii ) );
336  break;
337 
339  case NET_HIERLABEL:
341  break;
342 
344  break;
345  }
346  }
347 
348 #if defined(NETLIST_DEBUG) && defined(DEBUG)
349  std::cout << "\n\nafter sheet global\n\n";
350  DumpNetTable();
351 #endif
352 
353  // Connection between hierarchy sheets
354  for( unsigned ii = 0; ii < size(); ii++ )
355  {
356  if( GetItem( ii )->m_Type == NET_SHEETLABEL
357  || GetItem( ii )->m_Type == NET_SHEETBUSLABELMEMBER )
358  sheetLabelConnect( GetItem( ii ) );
359  }
360 
361  // Sort objects by NetCode
363 
364 #if defined(NETLIST_DEBUG) && defined(DEBUG)
365  std::cout << "\n\nafter qsort()\n";
366  DumpNetTable();
367 #endif
368 
369  // Compress numbers of Netcode having consecutive values.
370  int NetCode = 0;
371  m_lastNetCode = 0;
372 
373  for( unsigned ii = 0; ii < size(); ii++ )
374  {
375  if( GetItem( ii )->GetNet() != m_lastNetCode )
376  {
377  NetCode++;
378  m_lastNetCode = GetItem( ii )->GetNet();
379  }
380 
381  GetItem( ii )->SetNet( NetCode );
382  }
383 
384  // Set the minimal connection info:
386 
387  // find the best label object to give the best net name to each net
389 
390  return true;
391 }
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 135 of file eeschema/netlist.cpp.

Referenced by ~NETLIST_OBJECT_LIST().

136 {
137  NETLIST_OBJECTS::iterator iter;
138 
139  for( iter = begin(); iter != end(); iter++ )
140  {
141  NETLIST_OBJECT* item = *iter;
142  delete item;
143  }
144 
145  clear();
146 }
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 638 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().

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

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

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

Referenced by TestOthersItems().

341  {
342  return GetItem( aIdx )->GetConnectionType();
343  }
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 335 of file class_netlist_object.h.

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

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

336  {
337  return GetItem( aIdx )->GetNet();
338  }
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 327 of file class_netlist_object.h.

References GetItem(), and NETLIST_OBJECT::m_Type.

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

328  {
329  return GetItem( aIdx )->m_Type;
330  }
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 848 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().

849 {
850  if( aLabelRef->GetNet() == 0 )
851  return;
852 
853  for( unsigned i = 0; i < size(); i++ )
854  {
855  NETLIST_OBJECT* item = GetItem( i );
856 
857  if( item->GetNet() == aLabelRef->GetNet() )
858  continue;
859 
860  if( item->m_SheetPath != aLabelRef->m_SheetPath )
861  {
862  if( item->m_Type != NET_PINLABEL && item->m_Type != NET_GLOBLABEL
863  && item->m_Type != NET_GLOBBUSLABELMEMBER )
864  continue;
865 
866  if( (item->m_Type == NET_GLOBLABEL
867  || item->m_Type == NET_GLOBBUSLABELMEMBER)
868  && item->m_Type != aLabelRef->m_Type )
869  //global labels only connect other global labels.
870  continue;
871  }
872 
873  // NET_HIERLABEL are used to connect sheets.
874  // NET_LABEL are local to a sheet
875  // NET_GLOBLABEL are global.
876  // NET_PINLABEL is a kind of global label (generated by a power pin invisible)
877  if( item->IsLabelType() )
878  {
879  if( item->m_Label != aLabelRef->m_Label )
880  continue;
881 
882  if( item->GetNet() )
883  propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
884  else
885  item->SetNet( aLabelRef->GetNet() );
886  }
887  }
888 }
#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 709 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().

710 {
711  int netCode;
712 
713  if( aIsBus == false ) // Objects other than BUS and BUSLABELS
714  {
715  netCode = aRef->GetNet();
716 
717  for( unsigned i = start; i < size(); i++ )
718  {
719  NETLIST_OBJECT* item = GetItem( i );
720 
721  if( item->m_SheetPath != aRef->m_SheetPath ) //used to be > (why?)
722  continue;
723 
724  switch( item->m_Type )
725  {
726  case NET_SEGMENT:
727  case NET_PIN:
728  case NET_LABEL:
729  case NET_HIERLABEL:
730  case NET_GLOBLABEL:
731  case NET_SHEETLABEL:
732  case NET_PINLABEL:
733  case NET_JUNCTION:
734  case NET_NOCONNECT:
735  if( aRef->m_Start == item->m_Start
736  || aRef->m_Start == item->m_End
737  || aRef->m_End == item->m_Start
738  || aRef->m_End == item->m_End )
739  {
740  if( item->GetNet() == 0 )
741  item->SetNet( netCode );
742  else
743  propagateNetCode( item->GetNet(), netCode, IS_WIRE );
744  }
745  break;
746 
747  case NET_BUS:
748  case NET_BUSLABELMEMBER:
753  break;
754  }
755  }
756  }
757  else // Object type BUS, BUSLABELS, and junctions.
758  {
759  netCode = aRef->m_BusNetCode;
760 
761  for( unsigned i = start; i < size(); i++ )
762  {
763  NETLIST_OBJECT* item = GetItem( i );
764 
765  if( item->m_SheetPath != aRef->m_SheetPath )
766  continue;
767 
768  switch( item->m_Type )
769  {
771  case NET_SEGMENT:
772  case NET_PIN:
773  case NET_LABEL:
774  case NET_HIERLABEL:
775  case NET_GLOBLABEL:
776  case NET_SHEETLABEL:
777  case NET_PINLABEL:
778  case NET_NOCONNECT:
779  break;
780 
781  case NET_BUS:
782  case NET_BUSLABELMEMBER:
786  case NET_JUNCTION:
787  if( aRef->m_Start == item->m_Start
788  || aRef->m_Start == item->m_End
789  || aRef->m_End == item->m_Start
790  || aRef->m_End == item->m_End )
791  {
792  if( item->m_BusNetCode == 0 )
793  item->m_BusNetCode = netCode;
794  else
795  propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
796  }
797  break;
798  }
799  }
800  }
801 }
#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 681 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().

682 {
683  if( aOldNetCode == aNewNetCode )
684  return;
685 
686  if( aIsBus == false ) // Propagate NetCode
687  {
688  for( unsigned jj = 0; jj < size(); jj++ )
689  {
690  NETLIST_OBJECT* object = GetItem( jj );
691 
692  if( object->GetNet() == aOldNetCode )
693  object->SetNet( aNewNetCode );
694  }
695  }
696  else // Propagate BusNetCode
697  {
698  for( unsigned jj = 0; jj < size(); jj++ )
699  {
700  NETLIST_OBJECT* object = GetItem( jj );
701 
702  if( object->m_BusNetCode == aOldNetCode )
703  object->m_BusNetCode = aNewNetCode;
704  }
705  }
706 }
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 363 of file class_netlist_object.h.

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

364  {
365  for( unsigned ii = 0; ii < size(); ii++ )
367  }
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 804 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().

806 {
807  for( unsigned i = aIdxStart; i < size(); i++ )
808  {
809  NETLIST_OBJECT* segment = GetItem( i );
810 
811  // if different sheets, obviously no physical connection between elements.
812  if( segment->m_SheetPath != aJonction->m_SheetPath )
813  continue;
814 
815  if( aIsBus == IS_WIRE )
816  {
817  if( segment->m_Type != NET_SEGMENT )
818  continue;
819  }
820  else
821  {
822  if( segment->m_Type != NET_BUS )
823  continue;
824  }
825 
826  if( IsPointOnSegment( segment->m_Start, segment->m_End, aJonction->m_Start ) )
827  {
828  // Propagation Netcode has all the objects of the same Netcode.
829  if( aIsBus == IS_WIRE )
830  {
831  if( segment->GetNet() )
832  propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
833  else
834  segment->SetNet( aJonction->GetNet() );
835  }
836  else
837  {
838  if( segment->m_BusNetCode )
839  propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
840  else
841  segment->m_BusNetCode = aJonction->m_BusNetCode;
842  }
843  }
844  }
845 }
#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 352 of file class_netlist_object.h.

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

Referenced by TestOthersItems().

353  {
354  GetItem( aIdx )->SetConnectionType( aFlg );
355  }
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 891 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().

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

609 {
610  if( SheetLabel->GetNet() == 0 )
611  return;
612 
613  for( unsigned ii = 0; ii < size(); ii++ )
614  {
615  NETLIST_OBJECT* ObjetNet = GetItem( ii );
616 
617  if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
618  continue; //use SheetInclude, not the sheet!!
619 
620  if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
621  continue;
622 
623  if( ObjetNet->GetNet() == SheetLabel->GetNet() )
624  continue; //already connected.
625 
626  if( ObjetNet->m_Label != SheetLabel->m_Label )
627  continue; //different names.
628 
629  // Propagate Netcode having all the objects of the same Netcode.
630  if( ObjetNet->GetNet() )
631  propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
632  else
633  ObjetNet->SetNet( SheetLabel->GetNet() );
634  }
635 }
#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 436 of file class_netlist_object.h.

References NETLIST_OBJECT::GetNet().

Referenced by SortListbyNetcode().

437  {
438  return Objet1->GetNet() < Objet2->GetNet();
439  }
static bool NETLIST_OBJECT_LIST::sortItemsBySheet ( const NETLIST_OBJECT Objet1,
const NETLIST_OBJECT Objet2 
)
inlinestaticprivate

Definition at line 443 of file class_netlist_object.h.

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

Referenced by SortListbySheet().

444  {
445  return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
446  }
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 149 of file eeschema/netlist.cpp.

References sortItemsbyNetcode().

Referenced by BuildNetListInfo().

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

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

References sortItemsBySheet().

Referenced by BuildNetListInfo().

156 {
157  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsBySheet );
158 }
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: