/* $Header: /c1/cad/other/src/rsim/h/RCS/net.h,v 1.3 86/01/21 00:29:19 chu Exp $ */ /* header for event driven mosfet simulator. Chris Terman (6/84) */ typedef struct Event *evptr; typedef struct Node *nptr; typedef struct Trans *tptr; typedef struct Input *iptr; struct Event { evptr flink,blink; /* doubly-linked event list */ evptr nlink; /* link for list of events for this node */ nptr enode; /* node this event is all about */ nptr cause; /* node which caused this event to happen */ long ntime; /* time, in DELTAs, of this event */ long rtime; /* time when transition should be reported */ char eval; /* new value */ char marked; /* whether the src/drn of this gate have been marked */ }; struct Node { nptr nlink; /* sundries list */ evptr events; /* charge sharing event */ tptr *ngate; /* list of xistors w/ gates connected to this node */ tptr *nterm; /* list of xistors w/ sources/drains connected to this node */ nptr hnext; /* link in hash bucket */ float ncap; /* capacitance of node in pf */ float vlow; /* low logic threshold for this node, normalized units */ float vhigh; /* high logic threshold for this node, normalized units */ short tplh; /* low to high transition time in DELTA's */ short tphl; /* high to low transition time in DELTA's */ long ctime; /* time, in DELTAs, of last transistion */ nptr cause; /* node which caused last transition of this node */ char npot; /* current potential */ short nflags; /* flag word (see defs below) */ char *nname; /* asciz name of node */ }; struct Trans { nptr gate,source,drain; /* nodes to which trans is connected */ float rstatic; /* static resistance of transistor */ float rdynhigh; /* dynamic-high resistance */ float rdynlow; /* dynamic-low resistance */ char ttype; /* type of transistor */ char state; /* cache to remember current state of xistor */ char tflags; /* flag word */ int *scache,*dcache; /* caches to remember source/drain values */ }; #define NOVALUE -1 /* indicates cache is empty */ /* linked list of inputs */ struct Input { iptr next; /* next element of list */ nptr inode; /* pointer to this input node */ }; /* transistor types (ttype) */ #define NCHAN 0 /* n-channel enhancement */ #define PCHAN 1 /* p-channel enhancement */ #define ALWAYSON 2 /* types >= ALWAYSON aren't affected by gate logic state */ #define DEP 2 /* depletion */ #define PULLUP 3 /* pullup => depletion with source==gate */ #define RESIST 4 /* simple two-terminal resistor */ #define CAPACTR 5 /* simple two-terminal capacitor */ #define NTTYPES 6 /* number of transistor types defined */ #define GATELIST 0x80 /* set if gate of xistor is a node list */ #define TDROP 0x40 /* set if gate has threshold drop */ #define BASETYPE(t) ((t)->ttype & 0x3F) /* transistor states (state)*/ #define OFF 0 /* non-conducting */ #define ON 1 /* conducting */ #define UNKNOWN 2 /* unknown */ #define WEAK 3 /* weak */ /* transistor flags (tflags) */ #define CROSSED 01 /* figure what's on the *other* terminal node of a transistor */ #define other_node(t,n) ((t)->source==(n) ? (t)->drain : (t)->source) /* node potentials */ #define LOW 0 /* low low */ #define X 1 /* unknown, intermediate, ... value */ #define HIGH 3 /* logic high */ #define DECAY 4 /* waiting to decay to X (only in events) */ /* possible values for nflags */ #define WATCHED 01 #define INPUT 02 #define NAMED 04 #define ALIAS 010 #define DELETED 020 #define STOPONCHANGE 040 #define USERDELAY 0100 #define VISITED 0200 #define NEIGHBOUR 0400 extern nptr VDD_node,GND_node; /* nodes to know better */ #define STATIC 0 /* static resistance */ #define DYNHIGH 1 /* dynamic-high resistance */ #define DYNLOW 2 /* dynamic-low resistance */ #define POWER 3 /* resistance for power calculation, only used by presim */ /* Define TRUE and FALSE values */ #define TRUE 1 #define FALSE 0 /* version numbers: incompatible changes in the binary file format result in a * new major version. Minor version number incremented with each program * change. */ #define VMAJOR 5 #define VMINOR 1