2009-12-02 21:44:03 +00:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Class NETLIST_OBJECT to handle 1 item connected (in netlist and erc */
|
|
|
|
/* calculations) */
|
|
|
|
/***********************************************************************/
|
2009-07-12 15:29:42 +00:00
|
|
|
|
|
|
|
#ifndef _CLASS_NETLIST_OBJECT_H_
|
|
|
|
#define _CLASS_NETLIST_OBJECT_H_
|
|
|
|
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_sheet_path.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2010-10-22 12:11:52 +00:00
|
|
|
#include "lib_pin.h" // LIB_PIN::ReturnPinStringNum( m_PinNum )
|
2010-08-03 02:13:33 +00:00
|
|
|
|
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
/* Type of Net objects (wires, labels, pins...) */
|
|
|
|
enum NetObjetType {
|
|
|
|
NET_ITEM_UNSPECIFIED, // only for not yet initialized instances
|
|
|
|
NET_SEGMENT, // connection by wire
|
|
|
|
NET_BUS, // connection by bus
|
2009-12-02 21:44:03 +00:00
|
|
|
NET_JONCTION, // connection by junction: can connect to
|
|
|
|
// or more crossing wires
|
2009-07-12 15:29:42 +00:00
|
|
|
NET_LABEL, // this is a local label
|
2009-12-02 21:44:03 +00:00
|
|
|
NET_GLOBLABEL, // this is a global label that connect all
|
|
|
|
// others global label in whole hierarchy
|
|
|
|
NET_HIERLABEL, // element to indicate connection to a
|
|
|
|
// higher-level sheet
|
|
|
|
NET_SHEETLABEL, // element to indicate connection to a
|
|
|
|
// lower-level sheet.
|
|
|
|
NET_BUSLABELMEMBER, /* created when a bus label is found:
|
|
|
|
* the bus label (like DATA[0..7] is
|
|
|
|
* converted to n single labels like
|
|
|
|
* DATA0, DATA1 ...
|
|
|
|
*/
|
|
|
|
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
|
|
|
|
// global bus label is found
|
|
|
|
NET_HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
|
|
|
|
// hierarchical bus label is found
|
|
|
|
NET_SHEETBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
|
|
|
|
// pin sheet label using bus notation
|
|
|
|
// is found
|
|
|
|
NET_PINLABEL, /* created when a pin is POWER (IN or
|
|
|
|
* OUT) with invisible attribute is found:
|
|
|
|
* these pins are equivalent to a global
|
|
|
|
* label and are automatically connected
|
|
|
|
*/
|
2009-07-12 15:29:42 +00:00
|
|
|
NET_PIN, // this is an usual pin
|
|
|
|
NET_NOCONNECT // this is a no connect symbol
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Values for .m_FlagOfConnection member */
|
|
|
|
enum ConnectType {
|
2009-12-02 21:44:03 +00:00
|
|
|
UNCONNECTED = 0, /* Pin or Label not connected (error) */
|
|
|
|
NOCONNECT_SYMBOL_PRESENT, /* Pin not connected but have a NoConnect
|
|
|
|
* symbol on it (no error) */
|
|
|
|
PAD_CONNECT /* Normal connection (no error) */
|
2009-07-12 15:29:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class NETLIST_OBJECT
|
|
|
|
{
|
|
|
|
public:
|
2009-12-02 21:44:03 +00:00
|
|
|
NetObjetType m_Type; /* Type of item (see NetObjetType
|
|
|
|
* enum) */
|
|
|
|
EDA_BaseStruct* m_Comp; /* Pointer on the library item that
|
|
|
|
* created this net object (the parent)
|
|
|
|
*/
|
|
|
|
SCH_ITEM* m_Link; /* 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
|
|
|
|
*/
|
2010-06-23 17:00:12 +00:00
|
|
|
int m_Flag; /* flag used in calculations */
|
|
|
|
SCH_SHEET_PATH m_SheetList;
|
|
|
|
int m_ElectricalType; /* Has meaning only for Pins and
|
2009-12-02 21:44:03 +00:00
|
|
|
* hierarchical pins: electrical type */
|
2009-07-12 15:29:42 +00:00
|
|
|
private:
|
2010-06-23 17:00:12 +00:00
|
|
|
int m_NetCode; /* net code for all items except BUS
|
2009-12-02 21:44:03 +00:00
|
|
|
* labels because a BUS label has
|
|
|
|
* as many net codes as bus members
|
2009-07-12 15:29:42 +00:00
|
|
|
*/
|
|
|
|
public:
|
2010-06-23 17:00:12 +00:00
|
|
|
int m_BusNetCode; /* Used for BUS connections */
|
|
|
|
int m_Member; /* for labels type NET_BUSLABELMEMBER
|
2009-12-02 21:44:03 +00:00
|
|
|
* ( bus member created from the BUS
|
|
|
|
* label ) member number
|
|
|
|
*/
|
2009-07-12 15:29:42 +00:00
|
|
|
ConnectType m_FlagOfConnection;
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH m_SheetListInclude; /* sheet that the hierarchical label
|
|
|
|
* connects to.*/
|
|
|
|
long m_PinNum; /* pin number ( 1 long = 4 bytes ->
|
|
|
|
* 4 ascii codes) */
|
2010-06-24 18:31:43 +00:00
|
|
|
wxString m_Label; /* Label text. */
|
2009-12-02 21:44:03 +00:00
|
|
|
wxPoint m_Start; // Position of object or for segments:
|
|
|
|
// starting point
|
|
|
|
wxPoint m_End; // For segments (wire and buses):
|
|
|
|
// ending point
|
2010-06-23 17:00:12 +00:00
|
|
|
NETLIST_OBJECT* m_NetNameCandidate; /* a pointer to a label connected to the net,
|
|
|
|
* that can be used to give a name to the net
|
|
|
|
* NULL if no usable label
|
|
|
|
*/
|
2009-07-12 15:29:42 +00:00
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( std::ostream& out, int ndx );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
NETLIST_OBJECT();
|
|
|
|
NETLIST_OBJECT( NETLIST_OBJECT& aSource ); // Copy constructor
|
|
|
|
|
|
|
|
~NETLIST_OBJECT();
|
|
|
|
|
|
|
|
void SetNet( int aNetCode ) { m_NetCode = aNetCode; }
|
|
|
|
int GetNet() const { return m_NetCode; }
|
2010-08-03 02:13:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPinNum
|
|
|
|
* returns a pin number in wxString form. Pin numbers are not always
|
|
|
|
* numbers. "A23" would be a valid pin number.
|
|
|
|
*/
|
|
|
|
wxString GetPinNumText()
|
|
|
|
{
|
|
|
|
// hide the ugliness in here, but do it inline.
|
|
|
|
return LIB_PIN::ReturnPinStringNum( m_PinNum );
|
|
|
|
}
|
2009-07-12 15:29:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _CLASS_NETLIST_OBJECT_H_
|