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 <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 284 of file 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 296 of file netlist_object.h.

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

Definition at line 48 of file netlist_object_list.cpp.

References Clear().

49 {
50  Clear();
51 }
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 80 of file netlist_object_list.cpp.

References connectBusLabels(), findBestNetNameForEachNet(), SCH_SCREEN::GetDrawItems(), GetItem(), NETLIST_OBJECT::GetNet(), i, 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().

81 {
82  SCH_SHEET_PATH* sheet;
83 
84  // Fill list with connected items from the flattened sheet list
85  for( unsigned i = 0; i < aSheets.size(); i++ )
86  {
87  sheet = &aSheets[i];
88 
89  for( SCH_ITEM* item = sheet->LastScreen()->GetDrawItems(); item; item = item->Next() )
90  {
91  item->GetNetListItem( *this, sheet );
92  }
93  }
94 
95  if( size() == 0 )
96  return false;
97 
98  // Sort objects by Sheet
100 
101  sheet = &(GetItem( 0 )->m_SheetPath);
103 
104  for( unsigned ii = 0, istart = 0; ii < size(); ii++ )
105  {
106  NETLIST_OBJECT* net_item = GetItem( ii );
107 
108  if( net_item->m_SheetPath != *sheet ) // Sheet change
109  {
110  sheet = &(net_item->m_SheetPath);
111  istart = ii;
112  }
113 
114  switch( net_item->m_Type )
115  {
117  wxMessageBox( wxT( "BuildNetListInfo() error" ) );
118  break;
119 
120  case NET_PIN:
121  case NET_PINLABEL:
122  case NET_SHEETLABEL:
123  case NET_NOCONNECT:
124  if( net_item->GetNet() != 0 )
125  break;
126 
127  case NET_SEGMENT:
128  // Test connections point to point type without bus.
129  if( net_item->GetNet() == 0 )
130  {
131  net_item->SetNet( m_lastNetCode );
132  m_lastNetCode++;
133  }
134 
135  pointToPointConnect( net_item, IS_WIRE, istart );
136  break;
137 
138  case NET_JUNCTION:
139  // Control of the junction outside BUS.
140  if( net_item->GetNet() == 0 )
141  {
142  net_item->SetNet( m_lastNetCode );
143  m_lastNetCode++;
144  }
145 
146  segmentToPointConnect( net_item, IS_WIRE, istart );
147 
148  // Control of the junction, on BUS.
149  if( net_item->m_BusNetCode == 0 )
150  {
151  net_item->m_BusNetCode = m_lastBusNetCode;
153  }
154 
155  segmentToPointConnect( net_item, IS_BUS, istart );
156  break;
157 
158  case NET_LABEL:
159  case NET_HIERLABEL:
160  case NET_GLOBLABEL:
161  // Test connections type junction without bus.
162  if( net_item->GetNet() == 0 )
163  {
164  net_item->SetNet( m_lastNetCode );
165  m_lastNetCode++;
166  }
167 
168  segmentToPointConnect( net_item, IS_WIRE, istart );
169  break;
170 
172  if( net_item->m_BusNetCode != 0 )
173  break;
174 
175  case NET_BUS:
176  // Control type connections point to point mode bus
177  if( net_item->m_BusNetCode == 0 )
178  {
179  net_item->m_BusNetCode = m_lastBusNetCode;
181  }
182 
183  pointToPointConnect( net_item, IS_BUS, istart );
184  break;
185 
186  case NET_BUSLABELMEMBER:
189  // Control connections similar has on BUS
190  if( net_item->GetNet() == 0 )
191  {
192  net_item->m_BusNetCode = m_lastBusNetCode;
194  }
195 
196  segmentToPointConnect( net_item, IS_BUS, istart );
197  break;
198  }
199  }
200 
201 #if defined(NETLIST_DEBUG) && defined(DEBUG)
202  std::cout << "\n\nafter sheet local\n\n";
203  DumpNetTable();
204 #endif
205 
206  // Updating the Bus Labels Netcode connected by Bus
208 
209  // Group objects by label.
210  for( unsigned ii = 0; ii < size(); ii++ )
211  {
212  switch( GetItem( ii )->m_Type )
213  {
214  case NET_PIN:
215  case NET_SHEETLABEL:
216  case NET_SEGMENT:
217  case NET_JUNCTION:
218  case NET_BUS:
219  case NET_NOCONNECT:
220  break;
221 
222  case NET_LABEL:
223  case NET_GLOBLABEL:
224  case NET_PINLABEL:
225  case NET_BUSLABELMEMBER:
227  labelConnect( GetItem( ii ) );
228  break;
229 
231  case NET_HIERLABEL:
233  break;
234 
236  break;
237  }
238  }
239 
240 #if defined(NETLIST_DEBUG) && defined(DEBUG)
241  std::cout << "\n\nafter sheet global\n\n";
242  DumpNetTable();
243 #endif
244 
245  // Connection between hierarchy sheets
246  for( unsigned ii = 0; ii < size(); ii++ )
247  {
248  if( GetItem( ii )->m_Type == NET_SHEETLABEL
249  || GetItem( ii )->m_Type == NET_SHEETBUSLABELMEMBER )
250  sheetLabelConnect( GetItem( ii ) );
251  }
252 
253  // Sort objects by NetCode
255 
256 #if defined(NETLIST_DEBUG) && defined(DEBUG)
257  std::cout << "\n\nafter qsort()\n";
258  DumpNetTable();
259 #endif
260 
261  // Compress numbers of Netcode having consecutive values.
262  int NetCode = 0;
263  m_lastNetCode = 0;
264 
265  for( unsigned ii = 0; ii < size(); ii++ )
266  {
267  if( GetItem( ii )->GetNet() != m_lastNetCode )
268  {
269  NetCode++;
270  m_lastNetCode = GetItem( ii )->GetNet();
271  }
272 
273  GetItem( ii )->SetNet( NetCode );
274  }
275 
276  // Set the minimal connection info:
278 
279  // find the best label object to give the best net name to each net
281 
282  return true;
283 }
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...
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
#define IS_BUS
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...
int GetNet() const
#define IS_WIRE
Class SCH_SHEET_PATH.
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:160
size_t i
Definition: json11.cpp:597
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 54 of file netlist_object_list.cpp.

