2009-07-12 15:29:42 +00:00
|
|
|
/*************************************************************************************/
|
|
|
|
/* Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc calculations) */
|
|
|
|
/*************************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
|
|
|
#include "class_netlist_object.h"
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
#include <iostream>
|
|
|
|
const char* ShowType( NetObjetType aType )
|
|
|
|
{
|
|
|
|
const char* ret;
|
|
|
|
|
|
|
|
switch( aType )
|
|
|
|
{
|
|
|
|
case NET_SEGMENT:
|
|
|
|
ret = "segment"; break;
|
|
|
|
|
|
|
|
case NET_BUS:
|
|
|
|
ret = "bus"; break;
|
|
|
|
|
|
|
|
case NET_JONCTION:
|
|
|
|
ret = "junction"; break;
|
|
|
|
|
|
|
|
case NET_LABEL:
|
|
|
|
ret = "label"; break;
|
|
|
|
|
|
|
|
case NET_HIERLABEL:
|
|
|
|
ret = "hierlabel"; break;
|
|
|
|
|
|
|
|
case NET_GLOBLABEL:
|
|
|
|
ret = "glabel"; break;
|
|
|
|
|
|
|
|
case NET_BUSLABELMEMBER:
|
|
|
|
ret = "buslblmember"; break;
|
|
|
|
|
|
|
|
case NET_HIERBUSLABELMEMBER:
|
|
|
|
ret = "hierbuslblmember"; break;
|
|
|
|
|
|
|
|
case NET_GLOBBUSLABELMEMBER:
|
|
|
|
ret = "gbuslblmember"; break;
|
|
|
|
|
|
|
|
case NET_SHEETBUSLABELMEMBER:
|
|
|
|
ret = "sbuslblmember"; break;
|
|
|
|
|
|
|
|
case NET_SHEETLABEL:
|
|
|
|
ret = "sheetlabel"; break;
|
|
|
|
|
|
|
|
case NET_PINLABEL:
|
|
|
|
ret = "pinlabel"; break;
|
|
|
|
|
|
|
|
case NET_PIN:
|
|
|
|
ret = "pin"; break;
|
|
|
|
|
|
|
|
case NET_NOCONNECT:
|
|
|
|
ret = "noconnect"; break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ret = "??"; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
|
|
|
|
{
|
|
|
|
wxString path = m_SheetList.PathHumanReadable();
|
|
|
|
|
|
|
|
out << "<netItem ndx=\"" << ndx << '"' <<
|
|
|
|
" type=\"" << ShowType( m_Type ) << '"' <<
|
|
|
|
" netCode=\"" << GetNet() << '"' <<
|
|
|
|
" sheet=\"" << CONV_TO_UTF8( path ) << '"' <<
|
|
|
|
">\n";
|
|
|
|
|
|
|
|
out << " <start " << m_Start << "/> <end " << m_End << "/>\n";
|
|
|
|
|
2010-06-28 13:11:14 +00:00
|
|
|
if( !m_Label.IsEmpty() )
|
2010-06-24 18:31:43 +00:00
|
|
|
out << " <label>" << m_Label.mb_str() << "</label>\n";
|
2009-07-12 15:29:42 +00:00
|
|
|
|
2010-08-03 05:11:05 +00:00
|
|
|
out << " <sheetpath>" << m_SheetList.PathHumanReadable().mb_str() << "</sheetpath>\n";
|
|
|
|
|
|
|
|
switch( m_Type )
|
|
|
|
{
|
|
|
|
case NET_PIN:
|
|
|
|
out << " <refOfComp>" << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str() << "</refOfComp>\n";
|
|
|
|
|
|
|
|
if( m_Comp )
|
|
|
|
m_Comp->Show( 1, out );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// not all the m_Comp classes have working Show functions.
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* was segfault-ing
|
2009-07-12 15:29:42 +00:00
|
|
|
if( m_Comp )
|
2010-08-03 05:11:05 +00:00
|
|
|
m_Comp->Show( 1, out ); // labels may not have good Show() funcs?
|
2009-07-12 15:29:42 +00:00
|
|
|
else
|
|
|
|
out << " m_Comp==NULL\n";
|
2010-08-03 05:11:05 +00:00
|
|
|
*/
|
2009-07-12 15:29:42 +00:00
|
|
|
|
|
|
|
out << "</netItem>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
NETLIST_OBJECT::NETLIST_OBJECT()
|
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
|
|
|
|
m_Comp = NULL; /* Pointer on the library item that created this net object
|
|
|
|
* (the parent)*/
|
|
|
|
m_Link = NULL; /* For SCH_SHEET_PIN:
|
|
|
|
* Pointer to the hierarchy sheet that contains this
|
|
|
|
* SCH_SHEET_PIN For Pins: pointer to the component that
|
|
|
|
* contains this pin
|
|
|
|
*/
|
|
|
|
m_Flag = 0; /* flag used in calculations */
|
|
|
|
m_ElectricalType = 0; /* Has meaning only for Pins and hierachical pins: electrical
|
|
|
|
* type */
|
|
|
|
m_NetCode = 0; /* net code for all items except BUS labels because a BUS
|
|
|
|
* label has as many net codes as bus members
|
|
|
|
*/
|
|
|
|
m_BusNetCode = 0; /* Used for BUS connections */
|
|
|
|
m_Member = 0; /* for labels type NET_BUSLABELMEMBER ( bus member created
|
|
|
|
* from the BUS label ) member number
|
|
|
|
*/
|
2009-07-12 15:29:42 +00:00
|
|
|
m_FlagOfConnection = UNCONNECTED;
|
|
|
|
m_PinNum = 0; /* pin number ( 1 long = 4 bytes -> 4 ascii codes) */
|
2010-06-24 18:31:43 +00:00
|
|
|
m_NetNameCandidate = NULL; /* a pointer to a NETLIST_OBJECT type label connected to this
|
|
|
|
* object used to give a name to the net
|
2010-06-23 17:00:12 +00:00
|
|
|
*/
|
2009-07-12 15:29:42 +00:00
|
|
|
}
|
|
|
|
|
2010-06-23 17:00:12 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
// Copy constructor
|
|
|
|
NETLIST_OBJECT::NETLIST_OBJECT( NETLIST_OBJECT& aSource )
|
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
*this = aSource;
|
2009-07-12 15:29:42 +00:00
|
|
|
}
|
|
|
|
|
2010-06-23 17:00:12 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
NETLIST_OBJECT::~NETLIST_OBJECT()
|
|
|
|
{
|
|
|
|
}
|
2010-08-03 02:13:33 +00:00
|
|
|
|