Ejemplo n.º 1
0
void NETLIST_OBJECT_LIST::propagateNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus )
{
    if( aOldNetCode == aNewNetCode )
        return;

    if( aIsBus == false )    // Propagate NetCode
    {
        for( unsigned jj = 0; jj < size(); jj++ )
        {
            NETLIST_OBJECT* object = GetItem( jj );

            if( object->GetNet() == aOldNetCode )
                object->SetNet( aNewNetCode );
        }
    }
    else               // Propagate BusNetCode
    {
        for( unsigned jj = 0; jj < size(); jj++ )
        {
            NETLIST_OBJECT* object = GetItem( jj );

            if( object->m_BusNetCode == aOldNetCode )
                object->m_BusNetCode = aNewNetCode;
        }
    }
}
Ejemplo n.º 2
0
void NETLIST_OBJECT_LIST::sheetLabelConnect( NETLIST_OBJECT* SheetLabel )
{
    if( SheetLabel->GetNet() == 0 )
        return;

    for( unsigned ii = 0; ii < size(); ii++ )
    {
        NETLIST_OBJECT* ObjetNet = GetItem( ii );

        if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
            continue;  //use SheetInclude, not the sheet!!

        if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
            continue;

        if( ObjetNet->GetNet() == SheetLabel->GetNet() )
            continue;  //already connected.

        if( ObjetNet->m_Label != SheetLabel->m_Label )
            continue;  //different names.

        // Propagate Netcode having all the objects of the same Netcode.
        if( ObjetNet->GetNet() )
            propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
        else
            ObjetNet->SetNet( SheetLabel->GetNet() );
    }
}
Ejemplo n.º 3
0
void NETLIST_OBJECT_LIST::connectBusLabels()
{
    // Propagate the net code between all bus label member objects connected by they name.
    // If the net code is not yet existing, a new one is created
    // Search is done in the entire list
    for( unsigned ii = 0; ii < size(); ii++ )
    {
        NETLIST_OBJECT* Label = GetItem( ii );

        if( Label->IsLabelBusMemberType() )
        {
            if( Label->GetNet() == 0 )
            {
                // Not yet existiing net code: create a new one.
                Label->SetNet( m_lastNetCode );
                m_lastNetCode++;
            }

            for( unsigned jj = ii + 1; jj < size(); jj++ )
            {
                NETLIST_OBJECT* LabelInTst =  GetItem( jj );

                if( LabelInTst->IsLabelBusMemberType() )
                {
                    if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
                        continue;

                    if( LabelInTst->m_Member != Label->m_Member )
                        continue;

                    if( LabelInTst->GetNet() == 0 )
                        // Append this object to the current net
                        LabelInTst->SetNet( Label->GetNet() );
                    else
                        // Merge the 2 net codes, they are connected.
                        propagateNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
                }
            }
        }
    }
}
Ejemplo n.º 4
0
void NETLIST_OBJECT_LIST::connectBusLabels()
{
    for( unsigned ii = 0; ii < size(); ii++ )
    {
        NETLIST_OBJECT* Label = GetItem( ii );

        if(  (Label->m_Type == NET_SHEETBUSLABELMEMBER)
          || (Label->m_Type == NET_BUSLABELMEMBER)
          || (Label->m_Type == NET_HIERBUSLABELMEMBER) )
        {
            if( Label->GetNet() == 0 )
            {
                Label->SetNet( m_lastNetCode );
                m_lastNetCode++;
            }

            for( unsigned jj = ii + 1; jj < size(); jj++ )
            {
                NETLIST_OBJECT* LabelInTst =  GetItem( jj );
                if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
                   || (LabelInTst->m_Type == NET_BUSLABELMEMBER)
                   || (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
                {
                    if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
                        continue;

                    if( LabelInTst->m_Member != Label->m_Member )
                        continue;

                    if( LabelInTst->GetNet() == 0 )
                        LabelInTst->SetNet( Label->GetNet() );
                    else
                        propageNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
                }
            }
        }
    }
}
Ejemplo n.º 5
0
void NETLIST_OBJECT_LIST::segmentToPointConnect( NETLIST_OBJECT* aJonction,
                                                 bool aIsBus, int aIdxStart )
{
    for( unsigned i = aIdxStart; i < size(); i++ )
    {
        NETLIST_OBJECT* segment = GetItem( i );

        // if different sheets, obviously no physical connection between elements.
        if( segment->m_SheetPath != aJonction->m_SheetPath )
            continue;

        if( aIsBus == IS_WIRE )
        {
            if( segment->m_Type != NET_SEGMENT )
                continue;
        }
        else
        {
            if( segment->m_Type != NET_BUS )
                continue;
        }

        if( IsPointOnSegment( segment->m_Start, segment->m_End, aJonction->m_Start ) )
        {
            // Propagation Netcode has all the objects of the same Netcode.
            if( aIsBus == IS_WIRE )
            {
                if( segment->GetNet() )
                    propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
                else
                    segment->SetNet( aJonction->GetNet() );
            }
            else
            {
                if( segment->m_BusNetCode )
                    propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
                else
                    segment->m_BusNetCode = aJonction->m_BusNetCode;
            }
        }
    }
}
Ejemplo n.º 6
0
void NETLIST_OBJECT_LIST::labelConnect( NETLIST_OBJECT* aLabelRef )
{
    if( aLabelRef->GetNet() == 0 )
        return;

    for( unsigned i = 0; i < size(); i++ )
    {
        NETLIST_OBJECT* item = GetItem( i );

        if( item->GetNet() == aLabelRef->GetNet() )
            continue;

        if( item->m_SheetPath != aLabelRef->m_SheetPath )
        {
            if( item->m_Type != NET_PINLABEL && item->m_Type != NET_GLOBLABEL
                && item->m_Type != NET_GLOBBUSLABELMEMBER )
                continue;

            if( (item->m_Type == NET_GLOBLABEL
                 || item->m_Type == NET_GLOBBUSLABELMEMBER)
               && item->m_Type != aLabelRef->m_Type )
                //global labels only connect other global labels.
                continue;
        }

        // NET_HIERLABEL are used to connect sheets.
        // NET_LABEL are local to a sheet
        // NET_GLOBLABEL are global.
        // NET_PINLABEL is a kind of global label (generated by a power pin invisible)
        if( item->IsLabelType() )
        {
            if( item->m_Label != aLabelRef->m_Label )
                continue;

            if( item->GetNet() )
                propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
            else
                item->SetNet( aLabelRef->GetNet() );
        }
    }
}
Ejemplo n.º 7
0
void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus, int start )
{
    int netCode;

    if( aIsBus == false )    // Objects other than BUS and BUSLABELS
    {
        netCode = aRef->GetNet();

        for( unsigned i = start; i < size(); i++ )
        {
            NETLIST_OBJECT* item = GetItem( i );

            if( item->m_SheetPath != aRef->m_SheetPath )  //used to be > (why?)
                continue;

            switch( item->m_Type )
            {
            case NET_SEGMENT:
            case NET_PIN:
            case NET_LABEL:
            case NET_HIERLABEL:
            case NET_GLOBLABEL:
            case NET_SHEETLABEL:
            case NET_PINLABEL:
            case NET_JUNCTION:
            case NET_NOCONNECT:
                if( aRef->m_Start == item->m_Start
                    || aRef->m_Start == item->m_End
                    || aRef->m_End   == item->m_Start
                    || aRef->m_End   == item->m_End )
                {
                    if( item->GetNet() == 0 )
                        item->SetNet( netCode );
                    else
                        propagateNetCode( item->GetNet(), netCode, IS_WIRE );
                }
                break;

            case NET_BUS:
            case NET_BUSLABELMEMBER:
            case NET_SHEETBUSLABELMEMBER:
            case NET_HIERBUSLABELMEMBER:
            case NET_GLOBBUSLABELMEMBER:
            case NET_ITEM_UNSPECIFIED:
                break;
            }
        }
    }
    else    // Object type BUS, BUSLABELS, and junctions.
    {
        netCode = aRef->m_BusNetCode;

        for( unsigned i = start; i < size(); i++ )
        {
            NETLIST_OBJECT* item = GetItem( i );

            if( item->m_SheetPath != aRef->m_SheetPath )
                continue;

            switch( item->m_Type )
            {
            case NET_ITEM_UNSPECIFIED:
            case NET_SEGMENT:
            case NET_PIN:
            case NET_LABEL:
            case NET_HIERLABEL:
            case NET_GLOBLABEL:
            case NET_SHEETLABEL:
            case NET_PINLABEL:
            case NET_NOCONNECT:
                break;

            case NET_BUS:
            case NET_BUSLABELMEMBER:
            case NET_SHEETBUSLABELMEMBER:
            case NET_HIERBUSLABELMEMBER:
            case NET_GLOBBUSLABELMEMBER:
            case NET_JUNCTION:
                if(  aRef->m_Start == item->m_Start
                  || aRef->m_Start == item->m_End
                  || aRef->m_End   == item->m_Start
                  || aRef->m_End   == item->m_End )
                {
                    if( item->m_BusNetCode == 0 )
                        item->m_BusNetCode = netCode;
                    else
                        propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
                }
                break;
            }
        }
    }
}