Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
/********************************************************************/
/********************************************************************/
/***** *****/
/***** L A B C E N T E R E L E C T R O N I C S *****/
/***** *****/
/***** LABCENTER INTEGRATED SIMULATION ARCHITECTURE *****/
/***** *****/
/***** Virtual System Modeling Interface Header *****/
/***** *****/
/********************************************************************/
/********************************************************************/
#ifndef VSM_HPP
#define VSM_HPP
// Version 1.00 - Initial release.
// Version 1.01 - Added setvdmhandler() to IINSTANCE, and the ICPU interface
// Added sethandler() to IDSIMPIN.
// Added setcallbackex to IDSIMCKT.
// Version 1.02 - Added IWATCHPOPUP interface.
// Version 1.03 - Added getsteptoaddr() function to sourcewin.
// Version 1.04 - COMPONENT::getsymbolarea() now returns BOOL.
// Added allocvars(), intergrate() and truncerr() to ISPICECKT.
// Version 1.05 - Added createpin and createnet functionality.
// Version 1.06 - Added timestamped authorization function.
// Version 1.07 - Added DSIM systime() function.
// Added setclockcallback() function.
// Version 1.10 - Added streamlined settiming/setstates/drivexxx methods to IDSIMPIN.
// Added loadmemory() function to IINSTANCE.
// Added bus pin API.
#define VSM_API_VERSION 110
// 01/09/2003
#define VSM_BUILD_DATE 0x9ADFBCA5
// VSM uses 4 byte alignment throughout
#pragma pack(push,4)
// Portability typedefs:
#ifndef STDLX_H
#define VOID void
typedef double DOUBLE;
typedef char CHAR;
typedef unsigned char BYTE;
typedef signed short SHORT;
typedef signed int INT;
typedef signed long LONG;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef signed int BOOL;
typedef unsigned int UINT;
typedef unsigned long COLOUR;
#define TRUE 1
#define FALSE 0
#endif
#ifdef __SC__
typedef long long LONGLONG;
#else
typedef __int64 LONGLONG;
#endif
// Flags for creating pop-up windows. The bottom 20 bits are reserved for use by VSM,
// whilst the remaining top 12 bits are available for user pop-ups.
enum POPUPFLAGS
{ PWF_VISIBLE = 0x00000001,
PWF_SIZEABLE = 0x00000002,
PWF_LOCKPOSITION = 0x00000004,
PWF_HIDEONANIMATE = 0x00000008,
PWF_AUTOREFRESH = 0x00000010,
PWF_WANTKEYBOARD = 0x00000020,
PWF_ACTIVE = 0x00008000,
PWF_INTERNAL = 0x80000000
};
// Structure used to pass createpopup information:
struct CREATEPOPUPSTRUCT
{ POPUPID id;
POPUPTYPES type;
CHAR *caption;
INT width, height;
DWORD flags;
};
// Definition of services provided by an Active Component to an Active Model.
class ICOMPONENT
{ public:
// Property management:
virtual CHAR *getprop (CHAR *name) = 0;
virtual CHAR *getproptext (VOID) = 0;
virtual VOID addprop (CHAR *propname, CHAR *item, WORD hflags) = 0;
virtual VOID delprop (CHAR *propname) = 0;
virtual VOID setproptext(CHAR *text) = 0;
// Active State processing:
virtual ACTIVESTATE getstate (INT element, ACTIVEDATA *data) = 0;
virtual BOOL setstate (ACTIVESTATE state) = 0;
// State polarity bits:
#define SP_UNDEFINED 0x00 // The undefined state.
#define SP_LOW 0x01 // Polarity Low.
#define SP_FLOAT 0x02 // Polarity Float (i.e. half volts).
#define SP_HIGH 0x03 // Polarity High.
#define SP_MASK 0x03 // Use to mask off polarity.
// State strength bits:
#define SS_FLOAT 0x00 // Strength Float.
#define SS_DRIVEN 0x04 // Flag bit for driven state.
#define SS_WEAK 0x04 // Strength Weak.
#define SS_STRONG 0x0C // Strength Strong.
#define SS_INJECT 0x14 // Strength for generators.
#define SS_POWER 0x1C // Strength Power rail.
#define SS_MASK 0x1C // Used to mask off strength.
// State flag bits:
#define SF_CONTENTION 0x20 //
#define SF_MESSAGE 0x40 // Message associated with state (?)
#define SF_MASK 0xE0 // Use to mask off flags.
// State constants:
// Application code should deal only with these values;
// Manipulation of contention and message flags is a kernel function.
enum STATE
{ UNDEFINED = 0,
TSTATE = 1,
FSTATE = -1,
PLO = SS_POWER+SP_LOW,
ILO = SS_INJECT+SP_LOW,
SLO = SS_STRONG+SP_LOW,
WLO = SS_WEAK+SP_LOW,
FLT = SS_FLOAT+SP_FLOAT,
WHI = SS_WEAK+SP_HIGH,
SHI = SS_STRONG+SP_HIGH,
IHI = SS_INJECT+SP_HIGH,
PHI = SS_POWER+SP_HIGH,
WUD = SS_WEAK+SP_UNDEFINED,
SUD = SS_STRONG+SP_UNDEFINED
};
// Functions for testing states.
inline BOOL islow (STATE s) { return (s & SP_MASK) == SP_LOW; }
inline BOOL ishigh (STATE s) { return (s & SP_MASK) == SP_HIGH; }
inline BOOL isfloating (STATE s) { return (s & SP_MASK) == SP_FLOAT; }
inline BOOL iscontention (STATE s) { return s & SF_CONTENTION; }
inline BOOL isdefined (STATE s) { return s != SP_UNDEFINED; }
inline BOOL ishighlow (STATE s) { return s & 1; }
inline INT polarity (STATE s) { return s & SP_MASK; }
inline INT strength (STATE s) { return s & SS_MASK; }
// Type for memory address
typedef DWORD ADDRESS;
// This is declared so we can use pointers to them, but the implementation is not exposed:
class EVENT;
class IDSIMMODEL;
// This declares a pointer to a function which a model
// can specify to be called for events on a particular pin or group of pins.
typedef VOID (IDSIMMODEL::*PINHANDLERFN)(ABSTIME time, DSIMMODES mode);
typedef VOID (IDSIMMODEL::*CALLBACKHANDLERFN)(ABSTIME time, EVENTID id);
class IDSIMPIN2 : public IDSIMPIN1
{ public:
virtual VOID settiming (RELTIME tlh, RELTIME thl, RELTIME tgq) = 0;
virtual VOID setstates (STATE tstate, STATE fstate, STATE zstate) = 0;
virtual EVENT *drivebool (ABSTIME time, BOOL flag) = 0;
virtual EVENT *drivestate (ABSTIME time, STATE state) = 0;
virtual EVENT *drivetristate (ABSTIME time) = 0;
};
// Interface to bus pin object - new in APIVER 1.10
class IBUSPIN
{ public:
virtual VOID settiming (RELTIME tlh, RELTIME thl, RELTIME tz) = 0;
virtual VOID setstates (STATE tstate, STATE fstate, STATE zstate) = 0;
virtual VOID sethandler (IDSIMMODEL *model, PINHANDLERFN phf) = 0;
virtual VOID drivebusvalue (ABSTIME time, DWORD value) = 0;
virtual VOID drivetristate (ABSTIME time) = 0;
virtual VOID drivebitstate (ABSTIME time, UINT bit, STATE state) = 0;
virtual DWORD getbusvalue() = 0;
virtual DWORD getbusdrive() = 0;
virtual STATE getbitstate(UINT bit) = 0;
};
// Interface to a digital model class.
class IDSIMMODEL
{ public:
virtual INT isdigital (CHAR *pinname) = 0;
virtual VOID setup (IINSTANCE *instance, IDSIMCKT *dsim) = 0;
virtual VOID runctrl (RUNMODES mode) = 0;
virtual VOID actuate (REALTIME time, ACTIVESTATE newstate) = 0;
virtual BOOL indicate (REALTIME time, ACTIVEDATA *newstate) = 0;
virtual VOID simulate (ABSTIME time, DSIMMODES mode) = 0;
virtual VOID callback (ABSTIME time, EVENTID eventid) = 0;
};
/*********************************************************************
***** Mixed Model Interface ****
********************************/
// Interface to a mixed mode model class:
// This is actually just a combination of an ISPICEMODEL and an IDSIMMODEL.
class IMIXEDMODEL : public ISPICEMODEL, public IDSIMMODEL
{ public:
// Pin typing and connection functions:
virtual INT isanalog (CHAR *pinname) = 0;
virtual INT isdigital (CHAR *pinname) = 0;
// Common Functions:
virtual VOID runctrl (RUNMODES mode) = 0;
virtual VOID actuate (REALTIME time, ACTIVESTATE newstate) = 0;
virtual BOOL indicate (REALTIME time, ACTIVEDATA *newstate) = 0;
struct ACTIVEDATA
{ ACTIVEDATATYPES type;
union
{ INT intval;
DOUBLE realval;
STATE stateval;
DOUBLE wireinfo[2]; // Voltage and current
SPICEDATA spicedata;
DSIMDATA dsimdata;
VOID *userinfo; // Pointer to user data
};
};
struct ACTIVEEVENT
{ DWORD instance; // Design Global Instance value for target indicator
DWORD callback; // Callback Pointer to the active component object
DWORD element; // Sub-element within parent.
ACTIVEDATA data; // Data structure passed to models:
};
/*********************************************************************
***** Popup Window Support ****
******************************/
// Data types and formats used by various popup window types
enum DATATYPES { DT_VOID=-1, DT_STRING, DT_TEXT, DT_BYTE, DT_WORD, DT_DWORD, DT_QWORD, DT_IEEE_FLOAT, DT_IEEE_DOUBLE, DT_HTEC_FLOAT, DT_MCHP_FLOAT, DT_BIGENDIAN=0x8000 };
enum DISPFORMATS { DF_VOID=-1, DF_BINARY, DF_OCTAL, DF_HEXADECIMAL, DF_SIGNED, DF_UNSIGNED, DF_FLOAT, DF_TEXT };
// Interface through which windows messages can be passed to a USERPOPUP's owner:
class IMSGHLR
{ public:
virtual LRESULT msghlr (HWND, MESSAGE, WPARAM, LPARAM) = 0;
};
class IWATCHPOPUP
{ public:
// Offset is the byte offset within the memory block independent of any 'base' associated with the memory
// window. For example, if offset is '4' we are refering to the fourth byte in the memory block; if the memory
// block as an implied base of, say, 12, this would be address '16'.
virtual VOID addnameditem (CHAR *name, IMEMORYPOPUP *, DWORD offset, DATATYPES type, DISPFORMATS format) = 0;
// This interfaces are used by PROSPICE itself to poll for watchpoints
virtual BOOL initwatchpoints () = 0;
virtual BOOL testwatchpoints () = 0;
};
/*********************************************************************
**** Definitions for VSM Debug Support ****
******************************************/
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.