2007-09-20 21:06:49 +00:00
|
|
|
/***********************************/
|
|
|
|
/* Module de calcul de la Netliste */
|
|
|
|
/***********************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
#include "algorithm"
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
// Buffer to build the list of items used in netlist and erc calculations
|
|
|
|
NETLIST_OBJECT_LIST g_NetObjectslist;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2008-02-15 05:32:33 +00:00
|
|
|
//#define NETLIST_DEBUG
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
/* Routines locales */
|
|
|
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
2009-07-12 15:29:42 +00:00
|
|
|
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
|
|
|
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
|
|
|
NETLIST_OBJECT_LIST& aNetItemBuffer );
|
|
|
|
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
|
|
|
NETLIST_OBJECT& ObjNet );
|
|
|
|
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus,
|
2007-09-20 21:06:49 +00:00
|
|
|
int start );
|
2009-07-12 15:29:42 +00:00
|
|
|
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus,
|
2007-09-20 21:06:49 +00:00
|
|
|
int start );
|
2009-07-12 15:29:42 +00:00
|
|
|
static void LabelConnect( NETLIST_OBJECT* Label );
|
|
|
|
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
|
|
|
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
|
|
|
|
|
|
|
// Sort functions used here:
|
|
|
|
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
|
|
|
|
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
/* Variable locales */
|
|
|
|
static int FirstNumWireBus, LastNumWireBus, RootBusNameLength;
|
|
|
|
static int LastNetCode, LastBusNetCode;
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2007-09-21 04:40:12 +00:00
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
#if defined(DEBUG)
|
2007-09-21 04:40:12 +00:00
|
|
|
void dumpNetTable()
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned idx = 0; idx < g_NetObjectslist.size(); ++idx )
|
2007-09-21 04:40:12 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
g_NetObjectslist[idx]->Show( std::cout, idx );
|
2007-09-21 04:40:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/*********************************************************************/
|
|
|
|
void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
|
|
|
|
/*********************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*
|
2007-09-20 21:06:49 +00:00
|
|
|
* Routine de liberation memoire des tableaux utilises pour le calcul
|
|
|
|
* de la netliste
|
|
|
|
* TabNetItems = pointeur sur le tableau principal (liste des items )
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned i = 0; i < aNetObjectsBuffer.size(); i++ )
|
|
|
|
delete aNetObjectsBuffer[i];
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
aNetObjectsBuffer.clear();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/************************************************************************/
|
|
|
|
void WinEDA_SchematicFrame::BuildNetListBase()
|
|
|
|
/************************************************************************/
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine qui construit le tableau des elements connectes du projet
|
2007-09-20 21:06:49 +00:00
|
|
|
* met a jour:
|
2009-07-12 15:29:42 +00:00
|
|
|
* g_NetObjectslist
|
|
|
|
* g_NetObjectslist
|
2007-09-20 21:06:49 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-08-22 14:48:30 +00:00
|
|
|
int NetNumber;
|
2009-07-15 07:10:07 +00:00
|
|
|
int NetCode;
|
2008-08-22 14:48:30 +00:00
|
|
|
DrawSheetPath* sheet;
|
|
|
|
wxString msg, activity;
|
|
|
|
wxBusyCursor Busy;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
NetNumber = 1;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2008-04-25 10:32:16 +00:00
|
|
|
activity = _( "List" );
|
2008-08-22 14:48:30 +00:00
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
FreeNetObjectsList( g_NetObjectslist );
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
/* Build the sheet (not screen) list (flattened)*/
|
2009-01-06 20:09:32 +00:00
|
|
|
EDA_SheetList SheetListList;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
sheet = SheetListList.GetFirst();
|
2008-08-22 14:48:30 +00:00
|
|
|
for( ; sheet != NULL; sheet = SheetListList.GetNext() )
|
2009-07-12 15:29:42 +00:00
|
|
|
ListeObjetConnection( sheet, g_NetObjectslist );
|
|
|
|
|
|
|
|
if( g_NetObjectslist.size() == 0 )
|
|
|
|
return; // no objects
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-04-25 10:32:16 +00:00
|
|
|
activity.Empty();
|
2009-07-12 15:29:42 +00:00
|
|
|
activity << wxT( " " ) << _( "NbItems" ) << wxT( " " ) << g_NetObjectslist.size();
|
2008-08-22 14:48:30 +00:00
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-05-15 11:20:19 +00:00
|
|
|
/* Sort objects by Sheet */
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
sort( g_NetObjectslist.begin(), g_NetObjectslist.end(), SortItemsBySheet );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
activity << wxT( "; " ) << _( "Conn" );
|
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
sheet = &(g_NetObjectslist[0]->m_SheetList);
|
2007-09-20 21:06:49 +00:00
|
|
|
LastNetCode = LastBusNetCode = 1;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-15 07:10:07 +00:00
|
|
|
for( unsigned ii = 0, istart = 0; ii < g_NetObjectslist.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
NETLIST_OBJECT* net_item = g_NetObjectslist[ii];
|
|
|
|
if( net_item->m_SheetList != *sheet ) // Sheet change
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
sheet = &(net_item->m_SheetList);
|
|
|
|
istart = ii;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
2009-07-15 07:10:07 +00:00
|
|
|
switch( net_item->m_Type )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
case NET_ITEM_UNSPECIFIED:
|
|
|
|
wxMessageBox(wxT("BuildNetListBase() error"));
|
|
|
|
break;
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_PIN:
|
|
|
|
case NET_PINLABEL:
|
|
|
|
case NET_SHEETLABEL:
|
|
|
|
case NET_NOCONNECT:
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->GetNet() != 0 )
|
2008-08-22 14:48:30 +00:00
|
|
|
break; /* Deja connecte */
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
case NET_SEGMENT:
|
|
|
|
/* Controle des connexions type point a point ( Sans BUS ) */
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
net_item->SetNet( LastNetCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
LastNetCode++;
|
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
PointToPointConnect( net_item, 0, istart );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_JONCTION:
|
|
|
|
/* Controle des jonction , hors BUS */
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
net_item->SetNet( LastNetCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
LastNetCode++;
|
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
SegmentToPointConnect( net_item, 0, istart );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Controle des jonction , sur BUS */
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->m_BusNetCode == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
net_item->m_BusNetCode = LastBusNetCode;
|
2007-09-20 21:06:49 +00:00
|
|
|
LastBusNetCode++;
|
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
SegmentToPointConnect( net_item, ISBUS, istart );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_LABEL:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERLABEL:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBLABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
/* Controle des connexions type jonction ( Sans BUS ) */
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
net_item->SetNet( LastNetCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
LastNetCode++;
|
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
SegmentToPointConnect( net_item, 0, istart );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_SHEETBUSLABELMEMBER:
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->m_BusNetCode != 0 )
|
2008-08-22 14:48:30 +00:00
|
|
|
break; /* Deja connecte */
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
case NET_BUS:
|
|
|
|
/* Controle des connexions type point a point mode BUS */
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->m_BusNetCode == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
net_item->m_BusNetCode = LastBusNetCode;
|
2007-09-20 21:06:49 +00:00
|
|
|
LastBusNetCode++;
|
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
PointToPointConnect( net_item, ISBUS, istart );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_BUSLABELMEMBER:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERBUSLABELMEMBER:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBBUSLABELMEMBER:
|
2007-09-20 21:06:49 +00:00
|
|
|
/* Controle des connexions semblables a des sur BUS */
|
2009-07-15 07:10:07 +00:00
|
|
|
if( net_item->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
net_item->m_BusNetCode = LastBusNetCode;
|
2007-09-20 21:06:49 +00:00
|
|
|
LastBusNetCode++;
|
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
SegmentToPointConnect( net_item, ISBUS, istart );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
#if defined(NETLIST_DEBUG) && defined(DEBUG)
|
2008-02-12 21:12:46 +00:00
|
|
|
std::cout << "\n\nafter sheet local\n\n";
|
2007-09-21 04:40:12 +00:00
|
|
|
dumpNetTable();
|
2008-03-20 01:50:21 +00:00
|
|
|
#endif
|
2007-09-21 04:40:12 +00:00
|
|
|
|
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
activity << wxT( " " ) << _( "Done" );
|
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
|
2009-07-12 15:29:42 +00:00
|
|
|
ConnectBusLabels( g_NetObjectslist );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
activity << wxT( "; " ) << _( "Labels" );
|
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Connections des groupes d'objets par labels identiques */
|
2009-07-15 07:10:07 +00:00
|
|
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
switch( g_NetObjectslist[ii]->m_Type )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
case NET_PIN:
|
|
|
|
case NET_SHEETLABEL:
|
|
|
|
case NET_SEGMENT:
|
|
|
|
case NET_JONCTION:
|
|
|
|
case NET_BUS:
|
|
|
|
case NET_NOCONNECT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_LABEL:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBLABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_PINLABEL:
|
|
|
|
case NET_BUSLABELMEMBER:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBBUSLABELMEMBER:
|
2009-07-15 07:10:07 +00:00
|
|
|
LabelConnect( g_NetObjectslist[ii] );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_SHEETBUSLABELMEMBER:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_HIERLABEL:
|
|
|
|
case NET_HIERBUSLABELMEMBER:
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
2009-07-12 15:29:42 +00:00
|
|
|
case NET_ITEM_UNSPECIFIED:
|
|
|
|
break;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
#if defined(NETLIST_DEBUG) && defined(DEBUG)
|
2008-02-12 21:12:46 +00:00
|
|
|
std::cout << "\n\nafter sheet global\n\n";
|
2007-09-21 04:40:12 +00:00
|
|
|
dumpNetTable();
|
2008-03-20 01:50:21 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
activity << wxT( " " ) << _( "Done" );
|
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Connexion des hierarchies */
|
2008-08-22 14:48:30 +00:00
|
|
|
activity << wxT( "; " ) << _( "Hierar." );
|
|
|
|
SetStatusText( activity );
|
2009-07-15 07:10:07 +00:00
|
|
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
if( g_NetObjectslist[ii]->m_Type == NET_SHEETLABEL
|
|
|
|
|| g_NetObjectslist[ii]->m_Type == NET_SHEETBUSLABELMEMBER )
|
|
|
|
SheetLabelConnect( g_NetObjectslist[ii] );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2008-05-15 11:20:19 +00:00
|
|
|
/* Sort objects by NetCode */
|
2009-07-12 15:29:42 +00:00
|
|
|
sort( g_NetObjectslist.begin(), g_NetObjectslist.end(), SortItemsbyNetcode );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
#if defined(NETLIST_DEBUG) && defined(DEBUG)
|
2007-09-21 04:40:12 +00:00
|
|
|
std::cout << "after qsort()\n";
|
|
|
|
dumpNetTable();
|
2008-03-20 01:50:21 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
activity << wxT( " " ) << _( "Done" );
|
|
|
|
SetStatusText( activity );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Compression des numeros de NetCode a des valeurs consecutives */
|
|
|
|
LastNetCode = NetCode = 0;
|
2009-07-15 07:10:07 +00:00
|
|
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
if( g_NetObjectslist[ii]->GetNet() != LastNetCode )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
NetCode++;
|
2009-07-15 07:10:07 +00:00
|
|
|
LastNetCode = g_NetObjectslist[ii]->GetNet();
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2009-07-15 07:10:07 +00:00
|
|
|
g_NetObjectslist[ii]->SetNet( NetCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
|
2009-07-12 15:29:42 +00:00
|
|
|
SetUnconnectedFlag( g_NetObjectslist );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*************************************************************
|
2007-09-20 21:06:49 +00:00
|
|
|
* Routine qui connecte les sous feuilles par les sheetLabels *
|
|
|
|
**************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
if( SheetLabel->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Calcul du numero de sous feuille correspondante au sheetlabel */
|
|
|
|
|
|
|
|
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
|
|
|
|
* pour regroupement des NetCodes */
|
2009-07-15 07:10:07 +00:00
|
|
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-15 07:10:07 +00:00
|
|
|
NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii];
|
2009-07-12 15:29:42 +00:00
|
|
|
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
|
2008-03-20 01:50:21 +00:00
|
|
|
continue; //use SheetInclude, not the sheet!!
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( (ObjetNet->m_Type != NET_HIERLABEL )
|
|
|
|
&& (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
|
2008-03-20 01:50:21 +00:00
|
|
|
continue; //already connected.
|
|
|
|
|
2009-07-15 07:10:07 +00:00
|
|
|
wxASSERT(ObjetNet->m_Label);
|
|
|
|
wxASSERT(SheetLabel->m_Label);
|
2009-07-12 15:29:42 +00:00
|
|
|
if( ObjetNet->m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
|
2008-02-12 21:12:46 +00:00
|
|
|
continue; //different names.
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
2009-07-12 15:29:42 +00:00
|
|
|
if( ObjetNet->GetNet() )
|
2009-07-15 07:10:07 +00:00
|
|
|
PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), 0 );
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
ObjetNet->SetNet( SheetLabel->GetNet() );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-05-15 11:20:19 +00:00
|
|
|
/**************************************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
|
|
|
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
2008-05-15 11:20:19 +00:00
|
|
|
/**************************************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2008-05-15 11:20:19 +00:00
|
|
|
/** Function ListeObjetConnection
|
|
|
|
* Creates the list of objects related to connections (pins of components, wires, labels, junctions ...)
|
|
|
|
* @param sheetlist: pointer to a sheetlist.
|
2009-07-12 15:29:42 +00:00
|
|
|
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT created
|
2007-09-20 21:06:49 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
int ii;
|
|
|
|
SCH_ITEM* DrawList;
|
|
|
|
NETLIST_OBJECT* new_item;
|
|
|
|
SCH_COMPONENT* DrawLibItem;
|
2008-08-22 14:48:30 +00:00
|
|
|
EDA_LibComponentStruct* Entry;
|
|
|
|
LibEDA_BaseStruct* DEntry;
|
|
|
|
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
|
|
|
DrawSheetPath list;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
DrawList = sheetlist->LastScreen()->EEDrawList;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; DrawList; DrawList = DrawList->Next() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
switch( DrawList->Type() )
|
|
|
|
{
|
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
|
2009-07-12 15:29:42 +00:00
|
|
|
if( (STRUCT->GetLayer() != LAYER_BUS) && (STRUCT->GetLayer() != LAYER_WIRE) )
|
|
|
|
break;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = STRUCT;
|
|
|
|
new_item->m_Start = STRUCT->m_Start;
|
|
|
|
new_item->m_End = STRUCT->m_End;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_BUS )
|
|
|
|
{
|
|
|
|
new_item->m_Type = NET_BUS;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2009-07-12 15:29:42 +00:00
|
|
|
else /* Cas des WIRE */
|
|
|
|
{
|
|
|
|
new_item->m_Type = NET_SEGMENT;
|
|
|
|
}
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (DrawJunctionStruct*) DrawList )
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = STRUCT;
|
|
|
|
new_item->m_Type = NET_JONCTION;
|
|
|
|
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
|
|
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (DrawNoConnectStruct*) DrawList )
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = STRUCT;
|
|
|
|
new_item->m_Type = NET_NOCONNECT;
|
|
|
|
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
|
|
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_LABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
#undef STRUCT
|
2008-03-20 01:50:21 +00:00
|
|
|
#define STRUCT ( (SCH_LABEL*) DrawList )
|
2007-09-20 21:06:49 +00:00
|
|
|
ii = IsBusLabel( STRUCT->m_Text );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = STRUCT;
|
|
|
|
new_item->m_Type = NET_LABEL;
|
|
|
|
|
|
|
|
if( STRUCT->m_Layer == LAYER_GLOBLABEL )
|
|
|
|
new_item->m_Type = NET_GLOBLABEL;
|
|
|
|
if( STRUCT->m_Layer == LAYER_HIERLABEL )
|
|
|
|
new_item->m_Type = NET_HIERLABEL;
|
|
|
|
|
|
|
|
new_item->m_Label = &STRUCT->m_Text;
|
|
|
|
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
|
|
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
|
|
|
/* Si c'est un Bus, eclatement en Label */
|
|
|
|
if( ii )
|
|
|
|
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
#undef STRUCT
|
2008-03-20 01:50:21 +00:00
|
|
|
#define STRUCT ( (SCH_LABEL*) DrawList )
|
2007-09-20 21:06:49 +00:00
|
|
|
ii = IsBusLabel( STRUCT->m_Text );
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = STRUCT;
|
|
|
|
new_item->m_Type = NET_LABEL;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) //this is not the simplest way of doing it
|
|
|
|
new_item->m_Type = NET_GLOBLABEL; // (look at the case statement above).
|
|
|
|
if( STRUCT->m_Layer == LAYER_HIERLABEL )
|
|
|
|
new_item->m_Type = NET_HIERLABEL;
|
|
|
|
|
|
|
|
new_item->m_Label = &STRUCT->m_Text;
|
|
|
|
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
|
|
|
|
|
|
|
/* Si c'est un Bus, eclatement en Label */
|
|
|
|
if( ii )
|
|
|
|
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_COMPONENT:
|
|
|
|
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
Entry = FindLibPart( DrawLibItem->m_ChipName, wxEmptyString, FIND_ROOT );
|
|
|
|
|
|
|
|
if( Entry == NULL )
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
if( Entry->m_Drawings == NULL )
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
DEntry = Entry->m_Drawings;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-21 04:40:12 +00:00
|
|
|
for( ; DEntry; DEntry = DEntry->Next() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
|
|
|
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
|
|
|
continue;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
if( DEntry->m_Unit && ( DEntry->m_Unit != DrawLibItem->GetUnitSelection( sheetlist ) ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
if( DEntry->m_Convert
|
|
|
|
&& (DEntry->m_Convert != DrawLibItem->m_Convert) )
|
|
|
|
continue;
|
|
|
|
|
2008-09-20 15:33:47 +00:00
|
|
|
wxPoint pos2 =
|
|
|
|
TransformCoordinate( DrawLibItem->m_Transform,
|
2009-07-12 15:29:42 +00:00
|
|
|
Pin->m_Pos ) + DrawLibItem->m_Pos;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = DEntry;
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_Type = NET_PIN;
|
|
|
|
new_item->m_Link = DrawLibItem;
|
|
|
|
new_item->m_ElectricalType = Pin->m_PinType;
|
|
|
|
new_item->m_PinNum = Pin->m_PinNum;
|
|
|
|
new_item->m_Label = &Pin->m_PinName;
|
|
|
|
new_item->m_Start = new_item->m_End = pos2;
|
|
|
|
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
if( ( (int) Pin->m_PinType == (int) PIN_POWER_IN )
|
|
|
|
&& ( Pin->m_Attributs & PINNOTDRAW ) )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
/* Il y a un PIN_LABEL Associe */
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = NULL;
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_Type = NET_PINLABEL;
|
|
|
|
new_item->m_Label = &Pin->m_PinName;
|
|
|
|
new_item->m_Start = pos2;
|
|
|
|
new_item->m_End = new_item->m_Start;
|
|
|
|
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_PICK_ITEM_STRUCT_TYPE:
|
|
|
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
|
|
|
case DRAW_MARKER_STRUCT_TYPE:
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_TEXT:
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (DrawSheetStruct*) DrawList )
|
2008-03-20 01:50:21 +00:00
|
|
|
list = *sheetlist;
|
2008-08-22 14:48:30 +00:00
|
|
|
list.Push( STRUCT );
|
2007-09-20 21:06:49 +00:00
|
|
|
SheetLabel = STRUCT->m_Label;
|
|
|
|
for( ; SheetLabel != NULL;
|
2009-07-12 15:29:42 +00:00
|
|
|
SheetLabel = SheetLabel->Next() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
ii = IsBusLabel( SheetLabel->m_Text );
|
2009-07-12 15:29:42 +00:00
|
|
|
new_item = new NETLIST_OBJECT();
|
|
|
|
new_item->m_SheetListInclude = *sheetlist;
|
|
|
|
new_item->m_Comp = SheetLabel;
|
|
|
|
new_item->m_SheetList = *sheetlist;
|
|
|
|
new_item->m_Link = DrawList;
|
|
|
|
new_item->m_Type = NET_SHEETLABEL;
|
|
|
|
new_item->m_ElectricalType = SheetLabel->m_Shape;
|
|
|
|
new_item->m_Label = &SheetLabel->m_Text;
|
|
|
|
new_item->m_SheetListInclude = list;
|
|
|
|
new_item->m_Start = new_item->m_End = SheetLabel->m_Pos;
|
|
|
|
aNetItemBuffer.push_back( new_item );
|
|
|
|
|
|
|
|
/* Si c'est un Bus, eclatement en Label */
|
|
|
|
if( ii )
|
|
|
|
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
2008-05-15 11:20:19 +00:00
|
|
|
DisplayError( NULL, wxT( "Netlist: Type DRAW_SHEETLABEL inattendu" ) );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( wxT( "Netlist: unexpected type struct %d" ),
|
2009-07-12 15:29:42 +00:00
|
|
|
DrawList->Type() );
|
2008-05-15 11:20:19 +00:00
|
|
|
DisplayError( NULL, msg );
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
2007-05-06 16:03:28 +00:00
|
|
|
/************************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine qui analyse les labels type xxBUSLABELMEMBER
|
2007-09-20 21:06:49 +00:00
|
|
|
* Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
|
|
|
|
* leur numero de membre est identique) lorsqu'ils sont connectes
|
|
|
|
* globalement par leur BusNetCode
|
|
|
|
* Utilise et met a jour la variable LastNetCode
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* Label = aNetItemBuffer[ii];
|
2007-09-20 21:06:49 +00:00
|
|
|
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|
|
|
|
|| (Label->m_Type == NET_BUSLABELMEMBER)
|
2008-02-12 21:12:46 +00:00
|
|
|
|| (Label->m_Type == NET_HIERBUSLABELMEMBER) )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
if( Label->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
Label->SetNet( LastNetCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
LastNetCode++;
|
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* LabelInTst = aNetItemBuffer[jj];
|
2007-09-20 21:06:49 +00:00
|
|
|
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
|
|
|
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|
2008-02-12 21:12:46 +00:00
|
|
|
|| (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
|
|
|
|
continue;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
if( LabelInTst->m_Member != Label->m_Member )
|
|
|
|
continue;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-10-13 06:18:44 +00:00
|
|
|
if( LabelInTst->GetNet() == 0 )
|
|
|
|
LabelInTst->SetNet( Label->GetNet() );
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2007-10-13 06:18:44 +00:00
|
|
|
PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2008-08-22 14:48:30 +00:00
|
|
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/**************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
int IsBusLabel( const wxString& LabelDrawList )
|
2007-05-06 16:03:28 +00:00
|
|
|
/**************************************************/
|
|
|
|
|
|
|
|
/* Routine qui verifie si le Label a une notation de type Bus
|
2007-09-20 21:06:49 +00:00
|
|
|
* Retourne 0 si non
|
|
|
|
* nombre de membres si oui
|
|
|
|
* met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
unsigned Num;
|
|
|
|
int ii;
|
|
|
|
wxString BufLine;
|
|
|
|
long tmp;
|
|
|
|
bool error = FALSE;
|
|
|
|
|
|
|
|
/* Search for '[' because a bus label is like "busname[nn..mm]" */
|
|
|
|
ii = LabelDrawList.Find( '[' );
|
|
|
|
if( ii < 0 )
|
|
|
|
return 0;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
Num = (unsigned) ii;
|
|
|
|
|
|
|
|
FirstNumWireBus = LastNumWireBus = 9;
|
|
|
|
RootBusNameLength = Num;
|
|
|
|
Num++;
|
|
|
|
while( LabelDrawList[Num] != '.' && Num < LabelDrawList.Len() )
|
|
|
|
{
|
|
|
|
BufLine.Append( LabelDrawList[Num] );
|
|
|
|
Num++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !BufLine.ToLong( &tmp ) )
|
|
|
|
error = TRUE;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
FirstNumWireBus = tmp;
|
|
|
|
while( LabelDrawList[Num] == '.' && Num < LabelDrawList.Len() )
|
|
|
|
Num++;
|
|
|
|
|
|
|
|
BufLine.Empty();
|
|
|
|
while( LabelDrawList[Num] != ']' && Num < LabelDrawList.Len() )
|
|
|
|
{
|
|
|
|
BufLine.Append( LabelDrawList[Num] );
|
|
|
|
Num++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !BufLine.ToLong( &tmp ) )
|
|
|
|
error = TRUE;;
|
|
|
|
LastNumWireBus = tmp;
|
|
|
|
|
|
|
|
if( FirstNumWireBus < 0 )
|
|
|
|
FirstNumWireBus = 0;
|
|
|
|
if( LastNumWireBus < 0 )
|
|
|
|
LastNumWireBus = 0;
|
|
|
|
if( FirstNumWireBus > LastNumWireBus )
|
|
|
|
{
|
|
|
|
EXCHG( FirstNumWireBus, LastNumWireBus );
|
|
|
|
}
|
|
|
|
|
|
|
|
return LastNumWireBus - FirstNumWireBus + 1;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
|
|
|
NETLIST_OBJECT& BusLabel )
|
2007-05-06 16:03:28 +00:00
|
|
|
/***************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine qui eclate un label type Bus en autant de Label qu'il contient de membres,
|
2007-09-20 21:06:49 +00:00
|
|
|
* et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
|
|
|
|
* ou NET_SHEETBUSLABELMEMBER
|
2009-07-12 15:29:42 +00:00
|
|
|
* entree = pointeur sur l'NETLIST_OBJECT initialise corresp au buslabel
|
2007-09-20 21:06:49 +00:00
|
|
|
* suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
|
2009-07-12 15:29:42 +00:00
|
|
|
* modifie l'NETLIST_OBJECT de base et remplit les suivants
|
2007-09-20 21:06:49 +00:00
|
|
|
* m_Label is a pointer to a new wxString
|
|
|
|
* m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
|
|
|
|
* NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
int NumItem, BusMember;
|
|
|
|
wxString BufLine;
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( BusLabel.m_Type == NET_HIERLABEL )
|
|
|
|
BusLabel.m_Type = NET_HIERBUSLABELMEMBER;
|
|
|
|
else if( BusLabel.m_Type == NET_GLOBLABEL )
|
|
|
|
BusLabel.m_Type = NET_GLOBBUSLABELMEMBER;
|
|
|
|
else if( BusLabel.m_Type == NET_SHEETLABEL )
|
|
|
|
BusLabel.m_Type = NET_SHEETBUSLABELMEMBER;
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
BusLabel.m_Type = NET_BUSLABELMEMBER;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Convertion du BusLabel en la racine du Label + le numero du fil */
|
2009-07-12 15:29:42 +00:00
|
|
|
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
BusMember = FirstNumWireBus;
|
|
|
|
BufLine << BusMember;
|
2009-07-12 15:29:42 +00:00
|
|
|
BusLabel.m_Label = new wxString( BufLine );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
BusLabel.m_Member = BusMember;
|
2007-09-20 21:06:49 +00:00
|
|
|
NumItem = 1;
|
|
|
|
|
|
|
|
for( BusMember++; BusMember <= LastNumWireBus; BusMember++ )
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel );
|
2007-09-21 04:40:12 +00:00
|
|
|
NumItem++;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
/* Convertion du BusLabel en la racine du Label + le numero du fil */
|
2009-07-12 15:29:42 +00:00
|
|
|
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
|
2007-09-20 21:06:49 +00:00
|
|
|
BufLine << BusMember;
|
2009-07-12 15:29:42 +00:00
|
|
|
new_label->m_Label = new wxString( BufLine );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
new_label->m_Member = BusMember;
|
|
|
|
aNetItemBuffer.push_back( new_label );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NumItem;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
|
|
|
/**********************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* PropageNetCode propage le netcode NewNetCode sur tous les elements
|
2007-09-20 21:06:49 +00:00
|
|
|
* appartenant a l'ancien netcode OldNetCode
|
|
|
|
* Si IsBus == 0; c'est le membre NetCode qui est propage
|
|
|
|
* Si IsBus != 0; c'est le membre BusNetCode qui est propage
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
if( OldNetCode == NewNetCode )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( IsBus == 0 ) /* Propagation du NetCode */
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* Objet = g_NetObjectslist[jj];
|
2007-10-13 06:18:44 +00:00
|
|
|
if( Objet->GetNet() == OldNetCode )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
Objet->SetNet( NewNetCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* Propagation du BusNetCode */
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* Objet = g_NetObjectslist[jj];
|
2007-09-20 21:06:49 +00:00
|
|
|
if( Objet->m_BusNetCode == OldNetCode )
|
|
|
|
{
|
|
|
|
Objet->m_BusNetCode = NewNetCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/***************************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
|
2007-05-06 16:03:28 +00:00
|
|
|
/***************************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine qui verifie si l'element *Ref est connecte a
|
2007-09-20 21:06:49 +00:00
|
|
|
* d'autres elements de la liste des objets du schema, selon le mode Point
|
|
|
|
* a point ( Extremites superposees )
|
2008-03-20 01:50:21 +00:00
|
|
|
*
|
2007-09-20 21:06:49 +00:00
|
|
|
* si IsBus:
|
|
|
|
* la connexion ne met en jeu que des elements type bus
|
|
|
|
* ( BUS ou BUSLABEL ou JONCTION )
|
|
|
|
* sinon
|
|
|
|
* la connexion ne met en jeu que des elements type non bus
|
|
|
|
* ( autres que BUS ou BUSLABEL )
|
2008-03-20 01:50:21 +00:00
|
|
|
*
|
2007-09-20 21:06:49 +00:00
|
|
|
* L'objet Ref doit avoir un NetCode valide.
|
2008-03-20 01:50:21 +00:00
|
|
|
*
|
2008-02-12 21:12:46 +00:00
|
|
|
* La liste des objets est supposee classe par SheetPath Croissants,
|
2007-09-20 21:06:49 +00:00
|
|
|
* et la recherche se fait a partir de l'element start, 1er element
|
|
|
|
* de la feuille de schema
|
|
|
|
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
int netCode;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
if( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */
|
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
netCode = Ref->GetNet();
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* item = g_NetObjectslist[i];
|
|
|
|
if( item->m_SheetList != Ref->m_SheetList ) //used to be > (why?)
|
2008-02-12 21:12:46 +00:00
|
|
|
continue;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
switch( item->m_Type )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
case NET_SEGMENT:
|
|
|
|
case NET_PIN:
|
|
|
|
case NET_LABEL:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERLABEL:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBLABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_SHEETLABEL:
|
|
|
|
case NET_PINLABEL:
|
|
|
|
case NET_JONCTION:
|
|
|
|
case NET_NOCONNECT:
|
2009-07-12 15:29:42 +00:00
|
|
|
if( Ref->m_Start == item->m_Start
|
|
|
|
|| Ref->m_Start == item->m_End
|
|
|
|
|| Ref->m_End == item->m_Start
|
|
|
|
|| Ref->m_End == item->m_End )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( item->GetNet() == 0 )
|
|
|
|
item->SetNet( netCode );
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
PropageNetCode( item->GetNet(), netCode, 0 );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_BUS:
|
|
|
|
case NET_BUSLABELMEMBER:
|
|
|
|
case NET_SHEETBUSLABELMEMBER:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERBUSLABELMEMBER:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBBUSLABELMEMBER:
|
2009-07-12 15:29:42 +00:00
|
|
|
case NET_ITEM_UNSPECIFIED:
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
|
|
|
|
{
|
2007-09-21 04:40:12 +00:00
|
|
|
netCode = Ref->m_BusNetCode;
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned i = start; i<g_NetObjectslist.size(); i++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* item = g_NetObjectslist[i];
|
|
|
|
if( item->m_SheetList != Ref->m_SheetList )
|
2008-02-12 21:12:46 +00:00
|
|
|
continue;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
switch( item->m_Type )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
case NET_ITEM_UNSPECIFIED:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_SEGMENT:
|
|
|
|
case NET_PIN:
|
|
|
|
case NET_LABEL:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERLABEL:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBLABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_SHEETLABEL:
|
|
|
|
case NET_PINLABEL:
|
|
|
|
case NET_NOCONNECT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_BUS:
|
|
|
|
case NET_BUSLABELMEMBER:
|
|
|
|
case NET_SHEETBUSLABELMEMBER:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERBUSLABELMEMBER:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBBUSLABELMEMBER:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_JONCTION:
|
2009-07-12 15:29:42 +00:00
|
|
|
if( Ref->m_Start == item->m_Start
|
|
|
|
|| Ref->m_Start == item->m_End
|
|
|
|
|| Ref->m_End == item->m_Start
|
|
|
|
|| Ref->m_End == item->m_End )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( item->m_BusNetCode == 0 )
|
|
|
|
item->m_BusNetCode = netCode;
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
PropageNetCode( item->m_BusNetCode, netCode, 1 );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
|
2007-09-20 21:06:49 +00:00
|
|
|
int IsBus, int start )
|
2007-05-06 16:03:28 +00:00
|
|
|
/***************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*
|
2007-09-20 21:06:49 +00:00
|
|
|
* Routine qui recherche si un point (jonction) est connecte a des segments,
|
|
|
|
* et regroupe les NetCodes des objets connectes a la jonction.
|
|
|
|
* Le point de jonction doit avoir un netcode valide
|
|
|
|
* La liste des objets est supposee classe par NumSheet Croissants,
|
|
|
|
* et la recherche se fait a partir de l'element start, 1er element
|
|
|
|
* de la feuille de schema
|
|
|
|
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* Segment = g_NetObjectslist[i];
|
|
|
|
|
|
|
|
if( Segment->m_SheetList != Jonction->m_SheetList )
|
2008-02-12 21:12:46 +00:00
|
|
|
continue;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
if( IsBus == 0 )
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( Segment->m_Type != NET_SEGMENT )
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( Segment->m_Type != NET_BUS )
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( SegmentIntersect( Segment->m_Start.x, Segment->m_Start.y,
|
|
|
|
Segment->m_End.x, Segment->m_End.y,
|
|
|
|
Jonction->m_Start.x, Jonction->m_Start.y ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
|
|
|
if( IsBus == 0 )
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( Segment->GetNet() )
|
|
|
|
PropageNetCode( Segment->GetNet(),
|
|
|
|
Jonction->GetNet(), IsBus );
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
Segment->SetNet( Jonction->GetNet() );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( Segment->m_BusNetCode )
|
|
|
|
PropageNetCode( Segment->m_BusNetCode,
|
|
|
|
Jonction->m_BusNetCode, IsBus );
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
Segment->m_BusNetCode = Jonction->m_BusNetCode;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*****************************************************************
|
2007-09-21 04:40:12 +00:00
|
|
|
* Function which connects the groups of object which have the same label
|
2007-09-20 21:06:49 +00:00
|
|
|
*******************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
void LabelConnect( NETLIST_OBJECT* LabelRef )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
if( LabelRef->GetNet() == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned i = 0; i < g_NetObjectslist.size(); i++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( g_NetObjectslist[i]->GetNet() == LabelRef->GetNet() )
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
2009-07-12 15:29:42 +00:00
|
|
|
if( g_NetObjectslist[i]->m_SheetList != LabelRef->m_SheetList )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( (g_NetObjectslist[i]->m_Type != NET_PINLABEL
|
|
|
|
&& g_NetObjectslist[i]->m_Type != NET_GLOBLABEL
|
|
|
|
&& g_NetObjectslist[i]->m_Type != NET_GLOBBUSLABELMEMBER) )
|
2008-03-20 01:50:21 +00:00
|
|
|
continue;
|
2009-07-12 15:29:42 +00:00
|
|
|
if( (g_NetObjectslist[i]->m_Type == NET_GLOBLABEL
|
|
|
|
|| g_NetObjectslist[i]->m_Type == NET_GLOBBUSLABELMEMBER)
|
|
|
|
&& g_NetObjectslist[i]->m_Type != LabelRef->m_Type )
|
2008-03-20 01:50:21 +00:00
|
|
|
//global labels only connect other global labels.
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
//regular labels are sheet-local;
|
|
|
|
//NET_HIERLABEL are used to connect sheets.
|
|
|
|
//NET_LABEL is sheet-local (***)
|
|
|
|
//NET_GLOBLABEL is global.
|
2009-07-12 15:29:42 +00:00
|
|
|
NetObjetType ntype = g_NetObjectslist[i]->m_Type;
|
|
|
|
if( ntype == NET_LABEL
|
|
|
|
|| ntype == NET_GLOBLABEL
|
|
|
|
|| ntype == NET_HIERLABEL
|
|
|
|
|| ntype == NET_BUSLABELMEMBER
|
|
|
|
|| ntype == NET_GLOBBUSLABELMEMBER
|
|
|
|
|| ntype == NET_HIERBUSLABELMEMBER
|
|
|
|
|| ntype == NET_PINLABEL )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( g_NetObjectslist[i]->m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
// Propagation du Netcode a tous les Objets de meme NetCode
|
2009-07-12 15:29:42 +00:00
|
|
|
if( g_NetObjectslist[i]->GetNet() )
|
|
|
|
PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-07-12 15:29:42 +00:00
|
|
|
g_NetObjectslist[i]->SetNet( LabelRef->GetNet() );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/****************************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
|
2007-05-06 16:03:28 +00:00
|
|
|
/****************************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine de comparaison pour le tri par NetCode croissant
|
2007-09-20 21:06:49 +00:00
|
|
|
* du tableau des elements connectes ( TabPinSort ) par qsort()
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
return Objet1->GetNet() < Objet2->GetNet();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/*****************************************************************************************/
|
|
|
|
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
|
|
|
|
/*****************************************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine de comparaison pour le tri par NumSheet
|
2007-09-20 21:06:49 +00:00
|
|
|
* du tableau des elements connectes ( TabPinSort ) par qsort() */
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-08-22 14:48:30 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/**********************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
2007-05-06 16:03:28 +00:00
|
|
|
/**********************************************************************/
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine positionnant le membre .FlagNoConnect des elements de
|
2007-09-20 21:06:49 +00:00
|
|
|
* la liste des objets netliste, tries par ordre de NetCode
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT* NetItemRef;
|
|
|
|
unsigned NetStart, NetEnd;
|
2008-12-10 16:49:53 +00:00
|
|
|
ConnectType StateFlag;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
NetStart = NetEnd = 0;
|
2008-12-10 16:49:53 +00:00
|
|
|
StateFlag = UNCONNECTED;
|
2009-07-12 15:29:42 +00:00
|
|
|
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
NetItemRef = aNetItemBuffer[ii];
|
|
|
|
if( NetItemRef->m_Type == NET_NOCONNECT && StateFlag != PAD_CONNECT )
|
|
|
|
StateFlag = NOCONNECT_SYMBOL_PRESENT;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Analyse du net en cours */
|
2009-07-12 15:29:42 +00:00
|
|
|
unsigned idxtoTest = ii + 1;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( ( idxtoTest >= aNetItemBuffer.size() )
|
|
|
|
|| ( NetItemRef->GetNet() != aNetItemBuffer[idxtoTest]->GetNet() ) )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
/* Net analyse: mise a jour de m_FlagOfConnection */
|
2009-07-12 15:29:42 +00:00
|
|
|
NetEnd = idxtoTest;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/* set m_FlagOfConnection member to StateFlag for all items of this net: */
|
|
|
|
for( unsigned kk = NetStart; kk < NetEnd; kk++ )
|
|
|
|
aNetItemBuffer[kk]->m_FlagOfConnection = StateFlag;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
if( idxtoTest >= aNetItemBuffer.size() )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/* Start Analysis next Net */
|
2008-12-10 16:49:53 +00:00
|
|
|
StateFlag = UNCONNECTED;
|
2009-07-12 15:29:42 +00:00
|
|
|
NetStart = idxtoTest;
|
2007-09-20 21:06:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/* test the current item: if this is a pin and if the reference item is also a pin,
|
|
|
|
* then 2 pins are connected, so set StateFlag to PAD_CONNECT (can be already done)
|
|
|
|
* Of course, if the current item is a no connect symbol, set StateFlag to NOCONNECT_SYMBOL_PRESENT
|
|
|
|
* to inhibit error diags. However if StateFlag is already set to PAD_CONNECT
|
|
|
|
* this state is kept (the no connect symbol was surely an error and an ERC will report this)
|
|
|
|
*/
|
|
|
|
for( ; ; idxtoTest++ )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
if( ( idxtoTest >= aNetItemBuffer.size() )
|
|
|
|
|| ( NetItemRef->GetNet() != aNetItemBuffer[idxtoTest]->GetNet() ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
switch( aNetItemBuffer[idxtoTest]->m_Type )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-07-12 15:29:42 +00:00
|
|
|
case NET_ITEM_UNSPECIFIED:
|
|
|
|
wxMessageBox(wxT("BuildNetListBase() error"));
|
|
|
|
break;
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_SEGMENT:
|
|
|
|
case NET_LABEL:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERLABEL:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBLABEL:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_SHEETLABEL:
|
|
|
|
case NET_PINLABEL:
|
|
|
|
case NET_BUS:
|
|
|
|
case NET_BUSLABELMEMBER:
|
|
|
|
case NET_SHEETBUSLABELMEMBER:
|
2008-02-12 21:12:46 +00:00
|
|
|
case NET_HIERBUSLABELMEMBER:
|
2008-03-20 01:50:21 +00:00
|
|
|
case NET_GLOBBUSLABELMEMBER:
|
2007-09-20 21:06:49 +00:00
|
|
|
case NET_JONCTION:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_PIN:
|
|
|
|
if( NetItemRef->m_Type == NET_PIN )
|
2008-01-05 17:30:56 +00:00
|
|
|
StateFlag = PAD_CONNECT;
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_NOCONNECT:
|
2008-01-05 17:30:56 +00:00
|
|
|
if( StateFlag != PAD_CONNECT )
|
2009-07-12 15:29:42 +00:00
|
|
|
StateFlag = NOCONNECT_SYMBOL_PRESENT;
|
2007-09-20 21:06:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|