ThymeParser:
CEDAR
DEFINITIONS = {
The following structure defines a table of transistor types, used by the Thyme parser to tell which types of circuits should be treated as transistors.
TypeList: TYPE = REF TypeListRec;
TypeListRec:
TYPE =
RECORD [
name: Rope.
ROPE,
Name of this Thyme circuits that correspond to this kind of transistor.
clientData:
REF
ANY ←
NIL,
Information understood only by the client. This value is passed into TransistorProcs by the parser when it finds this particular kind of transistor.
next: TypeList
Next entry in list, or NIL for end of list.
];
ReadFile:
PROC[inStream, errorStream:
IO.
STREAM, table: TypeList ←
NIL, resProc: ResistorProc ←
NIL, capProc: CapacitorProc ←
NIL, fetProc: TransistorProc ←
NIL, attProc: AttributeProc ←
NIL, nodeProc: NodeProc ←
NIL, clientData:
REF
ANY ←
NIL, stopValue:
REF
BOOL ←
NIL]
RETURNS [nodes, fets, caps, res:
INT];
Call this procedure to read in a Thyme file. InStream is a place to read Thyme-format information, and errorStream is a place to write error messages. Table identifies the names of circuits that are transistors, and the various procedures are called when those elements are found in the circuit. The types of the procedures are defined below. Each procedure is passed clientData as a parameter. If a NIL value is provided for any procedure, then no procedure is called when objects of that particular type are found. The stopValue parameter is tested occasionally while reading in the file. If it is ever found to be TRUE, then file read-in is aborted.
ResistorProc:
TYPE =
PROC[nodeA, nodeB: Rope.
ROPE, ohms:
REAL, clientData:
REF
ANY];
Invoked for each resistor in the circuit; the nodeA and nodeB are hierarchical names for the terminals of the resistor, and ohms is the value of the resistor in ohms. ClientData is the value passed in to ReadFile.
CapacitorProc:
TYPE =
PROC[nodeA, nodeB: Rope.
ROPE, pfs:
REAL, clientData:
REF
ANY];
Invoked for each capacitor in the circuit; the nodeA and nodeB are hierarchical names for the terminals of the capacitor, and pfs is the value of the capacitor in pfs. ClientData is the value passed in to ReadFile.
TransistorProc:
TYPE =
PROC[gate, source, drain: Rope.
ROPE, fetData:
REF
ANY, l, w, x, y:
REAL, clientData:
REF
ANY ←
NIL]
RETURNS [handle:
REF
ANY];
Invoked for each transistor in the circuit; gate, source, and drain are the names of the transistor's terminals. FetData is the clientData field from the TypeList entry that matched for this circuit, whereas clientData is the clientData value passed in to ReadFile. L and w are length and width of the transistor, in microns. X and y are the position of the transistor in the circuit, in microns. The return result is a handle that is passed into AttributeProc's (see below) to identify the transistor.
AttributeProc:
TYPE =
PROC[fetHandle:
REF
ANY, name, value: Rope.
ROPE, clientData:
REF
ANY];
Invoked for each attribute in the circuit. AttributeProcs are always invoked immediately after the TransistorProc call, and fetHandle is used to identify the transistor (it is the return value from the last TransistorProc call). Name is the attribute's name, and value is its value. ClientData is the value passed by the client to ReadFile.
NodeProc:
TYPE =
PROC[name: Rope.
ROPE, clientData:
REF
ANY];
Invoked for each node in the circuit; name is the hierarchical name of the node. This procedure will be invoked before the node name is used in any resistors, capacitors, or transistors. ClientData is the value passed in to ReadFile.
}.