-- sim-tsim.mesa -- last edited by Suzuki: December 1, 1981 3:28 PM DIRECTORY stdio USING [FILE], StreamDefs; SimTsim: DEFINITIONS = { OPEN stdio; -- #include -- header for event driven mosfet simulator. Chris Terman (2/80) nptr: TYPE = LONG POINTER TO Node; tptr: TYPE = LONG POINTER TO Trans; -- #ifdef TIMING --Node: TYPE = RECORD [ -- flink,blink: nptr; doubly-linked event list -- ngate: tptr; list of gates connected to this node -- nsource: tptr; list of sources connected to this node -- ndrain: tptr; list of drains connected to this node -- hnext: nptr; link in hash bucket -- nlink: nptr; sundries list -- ncap: REAL; capacitance of node in pf*/ -- nresist: REAL; total resistance of node material(s) in ohms -- presist: REAL; resistance to vdd for pulled up node in ohms -- ntime: LONG CARDINAL; time, in DELTAs, node was last scheduled in simulation -- npot: CHARACTER; current potential -- nflags: CHARACTER; flag word (see defs below) -- nname: STRING; asciz name of node --]; -- --Trans: TYPE = RECORD [ -- trans: RECORD [ gate,source,drain: nptr; nodes to which trans is connected -- glink,slink,dlink: tptr; link in node connection list -- tresist: REAL; resistance across transistor -- ]; --]; -- #else Node: TYPE = MACHINE DEPENDENT RECORD [ elink: nptr, -- event list ngate: tptr, -- list of gates connected to this node nsource: tptr, -- list of sources connected to this node ndrain: tptr, -- list of drains connected to this node hnext: nptr, -- link in hash bucket nlink: nptr, -- sundries list ncap: REAL, -- capacitance of node in pf ndef: tptr, -- functional definition of node nfuns: tptr, -- list of functions for which this node is an input fpotfill: [0..3B], marked, xqueued, named, pullup, input, watched, traced, warned: BOOLEAN, -- flags npot: Potential, -- current potential fpot: FunctionValue, changecount: CARDINAL, -- counter for the number of charge changes of this node -- the following two fields are used to detect the multiple changes -- of the potentials in one step stepcount: CARDINAL, -- the last step when this node was changed lastpot: Potential, -- the last non-X potential of this node fill: [0..7777B], nname: STRING, -- asciz name of node xpos,ypos: REAL ]; Trans: TYPE = RECORD[ SELECT OVERLAID * FROM trans => [ gate,source,drain: nptr, -- nodes to which trans is connected glink,slink,dlink: tptr -- link in node connection list ], function => [ orlink,andlink: tptr, -- other pieces of function defn vlink: tptr, -- other funs of this input variable output,variable: nptr -- name of output and this input ], ENDCASE ]; -- #endif uptr: TYPE = LONG POINTER TO Usymbol; Usymbol: TYPE = RECORD [ unext: uptr, -- next record in hash bucket uname: STRING, -- asciz for user symbol name unode: nptr -- node for which name is pseudonym ]; wptr: TYPE = LONG POINTER TO Wnode; Wnode: TYPE = RECORD [ wnext: wptr, wname: STRING ]; NINPUTS: CARDINAL = 100; -- node potentials Potential: TYPE = {INIT, DX, DHIGH, DLOW, CX, CHIGH, CLOW, P, DXLOW, DXHIGH, CSHARE}; NPOTS: CARDINAL = 11; -- number of possible potentials --INIT = 0; initial value for accumulator = '- --DX = 1; driven unknown = 'X --DHIGH = 2; driven high = '1 --DLOW = 3; driven low = '0 --CX = 4; charged unknown = 'X --CHIGH = 5; charged high = '1 --CLOW = 6; charged low = '0 --P = 7; pulled high = '1 --DXLOW = 8; resistively connected to DL = 'X --DXHIGH = 9; resistively connected to DH = 'X --CSHARE = 10; shared charge = 'S -- translation of potential to function value FunctionValue: TYPE = {FL, FX, NotFX, FH}; NotFL: FunctionValue = FH; NotFH: FunctionValue = FL; --FL = 0; --NotFL = 177777B - FL; --FH = 3; --NotFH = 177777B - FH; --FX = 1; --NotFX = 177777B - FX; MaxTargv: CARDINAL = 53; extension: PROC[INTEGER, POINTER TO ARRAY [0..MaxTargv) OF STRING]; -- makeGates: PROC; -- Declared in simnsim debug: INTEGER; GNDNode: nptr; outfile: FILE; -- current output file -- MOSSIM.log log: StreamDefs.DiskHandle; traceNumber: CARDINAL; hinputs: ARRAY [0..NINPUTS) OF nptr; -- list of nodes to be driven high nhinputs: INTEGER; -- number of entries in hinputs linputs: ARRAY [0..NINPUTS) OF nptr; -- list of nodes to be driven low nlinputs: INTEGER; -- number of entries in linputs xinputs: ARRAY [0..NINPUTS) OF nptr; -- list of nodes just removed from input lists nxinputs: INTEGER; -- number of entries in xinputs pchars: ARRAY Potential OF CHARACTER = [ '-, 'X, '1, '0, 'X, '1, '0, '1, 'X, 'X, 'S ]; potential: ARRAY Potential OF STRING; pnode: PROC[n: nptr] RETURNS [STRING]; ptrans: PROC[t: tptr]; walkNet: PROC[func: PROC[nptr] RETURNS[CARDINAL]] RETURNS[CARDINAL]; pvalue: PROC[n: nptr]; parseLine: PROC[line: STRING]; GateState: TYPE = {RESIST, ON, OFF}; -- RESIST = 0; -- ON = 1; -- OFF = 2; -- Declared in simttable transTbl: ARRAY GateState OF ARRAY Potential OF ARRAY Potential OF Potential; }.