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

++eeschema:

    In netlist generation, changed the rule to calculate netnames of nets with labels:
    Previously, named nets (i.e. nets with local, hierarchical or global labels) have their name
    defined by the first label found in list.
    So net names could be changed without really changing the schematic.
    Now the names are calculated from the rules (by priority order) :
    1 - use the most top level labels in hierarchies.
    2 - use global labels first, local labels next (hidden power pins names are global labels).
    3 - use alphabetic sort (so, if GND and AGND are connected, the net will be always named AGND,
    and adding a VSS connection cannot change the net name)
    So power nets and nets that have more than one label cannot have their netname changed
    if there is no actual change relative to these nets names in schematic
parents ab056f3e 3543ba65
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -4,6 +4,22 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.

2010-jun-23, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++eeschema:
    In netlist generation, changed the rule to calculate netnames of nets with labels:
    Previously, named nets (i.e. nets with local, hierarchical or global labels) have their name
    defined by the first label found in list.
    So net names could be changed without really changing the schematic.
    Now the names are calculated from the rules (by priority order) :
    1 - use the most top level labels in hierarchies.
    2 - use global labels first, local labels next (hidden power pins names are global labels).
    3 - use alphabetic sort (so, if GND and AGND are connected, the net will be always named AGND,
    and adding a VSS connection cannot change the net name)
    So power nets and nets that have more than one label cannot have their netname changed
    if there is no actual change relative to these nets names in schematic


2010-Jun-17 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++eeschema:
+3 −3
Original line number Diff line number Diff line
update=12/06/2010 08:55:18
update=23/06/2010 18:43:01
last_client=pcbnew
[general]
version=1
@@ -17,8 +17,8 @@ NetDir=
[pcbnew]
version=1
PadDrlX=320
PadDimH=700
PadDimV=700
PadDimH=620
PadDimV=1100
BoardThickness=630
SgPcb45=1
TxtPcbV=800
+11 −6
Original line number Diff line number Diff line
@@ -116,8 +116,12 @@ NETLIST_OBJECT::NETLIST_OBJECT()
    m_FlagOfConnection = UNCONNECTED;
    m_PinNum = 0;                   /* pin number ( 1 long = 4 bytes -> 4 ascii codes) */
    m_Label  = 0;                   /* For all labels:pointer on the text label */
    m_NetNameCandidate = NULL;      /* a pointer to a NETLIST_OBJECT type label connected to this object
                                     *  used to give a name to the net
                                     */
}


// Copy constructor
NETLIST_OBJECT::NETLIST_OBJECT( NETLIST_OBJECT& aSource )
{
@@ -126,6 +130,7 @@ NETLIST_OBJECT::NETLIST_OBJECT( NETLIST_OBJECT& aSource )
                            // if this member is copied here (if 2 different items are owner of the same object)
}


NETLIST_OBJECT::~NETLIST_OBJECT()
{
    /* NETLIST_OBJECT is owner of m_Label only if its type is
+10 −6
Original line number Diff line number Diff line
@@ -90,6 +90,10 @@ public:
                                        // starting point
    wxPoint         m_End;              // For segments (wire and buses):
                                        // ending point
    NETLIST_OBJECT* m_NetNameCandidate; /* a pointer to a label connected to the net,
                                         * that can be used to give a name to the net
                                         * NULL if no usable label
                                         */

#if defined(DEBUG)
    void Show( std::ostream& out, int ndx );
+39 −71
Original line number Diff line number Diff line
@@ -212,43 +212,29 @@ static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
    wxString NetName;

    if( (netcode == 0 ) || ( Pin->m_FlagOfConnection != PAD_CONNECT ) )
    {
        return NetName;
    }
    else
    {
        unsigned jj;
        for( jj = 0; jj < g_NetObjectslist.size(); jj++ )
        {
            if( g_NetObjectslist[jj]->GetNet() != netcode )
                continue;
            if( ( g_NetObjectslist[jj]->m_Type != NET_HIERLABEL)
               && ( g_NetObjectslist[jj]->m_Type != NET_LABEL)
               && ( g_NetObjectslist[jj]->m_Type != NET_PINLABEL) )
                continue;

            NetName = *g_NetObjectslist[jj]->m_Label;
            break;
        }
    NETLIST_OBJECT* netref = Pin->m_NetNameCandidate;
    if( netref )
        NetName = *netref->m_Label;

    if( !NetName.IsEmpty() )
    {
            if( g_NetObjectslist[jj]->m_Type != NET_PINLABEL )
        // prefix non global labels names by the sheet path, to avoid names collisions
        if( netref->m_Type != NET_PINLABEL )
        {
            wxString lnet = NetName;
                NetName = g_NetObjectslist[jj]->m_SheetList.PathHumanReadable();
            NetName = netref->m_SheetList.PathHumanReadable();

            // If sheet path is too long, use the time stamp name instead
            if( NetName.Length() > 32 )
                    NetName = g_NetObjectslist[jj]->m_SheetList.Path();
                NetName = netref->m_SheetList.Path();
            NetName += lnet;
        }
    }
    else
        {
        NetName.Printf( DefaultFormatNetname.GetData(), netcode );
        }
    }

    return NetName;
}