Referenced by ~NETLIST_OBJECT_LIST().

55 {
56  NETLIST_OBJECTS::iterator iter;
57 
58  for( iter = begin(); iter != end(); iter++ )
59  {
60  NETLIST_OBJECT* item = *iter;
61  delete item;
62  }
63 
64  clear();
65 }
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.

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

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 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
int GetNet() const
bool IsLabelBusMemberType() const
Function IsLabelBusMemberType.
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
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 564 of file erc.cpp.

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

565 {
566  int count = 0;
567  int curr_net = GetItemNet( aNetStart );
568 
569  /* Test pins connected to NetItemRef */
570  for( unsigned item = aNetStart; item < size(); item++ )
571  {
572  // We examine only a given net. We stop the search if the net changes
573  if( curr_net != GetItemNet( item ) ) // End of net
574  break;
575 
576  if( GetItemType( item ) == NET_PIN )
577  count++;
578  }
579 
580  return count;
581 }
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 352 of file netlist_object_list.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().

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

Definition at line 339 of file netlist_object.h.

Referenced by TestOthersItems().

340  {
341  return GetItem( aIdx )->GetConnectionType();
342  }
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 334 of file netlist_object.h.

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

335  {
336  return GetItem( aIdx )->GetNet();
337  }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
int GetNet() const
NETLIST_ITEM_T NETLIST_OBJECT_LIST::GetItemType ( unsigned  aIdx) const
inline

Acces to an item type.

Definition at line 326 of file netlist_object.h.

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

327  {
328  return GetItem( aIdx )->m_Type;
329  }
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 740 of file netlist_object_list.cpp.

References GetItem(), NETLIST_OBJECT::GetNet(), i, 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().

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  {
754  if( item->m_Type != NET_PINLABEL && item->m_Type != NET_GLOBLABEL
755  && item->m_Type != NET_GLOBBUSLABELMEMBER )
756  continue;
757 
758  if( (item->m_Type == NET_GLOBLABEL
759  || item->m_Type == NET_GLOBBUSLABELMEMBER)
760  && item->m_Type != aLabelRef->m_Type )
761  //global labels only connect other global labels.
762  continue;
763  }
764 
765  // NET_HIERLABEL are used to connect sheets.
766  // NET_LABEL are local to a sheet
767  // NET_GLOBLABEL are global.
768  // NET_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 }
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.
int GetNet() const
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
size_t i
Definition: json11.cpp:597
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::pointToPointConnect ( NETLIST_OBJECT aRef,
bool  aIsBus,
int  start 
)
private

Definition at line 601 of file netlist_object_list.cpp.

