fixed bug: labels, hierarchal labels, global labels, as well as their busmember

counterparts, will be connected together if they have the same label (name) and are on the same sheet.
This commit is contained in:
lifekidyeaa 2008-02-15 05:32:33 +00:00
parent 60651486bd
commit 8e4e0fb56a
2 changed files with 20 additions and 14 deletions

View File

@ -167,7 +167,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
Pinsheet = m_Label; Pinsheet = m_Label;
while( Pinsheet ) while( Pinsheet )
{ {
/* Search Glabel corresponding to this Pinsheet */ /* Search Hlabel corresponding to this Pinsheet */
EDA_BaseStruct* DrawStruct = m_s->EEDrawList; EDA_BaseStruct* DrawStruct = m_s->EEDrawList;
DrawHierLabelStruct* HLabel = NULL; DrawHierLabelStruct* HLabel = NULL;

View File

@ -12,6 +12,7 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h" #include "protos.h"
//#define NETLIST_DEBUG
/* Routines locales */ /* Routines locales */
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ); static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
@ -301,7 +302,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
} }
#if 0 && defined(DEBUG) #if defined(NETLIST_DEBUG) && defined(DEBUG)
std::cout << "\n\nafter sheet local\n\n"; std::cout << "\n\nafter sheet local\n\n";
dumpNetTable(); dumpNetTable();
#endif #endif
@ -342,7 +343,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
} }
} }
#if 0 && defined(DEBUG) #if defined(NETLIST_DEBUG) && defined(DEBUG)
std::cout << "\n\nafter sheet global\n\n"; std::cout << "\n\nafter sheet global\n\n";
dumpNetTable(); dumpNetTable();
#endif #endif
@ -363,7 +364,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode ); qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );
#if 0 && defined(DEBUG) #if defined(NETLIST_DEBUG) && defined(DEBUG)
std::cout << "after qsort()\n"; std::cout << "after qsort()\n";
dumpNetTable(); dumpNetTable();
#endif #endif
@ -549,8 +550,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetList* sh
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Type = NET_LABEL; ObjNet[NbrItem].m_Type = NET_LABEL;
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) if( STRUCT->m_Layer == LAYER_GLOBLABEL ) //this is not the simplest way of doing it
ObjNet[NbrItem].m_Type = NET_GLOBLABEL; ObjNet[NbrItem].m_Type = NET_GLOBLABEL;// (look at the case statement above).
if( STRUCT->m_Layer == LAYER_HIERLABEL ) if( STRUCT->m_Layer == LAYER_HIERLABEL )
ObjNet[NbrItem].m_Type = NET_HIERLABEL; ObjNet[NbrItem].m_Type = NET_HIERLABEL;
@ -851,7 +852,7 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
for( BusMember++; BusMember <= LastNumWireBus; BusMember++ ) for( BusMember++; BusMember <= LastNumWireBus; BusMember++ )
{ {
*(BusLabel + 1) = *BusLabel; *(BusLabel + 1) = *BusLabel; //copy constructor.
BusLabel++; BusLabel++;
NumItem++; NumItem++;
@ -883,8 +884,8 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
if( OldNetCode == NewNetCode ) if( OldNetCode == NewNetCode )
return; return;
#ifdef DEBUG #if defined(NETLIST_DEBUG) && defined(DEBUG)
//printf("replacing net %d with %d\n", OldNetCode,NewNetCode); printf("replacing net %d with %d\n", OldNetCode,NewNetCode);
#endif #endif
if( IsBus == 0 ) /* Propagation du NetCode */ if( IsBus == 0 ) /* Propagation du NetCode */
@ -942,7 +943,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
for( i = start; i < g_NbrObjNet; i++ ) for( i = start; i < g_NbrObjNet; i++ )
{ {
if( netTable[i].m_SheetList != Ref->m_SheetList ) //used to be > (why?) if( netTable[i].m_SheetList != Ref->m_SheetList ) //used to be > (why?)
continue; continue;
switch( netTable[i].m_Type ) switch( netTable[i].m_Type )
@ -1095,14 +1096,17 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
{ {
if( netTable[i].GetNet() == LabelRef->GetNet() ) if( netTable[i].GetNet() == LabelRef->GetNet() )
continue; continue;
if( netTable[i].m_SheetList != LabelRef->m_SheetList ) if( netTable[i].m_SheetList != LabelRef->m_SheetList )
{ {
if( netTable[i].m_Type != NET_PINLABEL if( (netTable[i].m_Type != NET_PINLABEL
&& netTable[i].m_Type != NET_GLOBLABEL && netTable[i].m_Type != NET_GLOBLABEL
&& netTable[i].m_Type != NET_GLOBBUSLABELMEMBER && netTable[i].m_Type != NET_GLOBBUSLABELMEMBER) )
/*netTable[i].m_Type != NET_LABEL (***)*/ )
continue; continue;
if( (netTable[i].m_Type == NET_GLOBLABEL
|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER)
&& netTable[i].m_Type != LabelRef->m_Type)
//global labels only connect other global labels.
continue;
} }
//regular labels are sheet-local; //regular labels are sheet-local;
//NET_HIERLABEL are used to connect sheets. //NET_HIERLABEL are used to connect sheets.
@ -1110,8 +1114,10 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
//NET_GLOBLABEL is global. //NET_GLOBLABEL is global.
if( netTable[i].m_Type == NET_LABEL if( netTable[i].m_Type == NET_LABEL
|| netTable[i].m_Type == NET_GLOBLABEL || netTable[i].m_Type == NET_GLOBLABEL
|| netTable[i].m_Type == NET_HIERLABEL
|| netTable[i].m_Type == NET_BUSLABELMEMBER || netTable[i].m_Type == NET_BUSLABELMEMBER
|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER || netTable[i].m_Type == NET_GLOBBUSLABELMEMBER
|| netTable[i].m_Type == NET_HIERBUSLABELMEMBER
|| netTable[i].m_Type == NET_PINLABEL ) || netTable[i].m_Type == NET_PINLABEL )
{ {
if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 ) if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )