--File: SimMOSDefs.mesa
-- Martin Newell, January 1980
--Last Updated: December 4, 1980 12:14 PM

SimMOSDefs: DEFINITIONS =

BEGIN

Node: TYPE = LONG POINTER TO NodeRecord;
NodeRecord: TYPE = RECORD [
nodeFlags: WORD,-- flag word (fixnum)
nodeEquivClass: Node,-- ptr to next element of equivlence class
nodeName: STRING,-- pname of node
nodeNext: Node];

Transistor: TYPE = LONG POINTER TO TransistorRecord;
TransistorRecord: TYPE = RECORD[
transGate: Node,-- gate node
transSource: Node,-- source node
transDrain: Node,-- drain node
transNext: Transistor];

--**
Circuit Definition**--
--Exported by SimMOSCircuit.mesa

SimReset: PUBLIC PROCEDURE;
-- global simulator reset, zaps data base to initial state

ETrans: PUBLIC PROCEDURE[gate,source,drain: STRING] RETURNS[t: Transistor];
-- (ETrans ’gate ’source ’drain) makes an enhancement mode transistor
-- with the specified connections
DTrans: PUBLIC PROCEDURE[gate,source,drain: STRING] RETURNS[t: Transistor];
-- (DTrans ’gate ’source ’drain) makes a depletion mode transistor
-- with the specified connections

SetStorage: PUBLIC PROCEDURE[gatesOnly: BOOLEAN];
-- set mode of charge storage

SimNode: PUBLIC PROCEDURE[name: STRING, noCreate: BOOLEAN] RETURNS[n: Node];
-- (SimNode name) makes a node with the appropriate name. if node
-- already exists, nothing is done (but it is returned). if node does
-- not exist and no-create=t then NIL is returned.

--**
Circuit Interrogation**--
--Exported by SimMOSCircuit.mesa

EnumerateNodes: PUBLIC PROCEDURE[apply: PROCEDURE[Node]RETURNS[abort: BOOLEAN]]
RETURNS[aborted: BOOLEAN];
--Invoke apply for each node

EnumerateETrans: PUBLIC PROCEDURE[apply: PROCEDURE[Transistor]RETURNS[BOOLEAN]]
RETURNS[aborted: BOOLEAN];
--Invoke apply for each enhancement mode transistor
--If apply returns TRUE then enumeration is aborted

EnumerateDTrans: PUBLIC PROCEDURE[apply: PROCEDURE[Transistor]RETURNS[BOOLEAN]]
RETURNS[aborted: BOOLEAN];
--Invoke apply for each depletion mode transistor
--If apply returns TRUE then enumeration is aborted

RedefineETrans: PUBLIC PROCEDURE[trans: Transistor, gate,source,drain: STRING];
--Redefine terminals of given enhancement mode transistor

RedefineDTrans: PUBLIC PROCEDURE[trans: Transistor, gate,source,drain: STRING];
--Redefine terminals of given depletion mode transistor

NodeNames: PUBLIC PROCEDURE[trans: Transistor, gate,source,drain: STRING];
--Copy existing names of terminals of given transistor into strings provided

NodeAttributes: PUBLIC PROCEDURE[node: Node, name: STRING]
RETURNS[value: CHARACTER, input,storage: BOOLEAN];
--Copy existing name of node into string provided, and return other state

--**
State Definition**--
--Exported by SimMOSState.mesa

CircuitReset: PUBLIC PROCEDURE[value: CHARACTER];
-- Set all gates to indicated value (1, 0, X)

H: PUBLIC PROCEDURE[name: STRING];
-- make node an input tied to VDD

L: PUBLIC PROCEDURE[name: STRING];
-- make node an input tied to GND

X: PUBLIC PROCEDURE[name: STRING];
-- remove node as an input, back to normal status

SH: PUBLIC PROCEDURE[name: STRING];
-- Store High on node, if connected to a gate

SL: PUBLIC PROCEDURE[name: STRING];
-- Store Low on node, if connected to a gate

InitHi: PUBLIC PROCEDURE[name: STRING];
-- Initialize High on node

InitLo: PUBLIC PROCEDURE[name: STRING];
-- Initialize High on node

--**
State Interrogation**--
--Exported by SimMOSState.mesa

GetNodeValue: PUBLIC PROCEDURE[name: STRING] RETURNS[CHARACTER];
-- get value of node. returns 1,0,-1 for high,low,x

--**
Run Simulation**--
--Exported by SimMOSRun.mesa

SimSolve: PUBLIC PROCEDURE[abort: PROCEDURE RETURNS[BOOLEAN]];
-- step - run simulation until no changes are detected, or abort returns TRUE

MicroStep: PUBLIC PROCEDURE[reportChanges,reportShorts: BOOLEAN]
RETURNS[changed,shorts: CARDINAL];
-- Execute one simulation iteration.

END.