References GetItem(), NETLIST_OBJECT::GetNet(), i, 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().

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  {
618  case NET_SEGMENT:
619  case NET_PIN:
620  case NET_LABEL:
621  case NET_HIERLABEL:
622  case NET_GLOBLABEL:
623  case NET_SHEETLABEL:
624  case NET_PINLABEL:
625  case NET_JUNCTION:
626  case NET_NOCONNECT:
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 NET_BUS:
640  case NET_BUSLABELMEMBER:
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  {
663  case NET_SEGMENT:
664  case NET_PIN:
665  case NET_LABEL:
666  case NET_HIERLABEL:
667  case NET_GLOBLABEL:
668  case NET_SHEETLABEL:
669  case NET_PINLABEL:
670  case NET_NOCONNECT:
671  break;
672 
673  case NET_BUS:
674  case NET_BUSLABELMEMBER:
678  case NET_JUNCTION:
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 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
#define IS_BUS
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
int GetNet() const
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
size_t i
Definition: json11.cpp:597
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::propagateNetCode ( int  aOldNetCode,
int  aNewNetCode,
bool  aIsBus 
)
private

Definition at line 573 of file netlist_object_list.cpp.

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

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

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 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
int GetNet() const
void SetNet(int aNetCode)
void NETLIST_OBJECT_LIST::ResetConnectionsType ( )
inline

Reset the connection type of all items to UNCONNECTED type.

Definition at line 362 of file netlist_object.h.

References UNCONNECTED.

363  {
364  for( unsigned ii = 0; ii < size(); ii++ )
366  }
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 696 of file netlist_object_list.cpp.

References GetItem(), NETLIST_OBJECT::GetNet(), i, 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().

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 != NET_SEGMENT )
710  continue;
711  }
712  else
713  {
714  if( segment->m_Type != NET_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 }
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
int GetNet() const
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
size_t i
Definition: json11.cpp:597
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 351 of file netlist_object.h.

Referenced by TestOthersItems().

352  {
353  GetItem( aIdx )->SetConnectionType( aFlg );
354  }
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 783 of file netlist_object_list.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().

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

501 {
502  if( SheetLabel->GetNet() == 0 )
503  return;
504 
505  for( unsigned ii = 0; ii < size(); ii++ )
506  {
507  NETLIST_OBJECT* ObjetNet = GetItem( ii );
508 
509  if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
510  continue; //use SheetInclude, not the sheet!!
511 
512  if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_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 }
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
int GetNet() const
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
void SetNet(int aNetCode)
static bool NETLIST_OBJECT_LIST::sortItemsbyNetcode ( const NETLIST_OBJECT Objet1,
const NETLIST_OBJECT Objet2 
)
inlinestaticprivate

Definition at line 435 of file netlist_object.h.

References NETLIST_OBJECT::GetNet().

Referenced by SortListbyNetcode().

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

Definition at line 442 of file netlist_object.h.

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

Referenced by SortListbySheet().

443  {
444  return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
445  }
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 68 of file netlist_object_list.cpp.

References sortItemsbyNetcode().

Referenced by BuildNetListInfo().

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

Definition at line 74 of file netlist_object_list.cpp.

References sortItemsBySheet().

Referenced by BuildNetListInfo().

75 {
76  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsBySheet );
77 }
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 another suitable label.

Definition at line 642 of file erc.cpp.

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

643 {
644  unsigned netItemTst = aStartNet;
645  int erc = 1;
646 
647  // Review the list of labels connected to NetItemRef:
648  for( ; ; netItemTst++ )
649  {
650  if( netItemTst == aNetItemRef )
651  continue;
652 
653  /* Is always in the same net? */
654  if( ( netItemTst == size() )
655  || ( GetItemNet( aNetItemRef ) != GetItemNet( netItemTst ) ) )
656  {
657  /* End Netcode found. */
658  if( erc )
659  {
660  /* Glabel or SheetLabel orphaned. */
661  Diagnose( GetItem( aNetItemRef ), NULL, -1, WAR );
662  }
663 
664  return;
665  }
666 
667  if( GetItem( aNetItemRef )->IsLabelConnected( GetItem( netItemTst ) ) )
668  erc = 0;
669 
670  //same thing, different order.
671  if( GetItem( netItemTst )->IsLabelConnected( GetItem( aNetItemRef ) ) )
672  erc = 0;
673  }
674 }
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:294
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 716 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().

717 {
718  // Similar labels which are different when using case sensitive comparisons
719  // but are equal when using case insensitive comparisons
720 
721  // list of all labels (used the better item to build diag messages)
722  std::vector<NETLIST_OBJECT*> fullLabelList;
723  // list of all labels , each label appears only once (used to to detect similar labels)
724  std::set<NETLIST_OBJECT*, compare_labels> uniqueLabelList;
725  wxString msg;
726 
727  // Build a list of differents labels. If inside a given sheet there are
728  // more than one given label, only one label is stored.
729  // not also the sheet labels are not taken in account for 2 reasons:
730  // * they are in the root sheet but they are seen only from the child sheet
731  // * any mismatch between child sheet hierarchical labels and the sheet label
732  // already detected by ERC
733  for( unsigned netItem = 0; netItem < size(); ++netItem )
734  {
735  switch( GetItemType( netItem ) )
736  {
737  case NET_LABEL:
738  case NET_BUSLABELMEMBER:
739  case NET_PINLABEL:
741  case NET_HIERLABEL:
743  case NET_GLOBLABEL:
744  // add this label in lists
745  uniqueLabelList.insert( GetItem( netItem ) );
746  fullLabelList.push_back( GetItem( netItem ) );
747  break;
748 
749  case NET_SHEETLABEL:
751  default:
752  break;
753  }
754  }
755 
756  // build global labels and compare
757  std::set<NETLIST_OBJECT*, compare_label_names> loc_labelList;
758  std::set<NETLIST_OBJECT*>::const_iterator it;
759 
760  for( it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
761  {
762  if( (*it)->IsLabelGlobal() )
763  loc_labelList.insert( *it );
764  }
765 
766  // compare global labels (same label names appears only once in list)
767  for( it = loc_labelList.begin(); it != loc_labelList.end(); ++it )
768  {
769  std::set<NETLIST_OBJECT*>::const_iterator it_aux = it;
770 
771  for( ++it_aux; it_aux != loc_labelList.end(); ++it_aux )
772  {
773  if( (*it)->m_Label.CmpNoCase( (*it_aux)->m_Label ) == 0 )
774  {
775  // Create new marker for ERC.
776  int cntA = countIndenticalLabels( fullLabelList, *it );
777  int cntB = countIndenticalLabels( fullLabelList, *it_aux );
778 
779  if( cntA <= cntB )
780  SimilarLabelsDiagnose( (*it), (*it_aux) );
781  else
782  SimilarLabelsDiagnose( (*it_aux), (*it) );
783  }
784  }
785  }
786 
787  // Build paths list
788  std::set<NETLIST_OBJECT*, compare_paths> pathsList;
789 
790  for( it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
791  pathsList.insert( *it );
792 
793  // Examine each label inside a sheet path:
794  for( it = pathsList.begin(); it != pathsList.end(); ++it )
795  {
796  loc_labelList.clear();
797 
798  std::set<NETLIST_OBJECT*>::const_iterator it_aux = uniqueLabelList.begin();
799 
800  for( ; it_aux != uniqueLabelList.end(); ++it_aux )
801  {
802  if( (*it)->m_SheetPath.Path() == (*it_aux)->m_SheetPath.Path() )
803  loc_labelList.insert( *it_aux );
804  }
805 
806  // at this point, loc_labelList contains labels of the current sheet path.
807  // Detect similar labels (same label names appears only once in list)
808  std::set<NETLIST_OBJECT*>::const_iterator ref_it;
809 
810  for( ref_it = loc_labelList.begin(); ref_it != loc_labelList.end(); ++ref_it )
811  {
812  NETLIST_OBJECT* ref_item = *ref_it;
813  it_aux = ref_it;
814 
815  for( ++it_aux; it_aux != loc_labelList.end(); ++it_aux )
816  {
817  // global label versus global label was already examined.
818  // here, at least one label must be local
819  if( ref_item->IsLabelGlobal() && (*it_aux)->IsLabelGlobal() )
820  continue;
821 
822  if( ref_item->m_Label.CmpNoCase( (*it_aux)->m_Label ) == 0 )
823  {
824  // Create new marker for ERC.
825  int cntA = countIndenticalLabels( fullLabelList, ref_item );
826  int cntB = countIndenticalLabels( fullLabelList, *it_aux );
827 
828  if( cntA <= cntB )
829  SimilarLabelsDiagnose( ref_item, (*it_aux) );
830  else
831  SimilarLabelsDiagnose( (*it_aux), ref_item );
832  }
833  }
834  }
835  }
836 }
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:841
static void SimilarLabelsDiagnose(NETLIST_OBJECT *aItemA, NETLIST_OBJECT *aItemB)
Definition: erc.cpp:871

Member Data Documentation

int NETLIST_OBJECT_LIST::m_lastBusNetCode
private

Definition at line 287 of file netlist_object.h.

Referenced by BuildNetListInfo().

int NETLIST_OBJECT_LIST::m_lastNetCode
private

Definition at line 286 of file netlist_object.h.

Referenced by BuildNetListInfo(), and connectBusLabels().


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