-- File: DJExtCombine.mesa
-- combine routines used by the disjoint circuit extractor
-- Written by Martin Newell/Dan Fitzpatrick July 1981
-- Last edited: August 3, 1981 1:46 PM
DIRECTORY
DJExtCapDefs: FROM "DJExtCapDefs" USING [FindCap, CombineCap],
DJExtCombineDefs: FROM "DJExtCombineDefs",
DJExtMergeDefs: FROM "DJExtMergeDefs" USING [Lookup, Merge, GetProp, PutProp],
DJExtTransDefs: FROM "DJExtTransDefs" USING [FindTransistor, CombineTransistors],
DJExtTypes: FROM "DJExtTypes" USING [Node, NodeNumber, diff, poly, metal, gate],
Runtime: FROM "Runtime" USING [CallDebugger];
DJExtCombine: PROGRAM
IMPORTS DJExtCapDefs, DJExtMergeDefs, DJExtTransDefs, Runtime
EXPORTS DJExtCombineDefs =
BEGIN
OPEN DJExtCapDefs, DJExtMergeDefs, DJExtTransDefs, DJExtTypes, Runtime;
Combine: PUBLIC PROCEDURE [n1,n2:NodeNumber] RETURNS[n:NodeNumber] =
BEGIN
p,p1,p2: Node;
n1 ← Lookup[n1];
n2 ← Lookup[n2];
IF n1 = n2 THEN RETURN[n1];
p1 ← GetProp[n1];
p2 ← GetProp[n2];
n ← Merge[n1,n2];
p ← CombineNodes[p1,p2];
IF p # NIL THEN p.node ← n;
PutProp[n1,nil];
PutProp[n2,nil];
PutProp[n,p];
END;
CombineNodes: PUBLIC PROCEDURE [n1,n2:Node] RETURNS[n:Node] =
BEGIN
IF n1 = NIL THEN RETURN[n2];
IF n2 = NIL THEN RETURN[n1];
IF n1.type # n2.type THEN CallDebugger["type conflict in CombineNodes"];
SELECT n1.type FROM
Transistor => n ← CombineTransistors[n1,n2];
Capacitor => n ← CombineCap[n1,n2];
ENDCASE => CallDebugger["Unknown case in CombineNodes"];
END;
AttachNode: PUBLIC PROCEDURE [num:NodeNumber, node:Node] =
BEGIN
tmp: Node;
num ← Lookup[num];
tmp ← GetProp[num];
IF tmp # NIL THEN node ← CombineNodes[node,tmp];
PutProp[num,node];
END;
GetNode: PUBLIC PROCEDURE [num:NodeNumber] RETURNS[node:Node] =
BEGIN
num ← Lookup[num];
node ← GetProp[num];
END;
FindNode: PUBLIC PROCEDURE [num:NodeNumber, layer:INTEGER, x,y:REAL] RETURNS[node:Node] =
BEGIN
node ← GetNode[num];
IF node # NIL THEN RETURN;
SELECT layer FROM
gate => {
node ← FindTransistor[num,0,0];
RETURN;
};
poly,diff,metal => {
node ← FindCap[num];
RETURN;
};
ENDCASE => CallDebugger["Bad layer in FindNode"];
END;
nil: LONG POINTER ← NIL;
END.