2007-09-20 21:06:49 +00:00
|
|
|
/**********************************************/
|
|
|
|
/* Module de calcul de la Netliste: netlist.h */
|
|
|
|
/**********************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef _NETLIST_H_
|
|
|
|
#define _NETLIST_H_
|
|
|
|
|
|
|
|
#ifndef eda_global
|
|
|
|
#define eda_global extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
|
|
|
|
|
|
|
#define ISBUS 1
|
|
|
|
|
2007-11-10 20:12:00 +00:00
|
|
|
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Id to select netlist type */
|
2008-05-28 12:28:47 +00:00
|
|
|
enum TypeNetForm {
|
2007-11-10 14:35:04 +00:00
|
|
|
NET_TYPE_UNINIT = 0,
|
2007-09-20 21:06:49 +00:00
|
|
|
NET_TYPE_PCBNEW,
|
|
|
|
NET_TYPE_ORCADPCB2,
|
|
|
|
NET_TYPE_CADSTAR,
|
|
|
|
NET_TYPE_SPICE,
|
2007-11-10 20:12:00 +00:00
|
|
|
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
|
|
|
* is the first id for user netlist format
|
|
|
|
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
|
|
|
* is the last id for user netlist format
|
|
|
|
*/
|
2008-05-15 11:20:19 +00:00
|
|
|
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
2008-05-28 12:28:47 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Max pin number per component and footprint */
|
|
|
|
#define MAXPIN 5000
|
|
|
|
|
2007-09-21 04:40:12 +00:00
|
|
|
enum NetObjetType { /* Type des objets de Net */
|
2007-09-20 21:06:49 +00:00
|
|
|
NET_SEGMENT,
|
|
|
|
NET_BUS,
|
|
|
|
NET_JONCTION,
|
|
|
|
NET_LABEL,
|
|
|
|
NET_GLOBLABEL,
|
2008-05-15 11:20:19 +00:00
|
|
|
NET_HIERLABEL, //on a screen to indicate connection to a higher-level sheet
|
2008-03-20 01:50:21 +00:00
|
|
|
NET_SHEETLABEL, //on a drawscreen element to indicate connection to a lower-level sheet.
|
2007-09-20 21:06:49 +00:00
|
|
|
NET_BUSLABELMEMBER,
|
|
|
|
NET_GLOBBUSLABELMEMBER,
|
2008-03-20 01:50:21 +00:00
|
|
|
NET_HIERBUSLABELMEMBER,
|
2007-09-20 21:06:49 +00:00
|
|
|
NET_SHEETBUSLABELMEMBER,
|
|
|
|
NET_PINLABEL,
|
|
|
|
NET_PIN,
|
|
|
|
NET_NOCONNECT
|
2007-09-21 04:40:12 +00:00
|
|
|
};
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
enum ConnectType { /* Valeur du Flag de connection */
|
|
|
|
UNCONNECTED = 0, /* Pin ou Label non connecte */
|
2008-05-15 11:20:19 +00:00
|
|
|
NOCONNECT, /* Pin volontairement non connectee (Symb. NoConnect utilise) */
|
2008-01-05 17:30:56 +00:00
|
|
|
PAD_CONNECT /* connexion normale */
|
2007-09-21 04:40:12 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Structure decrivant 1 element de connexion (pour netlist ) */
|
|
|
|
class ObjetNetListStruct
|
|
|
|
{
|
|
|
|
public:
|
2008-05-15 11:20:19 +00:00
|
|
|
EDA_BaseStruct* m_Comp; /* Pointeur sur la definition de l'objet */
|
2008-02-12 21:12:46 +00:00
|
|
|
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
|
|
|
* Pour les Pins: pointeur sur le composant */
|
2008-05-15 11:20:19 +00:00
|
|
|
int m_Flag; /* flag pour calculs internes */
|
2008-02-28 19:27:25 +00:00
|
|
|
DrawSheetPath m_SheetList;
|
2007-09-20 21:06:49 +00:00
|
|
|
NetObjetType m_Type;
|
2008-05-15 11:20:19 +00:00
|
|
|
int m_ElectricalType; /* Pour Pins et sheet labels: type electrique */
|
2007-11-10 20:12:00 +00:00
|
|
|
private:
|
2008-05-15 11:20:19 +00:00
|
|
|
int m_NetCode; /* pour elements simples */
|
2007-11-10 20:12:00 +00:00
|
|
|
public:
|
2008-05-15 11:20:19 +00:00
|
|
|
int m_BusNetCode; /* pour connexions type bus */
|
2008-02-12 21:12:46 +00:00
|
|
|
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
2008-05-15 11:20:19 +00:00
|
|
|
* numero de membre */
|
2008-12-10 16:49:53 +00:00
|
|
|
ConnectType m_FlagOfConnection;
|
2008-05-15 11:20:19 +00:00
|
|
|
DrawSheetPath m_SheetListInclude; /* sheet that the hierarchal label connects to.*/
|
|
|
|
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
|
|
|
|
const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
|
2007-09-20 21:06:49 +00:00
|
|
|
wxPoint m_Start, m_End;
|
2007-09-21 04:40:12 +00:00
|
|
|
|
2007-11-10 20:12:00 +00:00
|
|
|
#if defined (DEBUG)
|
2007-09-21 04:40:12 +00:00
|
|
|
void Show( std::ostream& out, int ndx );
|
2007-11-10 20:12:00 +00:00
|
|
|
|
2007-09-21 04:40:12 +00:00
|
|
|
#endif
|
2007-10-13 06:18:44 +00:00
|
|
|
|
|
|
|
void SetNet( int aNetCode ) { m_NetCode = aNetCode; }
|
|
|
|
int GetNet() const { return m_NetCode; }
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/* object used in annotation to handle a list of components in schematic
|
|
|
|
* because in a complex hierarchy, a component is used more than once,
|
|
|
|
* and its reference is depending on the sheet path
|
|
|
|
* for the same component, we must create a flat list of components
|
|
|
|
* used in nelist generation, BOM generation and annotation
|
|
|
|
*/
|
|
|
|
class OBJ_CMP_TO_LIST
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
public:
|
|
|
|
SCH_COMPONENT* m_RootCmp; // the component in schematic
|
|
|
|
EDA_LibComponentStruct* m_Entry; // the source component in library
|
|
|
|
int m_Unit; /* Selected part (For multi parts per package) depending on sheet path */
|
|
|
|
DrawSheetPath m_SheetPath; /* the sheet path for this component */
|
|
|
|
unsigned long m_TimeStamp; /* unique identification number depending on sheet path */
|
|
|
|
bool m_IsNew; /* true for not yet annotated components */
|
|
|
|
wxString* m_Value; /* Component value (same for all instances) */
|
|
|
|
char m_Reference[32]; /* Component reference prefix, without number (for IC1, this is IC) ) */
|
|
|
|
int m_NumRef; /* Reference number (for IC1, this is 1) ) depending on sheet path*/
|
|
|
|
int m_Flag; /* flag for computations */
|
|
|
|
public:
|
2008-05-15 11:20:19 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
OBJ_CMP_TO_LIST()
|
|
|
|
{
|
|
|
|
m_RootCmp = NULL;
|
|
|
|
m_Entry = NULL;
|
|
|
|
m_Unit = 0;
|
|
|
|
m_TimeStamp = 0;
|
|
|
|
m_IsNew = false;
|
|
|
|
m_Value = NULL;
|
|
|
|
m_Reference[0] = 0;
|
|
|
|
m_NumRef = 0;
|
|
|
|
m_Flag = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CompareValue( const OBJ_CMP_TO_LIST& item ) const
|
|
|
|
{
|
|
|
|
return m_Value->CmpNoCase( *item.m_Value );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CompareRef( const OBJ_CMP_TO_LIST& item ) const
|
|
|
|
{
|
|
|
|
return strnicmp( m_Reference, item.m_Reference, 32 );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsPartsLocked( )
|
|
|
|
{
|
|
|
|
return m_Entry->m_UnitSelectionLocked;
|
|
|
|
}
|
2008-05-28 12:28:47 +00:00
|
|
|
};
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Global Variables */
|
|
|
|
eda_global int g_NbrObjNet;
|
2007-09-20 21:06:49 +00:00
|
|
|
eda_global ObjetNetListStruct* g_TabObjNet;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Prototypes: */
|
2007-11-10 20:12:00 +00:00
|
|
|
void WriteNetList( WinEDA_SchematicFrame* frame,
|
|
|
|
const wxString& FileNameNL,
|
|
|
|
bool use_netnames );
|
|
|
|
void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/** Function ReturnUserNetlistTypeName
|
|
|
|
* to retrieve user netlist type names
|
|
|
|
* @param first = true: return first name of the list, false = return next
|
|
|
|
* @return a wxString : name of the type netlist or empty string
|
|
|
|
* this function must be called first with "first_item" = true
|
|
|
|
* and after with "first_item" = false to get all the other existing netlist names
|
|
|
|
*/
|
2007-11-10 20:12:00 +00:00
|
|
|
wxString ReturnUserNetlistTypeName( bool first_item );
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#endif
|