Commit 7a92a96a authored by jean-pierre charras's avatar jean-pierre charras
Browse files

netlist: refinements in net name selection

parent 75e613f6
Loading
Loading
Loading
Loading
+22 −8
Original line number Original line Diff line number Diff line
@@ -414,18 +414,32 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
            // because they have no sheetpath as prefix name
            // because they have no sheetpath as prefix name
            // for other labels, we select them before by sheet deep order
            // for other labels, we select them before by sheet deep order
            // because the actual name is /sheetpath/label
            // because the actual name is /sheetpath/label
            // and for a given path lenght, by alphabetic order
            // and for a given path length, by alphabetic order
            if( ( item_priority < PRIO_MAX-1 ) &&    // Not a global label or pin label
            
                candidate->m_SheetList.Path().Length() < item->m_SheetList.Path().Length() )
            if( item_priority >= PRIO_MAX-1 )     // global label or pin label
            {   // selection by alphabetic order:
                if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
                    item = candidate;
            }
            else    // not global: names are prefixed by their sheetpath
            {
                // use name defined in highter hierarchical sheet
                // (i.e. shorter path because paths are /<timestamp1>/<timestamp2>/...
                // and timestamp = 8 letters.
                if( candidate->m_SheetList.Path().Length() < item->m_SheetList.Path().Length() )
                {
                {
                    item = candidate;
                    item = candidate;
                }
                }
            else if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
                else if( candidate->m_SheetList.Path().Length() == item->m_SheetList.Path().Length() )
                {
                {
                    // For labels on sheets having an equivalent deep in hierarchy, use
                    // alphabetic label name order:
                    if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
                        item = candidate;
                        item = candidate;
                }
                }
            }
            }
        }
        }
    }


    return item;
    return item;
}
}