-- File: DJExtDebug.mesa
-- Test program for generating disjoint cells
-- Written by Martin Newell/Dan Fitzpatrick February 1981
-- Last edited: August 6, 1981 2:26 PM
DIRECTORY
DJExtDefs: FROM "DJExtDefs",
DJExtCombineDefs: FROM "DJExtCombineDefs" USING [Combine, AttachNode, GetNode],
DJExtDebugDefs: FROM "DJExtDebugDefs",
DJExtMergeDefs: FROM "DJExtMergeDefs" USING [InitMerge, Merge, Lookup],
DJExtTransDefs: FROM "DJExtTransDefs",
DJExtTypes: FROM "DJExtTypes",
DJExtUtilsDefs: FROM "DJExtUtilsDefs" USING [WriteLongDecimal],
IODefs: FROM "IODefs",
JaMFnsDefs: FROM "JaMFnsDefs" USING [Register, PopInteger];
DJExtDebug: PROGRAM
IMPORTS DJExtCombineDefs, DJExtMergeDefs, DJExtTransDefs, DJExtUtilsDefs, IODefs, JaMFnsDefs
EXPORTS DJExtDefs, DJExtDebugDefs =
BEGIN
OPEN DJExtCombineDefs, DJExtMergeDefs, DJExtTransDefs, DJExtTypes, DJExtUtilsDefs, IODefs, JaMFnsDefs;
PrintTransistors: PROCEDURE =
BEGIN
trans,next:Node;
FOR trans ← GetTransistorList[],next UNTIL trans = NIL DO
next ← trans.next;
IF trans.type # Transistor THEN WriteLine["bad transistor"];
WriteString["t ("]; WriteLongDecimal[Lookup[trans.node]];
WriteString[") "]; WriteLongDecimal[Lookup[trans.poly]];
FOR p: Diffusion ← trans.diff,p.next UNTIL p = NIL DO
WriteString[" "]; WriteLongDecimal[Lookup[p.node]];
ENDLOOP;
ReleaseTransistor[trans];
WriteLine[""];
ENDLOOP;
WriteLine["---------------------------"];
END;
CallCombine: PROCEDURE =
BEGIN
n,n1,n2:NodeNumber;
i,j: INTEGER;
j ← PopInteger[];
i ← PopInteger[];
n1 ← LOOPHOLE[LONG[i]];
n2 ← LOOPHOLE[LONG[j]];
n ← Combine[n1,n2];
WriteLongDecimal[n];WriteLine[""];
END;
CallAttachNode: PROCEDURE =
BEGIN
n,n1,n2:NodeNumber;
i,j: INTEGER;
j ← PopInteger[];
i ← PopInteger[];
n1 ← LOOPHOLE[LONG[i]];
n2 ← LOOPHOLE[LONG[j]];
AttachNode[n1,n2];
n ← GetNode[n1];
WriteLongDecimal[n];WriteLine[""];
END;
CallGetNode: PROCEDURE =
BEGIN
n,n1:NodeNumber;
i: INTEGER;
i ← PopInteger[];
n1 ← LOOPHOLE[LONG[i]];
n ← GetNode[n1];
WriteLongDecimal[n];WriteLine[""];
END;
CallLookup: PROCEDURE =
BEGIN
n,n1:NodeNumber;
i: INTEGER;
i ← PopInteger[];
n1 ← LOOPHOLE[LONG[i]];
n ← Lookup[n1];
WriteLongDecimal[n];WriteLine[""];
END;
CallMerge: PROCEDURE =
BEGIN
n,n1,n2:NodeNumber;
i,j: INTEGER;
j ← PopInteger[];
i ← PopInteger[];
n1 ← LOOPHOLE[LONG[i]];
n2 ← LOOPHOLE[LONG[j]];
n ← Merge[n1,n2];
WriteLongDecimal[n];WriteLine[""];
END;
TestMerge: PROCEDURE =
BEGIN
i,j:NodeNumber;
FOR i ← 230,i-10 UNTIL i <= 0 DO
FOR j ← 1,j+2 UNTIL j > 9 DO
[] ← Merge[i+j,i+j+10];
[] ← Merge[256 - (i+j+1),256 - (i+j+11)];
ENDLOOP;
ENDLOOP;
FOR j IN [201..220] DO
WriteLongDecimal[j]; WriteString[" becomes "];
WriteLongDecimal[Lookup[j]]; WriteLine[""];
ENDLOOP;
END;
ToggleDebug: PUBLIC PROCEDURE =
BEGIN
WriteString["debugging mode is "];
IF debug THEN {
debug ← FALSE;
WriteLine["off"];
}
ELSE {
debug ← TRUE;
WriteLine["on"];
};
END;
Debug: PUBLIC PROCEDURE RETURNS[BOOLEAN] =
BEGIN
RETURN[debug];
END;
debug:BOOLEAN ← TRUE;
ExtInit: PUBLIC PROCEDURE =
BEGIN
-- dummy procedure
END;
ExtDebug: PUBLIC PROCEDURE =
BEGIN
WriteLine["loaded: combine, attach, get, lookup, merge, & testmerge"];
InitMerge[];
END;
Register["combine",CallCombine];
Register["attach",CallAttachNode];
Register["get",CallGetNode];
Register["lookup",CallLookup];
Register["merge",CallMerge];
Register["testmerge",TestMerge];
Register["debug",ToggleDebug];
END.