@@ -890,31 +876,22 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
        {
            SameNetcodeCount = 0;              // Items count for this net
            NetName.Empty();
            unsigned jj;

            // Find a label (if exists) for this net.
            for( jj = 0; jj < aObjectsList.size(); jj++ )
            {
                if( aObjectsList[jj]->GetNet() != NetCode )
                    continue;
                if( ( aObjectsList[jj]->m_Type != NET_HIERLABEL)
                   && ( aObjectsList[jj]->m_Type != NET_LABEL)
                   && ( aObjectsList[jj]->m_Type != NET_PINLABEL) )
                    continue;

                NetName = *aObjectsList[jj]->m_Label;
                break;
            }
            NETLIST_OBJECT* netref;
            netref = aObjectsList[ii]->m_NetNameCandidate;
            if( netref )
                NetName = *netref->m_Label;

            NetcodeName.Printf( wxT( "Net %d " ), NetCode );
            NetcodeName += wxT( "\"" );
            if( !NetName.IsEmpty() )
            {
                if( aObjectsList[jj]->m_Type != NET_PINLABEL )
                if( netref->m_Type != NET_PINLABEL )
                {
                    // usual net name, prefix it by the sheet path
                    NetcodeName +=
                        aObjectsList[jj]->m_SheetList.PathHumanReadable();
                        netref->m_SheetList.PathHumanReadable();
                }
                NetcodeName += NetName;
            }
@@ -957,6 +934,7 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
        if( SameNetcodeCount >= 2 )
            fprintf( f, " %s %.4s\n", CONV_TO_UTF8( CmpRef ),
                     (const char*) &aObjectsList[ii]->m_PinNum );
        
    }
}

@@ -1069,7 +1047,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
    wxString InitNetDesc  = StartLine + wxT( "ADD_TER" );
    wxString StartNetDesc = StartLine + wxT( "TER" );
    wxString NetcodeName, InitNetDescLine;
    unsigned ii, jj;
    unsigned ii;
    int print_ter = 0;
    int NetCode, LastNetCode = -1;
    SCH_COMPONENT* Cmp;
@@ -1084,31 +1062,21 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
        if( ( NetCode = aObjectsList[ii]->GetNet() ) != LastNetCode )
        {
            NetName.Empty();
            for( jj = 0; jj < aObjectsList.size(); jj++ )
            {
                if( aObjectsList[jj]->GetNet() != NetCode )
                    continue;
                if( ( aObjectsList[jj]->m_Type != NET_HIERLABEL)
                   && ( aObjectsList[jj]->m_Type != NET_LABEL)
                   && ( aObjectsList[jj]->m_Type != NET_PINLABEL) )
                    continue;

                NetName = *aObjectsList[jj]->m_Label; break;
            }
            NETLIST_OBJECT* netref;
            netref = aObjectsList[ii]->m_NetNameCandidate;
            if( netref )
                NetName = *netref->m_Label;

            NetcodeName = wxT( "\"" );
            if( !NetName.IsEmpty() )
            {
                NetcodeName += NetName;
                if( aObjectsList[jj]->m_Type != NET_PINLABEL )
                if( netref->m_Type != NET_PINLABEL )
                {
                    NetcodeName =
                        aObjectsList[jj]->m_SheetList.PathHumanReadable()
                        + NetcodeName;

                    //NetcodeName << wxT("_") <<
                    //    g_NetObjectslist[jj].m_SheetList.PathHumanReadable();
                    // usual net name, prefix it by the sheet path
                    NetcodeName +=
                        netref->m_SheetList.PathHumanReadable();
                }
                NetcodeName += NetName;
            }
            else  // this net has no name: create a default name $<net number>
                NetcodeName << wxT( "$" ) << NetCode;
@@ -1139,10 +1107,10 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
            buf[4]     = 0;
            str_pinnum = CONV_FROM_UTF8( buf );
            InitNetDescLine.Printf( wxT( "\n%s   %s   %.4s     %s" ),
                                    InitNetDesc.GetData(),
                                    refstr.GetData(),
                                    str_pinnum.GetData(),
                                    NetcodeName.GetData() );
                                    GetChars(InitNetDesc),
                                    GetChars(refstr),
                                    GetChars(str_pinnum),
                                    GetChars(NetcodeName) );
        }
            print_ter++;
            break;
@@ -1165,9 +1133,9 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )

        aObjectsList[ii]->m_Flag = 1;

        // Search for redundant pins to avoid generation the same connection
        // Search for redundant pins to avoid generation of the same connection
        // more than once.
        for( jj = ii + 1; jj < aObjectsList.size(); jj++ )
        for( unsigned jj = ii + 1; jj < aObjectsList.size(); jj++ )
        {
            if( aObjectsList[jj]->GetNet() != NetCode )
                break;
Loading