-- File: SimMOSAccessDefs.mesa
-- Last Updated: December 4, 1980 10:16 AM
--This version uses eXtended memory on an Alto II
DIRECTORY
InlineDefs: FROM "InlineDefs" USING[LongCOPY],
SimMOSDefs: FROM "SimMOSDefs" USING[Node, NodeRecord, Transistor, TransistorRecord],
XFSPDefs: FROM "XFSPDefs" USING[XAllocateHeapNode];
SimMOSAccessDefs: DEFINITIONS
IMPORTS InlineDefs, XFSPDefs =
BEGIN OPEN InlineDefs, SimMOSDefs, XFSPDefs;
--Record component access procedures--
AllocateNode: PUBLIC PROCEDURE[name: STRING] RETURNS[node: Node] = INLINE
--Allocates space for a Node and its name
--This version puts chars adjacent to the Node record and following it,
-- and records the name length in node.nodeName
BEGIN
node ← XAllocateHeapNode[SIZE[NodeRecord] + (name.length+1)/2];
LongCOPY[@name.length,1,@(node.nodeName)];
END;
AllocateTransistor: PUBLIC PROCEDURE RETURNS[trans: Transistor] = INLINE
BEGIN
RETURN[XAllocateHeapNode[SIZE[TransistorRecord]]];
END;
DestroyNodes: PUBLIC PROCEDURE[node: Node] RETURNS[Node] = INLINE
BEGIN --assumes nodeName STRING has been freed
--nothing for now
RETURN[NIL];
END;
DestroyTransistors: PUBLIC PROCEDURE[trans: Transistor] RETURNS[Transistor] = INLINE
BEGIN
--nothing for now
RETURN[NIL];
END;
--Node access procedures
SetNode: PUBLIC PROCEDURE[node: Node,
nodeFlags: WORD,-- flag word (fixnum)
nodeEquivClass: Node,-- ptr to next element of equivlence class
nodeName: STRING,-- pname of node
nodeNext: Node] = INLINE
BEGIN
n: NodeRecord ← [
nodeFlags: nodeFlags,
nodeEquivClass: nodeEquivClass,
nodeName: LOOPHOLE[nodeName.length,STRING],
nodeNext: nodeNext];
LongCOPY[@n,SIZE[NodeRecord],node];
LongCOPY[BASE[nodeName.text], (nodeName.length+1)/2, node+SIZE[NodeRecord]];
END;
SetNodeFlags: PUBLIC PROCEDURE[node: Node, nodeFlags: WORD] = INLINE
BEGIN
LongCOPY[@nodeFlags,SIZE[WORD],@(node.nodeFlags)];
END;
SetNodeEquivClass: PUBLIC PROCEDURE[node: Node, nodeEquivClass: Node] = INLINE
BEGIN
LongCOPY[@nodeEquivClass,SIZE[Node],@(node.nodeEquivClass)];
END;
SetNodeName: PUBLIC PROCEDURE[node: Node, nodeName: STRING] = INLINE
BEGIN
LongCOPY[@nodeName.length,1,@(node.nodeName)];
LongCOPY[BASE[nodeName.text], (nodeName.length+1)/2, node+SIZE[NodeRecord]];
END;
SetNodeNext: PUBLIC PROCEDURE[node: Node, nodeNext: Node] = INLINE
BEGIN
LongCOPY[@nodeNext,SIZE[Node],@(node.nodeNext)];
END;
GetNodeFlags: PUBLIC PROCEDURE[node: Node] RETURNS[nodeFlags: WORD] = INLINE
BEGIN
LongCOPY[@(node.nodeFlags),SIZE[WORD],@nodeFlags];
END;
GetNodeEquivClass: PUBLIC PROCEDURE[node: Node] RETURNS[nodeEquivClass: Node] = INLINE
BEGIN
LongCOPY[@(node.nodeEquivClass),SIZE[Node],@nodeEquivClass];
END;
GetNodeName: PUBLIC PROCEDURE[node: Node, name: STRING] RETURNS[STRING] = INLINE
--Returns name (input parameter) filled in with the name
--Generates StringDefs.StringBoundFault[s]RETURNS[ns] if name not long enough
BEGIN
LongCOPY[@(node.nodeName),1,@name.length];
LongCOPY[node+SIZE[NodeRecord], (name.length+1)/2, BASE[name.text]];
RETURN[name];
END;
GetNodeNext: PUBLIC PROCEDURE[node: Node] RETURNS[nodeNext: Node] = INLINE
BEGIN
LongCOPY[@(node.nodeNext),SIZE[Node],@nodeNext];
END;
--Transistor access procedures
SetTrans: PUBLIC PROCEDURE[trans: Transistor,
transGate: Node,-- gate node
transSource: Node,-- source node
transDrain: Node,-- drain node
transNext: Transistor] = INLINE
BEGIN
t: TransistorRecord ← [
transGate: transGate,
transSource: transSource,
transDrain: transDrain,
transNext: transNext];
LongCOPY[@t,SIZE[TransistorRecord],trans];
END;
SetTransGate: PUBLIC PROCEDURE[trans: Transistor, transGate: Node] = INLINE
BEGIN
LongCOPY[@transGate,SIZE[Node],@(trans.transGate)];
END;
SetTransSource: PUBLIC PROCEDURE[trans: Transistor, transSource: Node] = INLINE
BEGIN
LongCOPY[@transSource,SIZE[Node],@(trans.transSource)];
END;
SetTransDrain: PUBLIC PROCEDURE[trans: Transistor, transDrain: Node] = INLINE
BEGIN
LongCOPY[@transDrain,SIZE[Node],@(trans.transDrain)];
END;
SetTransNext: PUBLIC PROCEDURE[trans: Transistor, transNext: Transistor] = INLINE
BEGIN
LongCOPY[@transNext,SIZE[Transistor],@(trans.transNext)];
END;
GetTransGate: PUBLIC PROCEDURE[trans: Transistor] RETURNS[transGate: Node] = INLINE
BEGIN
LongCOPY[@(trans.transGate),SIZE[Node],@transGate];
END;
GetTransSource: PUBLIC PROCEDURE[trans: Transistor] RETURNS[transSource: Node] = INLINE
BEGIN
LongCOPY[@(trans.transSource),SIZE[Node],@transSource];
END;
GetTransDrain: PUBLIC PROCEDURE[trans: Transistor] RETURNS[transDrain: Node] = INLINE
BEGIN
LongCOPY[@(trans.transDrain),SIZE[Node],@transDrain];
END;
GetTransNext: PUBLIC PROCEDURE[trans: Transistor] RETURNS[transNext: Transistor] = INLINE
BEGIN
LongCOPY[@(trans.transNext),SIZE[Transistor],@transNext];
END;
END.