SXAccessImpl.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Written by Jacobi, April 2, 1985 5:11:35 pm PST
Written by Shand, September 12, 1983 11:40 pm
Last Edited by: Jacobi, January 29, 1986 7:56:09 pm PST
Last edited by: gbb March 26, 1986 2:53:33 pm PST
DIRECTORY
BasicTime USING [GMT, Now, Period],
CD USING [Design, Instance, InstanceList, Layer, Position, Technology],
CDCommandOps USING [CallWithResource],
CDInstances USING [OnlySelected],
CDLayers USING [CurrentLayer],
CDMenus USING [CreateEntry],
CDOps USING [InstList, LayerName, ObjectInfo],
CDOrient USING [MapPoint],
CDProperties USING [GetTechnologyProp],
CDSequencer USING [Command, CommandRec, ImplementCommand],
IO USING [EndOfStream, Error, GetInt, int, PutFR1, RIS, STREAM],
PrincOpsUtils USING [],
Process USING [priorityBackground, SetPriority],
Rope USING [Cat, ROPE],
SX USING [TechHandle],
SXAccess USING [],
SXAccessInternal USING [Analyze],
SXAtoms USING [analyzeAndRoseSelected, analyzeAndThymeSelected, analyzeSelected, highlightKeyboardCoordsNode, highlightPointedNode, rosePrint, spinifex, thymePrint],
SXHighlightNode USING [HighlightNode],
TerminalIO USING [RequestRope, WriteRope];
SXAccessImpl: CEDAR PROGRAM
IMPORTS BasicTime, CDCommandOps, CDInstances, CDLayers, CDMenus, CDOps, CDOrient, CDProperties, CDSequencer, IO, Process, Rope, SXAccessInternal, SXAtoms, SXHighlightNode, TerminalIO
EXPORTS SXAccess = BEGIN
timing: BOOLFALSE;
Exported stuff
Variables only valid inside an analysis invocation
design: PUBLIC CD.Design ← NIL;
formatKey: PUBLIC REF NIL;
invocation: PUBLIC REF NIL;
stopFlag: PUBLIC REF BOOL NIL;
sxTech: PUBLIC REF SX.TechHandle NIL;
CallingRec: TYPE = RECORD [
design: CD.Design,
hierarchyRoots: CD.InstanceList,
formatKey: REF,
stopFlag: REF BOOL];
Analyze: PUBLIC PROC [design: CD.Design, hierarchyRoots: CD.InstanceList, formatKey: REF, stopFlag: REF BOOLNIL] RETURNS [skipped: BOOLFALSE] = BEGIN
If stopFlag^ gets true, analysis might be aborted
ik: REF CallingRec;
comm: CDSequencer.Command;
IF (stopFlag = NIL) THEN stopFlag ← NEW [BOOLFALSE];
ik ← NEW [CallingRec ← [design: design,
hierarchyRoots: hierarchyRoots,
formatKey: formatKey,
stopFlag: stopFlag]];
comm ← NEW [CDSequencer.CommandRec ← [key: $SX, design: design, ref: ik]];
skipped ← CDCommandOps.CallWithResource [PseudoCommand, comm, $SX, stopFlag];
IF skipped THEN TerminalIO.WriteRope ["** analysis skipped\n"]
END; -- Analyze
PseudoCommand: PROC [comm: CDSequencer.Command] = BEGIN
GetSXTech: PROC [technology: CD.Technology] RETURNS [th: REF SX.TechHandle] = BEGIN
WITH CDProperties.GetTechnologyProp [technology, SXAtoms.spinifex] SELECT FROM
x: REF SX.TechHandle => th ← x;
ENDCASE => th ← NIL;
IF th = NIL THEN TerminalIO.WriteRope ["Technology not implemented for Spinifex\n"]
END;
callParameters: REF CallingRec = NARROW [comm.ref];
design ← callParameters.design;
formatKey ← callParameters.formatKey;
invocation ← NEW [INT];
stopFlag ← callParameters.stopFlag;
stopFlag^ ← FALSE;
sxTech ← GetSXTech [design.technology];
IF (sxTech # NIL) THEN ProtectedAnalyze [callParameters.hierarchyRoots];
design ← NIL; invocation ← NIL; formatKey ← NIL; sxTech ← NIL
END; -- PseudoCommand
ProtectedAnalyze: PROC [hierarchyRoots: CD.InstanceList] = BEGIN
SXAccessInternal.Analyze[hierarchyRoots]
END;
Interactive Command
AnalyzeComm: PROCEDURE [comm: CDSequencer.Command] = BEGIN
stopFlag: REF BOOLNEW [BOOLFALSE];
ProtectedAnalyzeComm: PROCEDURE [comm: CDSequencer.Command] = BEGIN
startTime, stopTime: BasicTime.GMT; -- for internal use
selected: CD.InstanceList ← CDInstances.OnlySelected [CDOps.InstList[comm.design]];
IF selected=NIL THEN TerminalIO.WriteRope [ "No selection.\n"]
ELSE {
skipped: BOOL;
format: REF ANY;
SELECT comm.key FROM
SXAtoms.analyzeAndThymeSelected => {
TerminalIO.WriteRope ["Analysis and Thyme format extraction of\n"];
format ← SXAtoms.thymePrint;
};
SXAtoms.analyzeAndRoseSelected => {
TerminalIO.WriteRope ["Analysis and Rosemary format extraction of\n"];
format ← SXAtoms.rosePrint;
};
ENDCASE => {
TerminalIO.WriteRope ["Analysis of\n"];
format ← NIL;
};
FOR list: CD.InstanceList ← selected, list.rest WHILE list#NIL DO
TerminalIO.WriteRope [Rope.Cat[" ", CDOps.ObjectInfo[list.first.ob], "\n"]];
ENDLOOP;
TRUSTED {Process.SetPriority [Process.priorityBackground]};
startTime ← BasicTime.Now [];
skipped ← Analyze [design: comm.design, hierarchyRoots: selected, formatKey: format, stopFlag: stopFlag];
stopTime ← BasicTime.Now [];
IF skipped THEN TerminalIO.WriteRope ["Analysis skipped.\n"]
ELSE TerminalIO.WriteRope ["Analysis complete.\n"];
IF timing THEN TerminalIO.WriteRope [Rope.Cat ["Total elapsed time: ", TimeToRope [startTime, stopTime], "\n"]]
}
END; -- ProtectedAnalyzeComm
TerminalIO.WriteRope ["Spinifex.\n"];
[] ← CDCommandOps.CallWithResource [ProtectedAnalyzeComm, comm, $Spinifex, stopFlag]
END; -- AnalyzeComm
TimeToRope: PROC [from, to: BasicTime.GMT] RETURNS [time: Rope.ROPE] ~ BEGIN
Although the INT returned BasicTime.Period is the same as GMT and might hence be loopholed to use IO.time from Conversions, the latter uses BasicTime.Unpack which allows only values that give a valid date.
tmp: Rope.ROPE;
sec: INT = BasicTime.Period [from, to];
min: INT = sec / 60;
h: INT = min / 60;
tmp ← IO.PutFR1 [value: IO.int [h]];
time ← SELECT h FROM
= 0 => "00",
< 10 => Rope.Cat ["0", tmp],
ENDCASE => tmp;
tmp ← IO.PutFR1 [value: IO.int [min MOD 60]];
time ← Rope.Cat [time, ":", SELECT min FROM
= 0 => "00",
< 10 => Rope.Cat ["0", tmp],
ENDCASE => tmp];
tmp ← IO.PutFR1 [value: IO.int [sec MOD 60]];
time ← Rope.Cat [time, ":", SELECT sec FROM
= 0 => "00",
< 10 => Rope.Cat ["0", tmp],
ENDCASE => tmp]
END; -- TimeToRope
HighLightNode: PROCEDURE [comm: CDSequencer.Command] = BEGIN
layer: CD.Layer = CDLayers.CurrentLayer [comm.design];
layerName: Rope.ROPE = CDOps.LayerName [layer];
TerminalIO.WriteRope [Rope.Cat ["Highlight Node (", layerName, ", pointed)\n"]];
TRUSTED {Process.SetPriority[Process.priorityBackground]};
SXHighlightNode.HighlightNode [comm.design, comm.pos, layer]
END;
HighLightNodeFromKeyboard: PROCEDURE [comm: CDSequencer.Command] = BEGIN
ENABLE {
IO.Error => {
TerminalIO.WriteRope [" Invalid Coords (Format is: x y )\n"];
ERROR ABORTED
};
IO.EndOfStream => {
TerminalIO.WriteRope [" Invalid Coords (Format is: x y )\n"];
ERROR ABORTED
};
};
coords: CD.Position ← [0,0];
layer: CD.Layer = CDLayers.CurrentLayer [comm.design];
layerName: Rope.ROPE = CDOps.LayerName [layer];
prompt: Rope.ROPE = Rope.Cat ["Highlight node on layer ", layerName, " as selected on control panel.\n Enter coords of node relative to currently pushed cell > "];
inLine: IO.STREAM ~ IO.RIS [TerminalIO.RequestRope [prompt]];
coords.x ← IO.GetInt[inLine] * comm.design.technology.lambda;
coords.y ← IO.GetInt[inLine] * comm.design.technology.lambda;
TRUSTED {Process.SetPriority [Process.priorityBackground]};
Transform coords from those of currently pushed appliaction to those of screen.
BEGIN
a: CD.Instance ~ comm.design.actual.first.mightReplace;
IF (a # NIL) THEN coords ← CDOrient.MapPoint [coords, a.ob.size, a.orientation, a.location]
END;
SXHighlightNode.HighlightNode [comm.design, coords, layer]
END; -- HighLightNodeFromKeyboard
SpinifexCommands
CDSequencer.ImplementCommand [key: SXAtoms.analyzeSelected, proc: AnalyzeComm, queue: doQueue];
CDSequencer.ImplementCommand [key: SXAtoms.analyzeAndThymeSelected, proc: AnalyzeComm, queue: doQueue];
CDSequencer.ImplementCommand [key: SXAtoms.analyzeAndRoseSelected, proc: AnalyzeComm, queue: doQueue];
CDSequencer.ImplementCommand [key: SXAtoms.highlightPointedNode, proc: HighLightNode, queue: doQueue];
CDSequencer.ImplementCommand [key: SXAtoms.highlightKeyboardCoordsNode, proc: HighLightNodeFromKeyboard, queue: doQueue];
CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Extract & DRC (Spinifex)", key: SXAtoms.analyzeSelected];
CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Spinifex for Thyme", key: SXAtoms.analyzeAndThymeSelected];
CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Spinifex for Rosemary", key: SXAtoms.analyzeAndRoseSelected];
CDMenus.CreateEntry [menu: $RectProgramMenu, entry: "Highlight Node (Spinifex)", key: SXAtoms.highlightPointedNode];
CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Highlight Node at Coords (Spinifex)", key: SXAtoms.highlightKeyboardCoordsNode];
TerminalIO.WriteRope ["Spinifex layout analysis package loaded.\n"]
END.
Edited on October 22, 1984 11:57:12 am PDT, by gbb
Implementation of dynamic menu entries (new feature of Chipndale).
changes to: DIRECTORY: added CDMenus,
IMPORTS
: added CDMenus,
CDSequencer
: parameters specified using keyword notation,
CDMenus
: new, create a dynamic menu entry.
CDMenus: "Hilight pointed node" now in RectProgramMenu
Edited on December 6, 1984 3:14:29 pm PST, by Jacobi
changed the formatting, simplified, use of CDInstances.OnlySelected,
Edited on December 18, 1984 6:22:50 pm PST, by Jacobi
AnaysisAccess changed
Edited on January 30, 1985 7:49:17 pm PST, by Jacobi
Clear of SpinifexProperties removed and put in proper module
Edited on March 11, 1985 2:51:32 am PST, by Shand
New Command HighLightNodeFromKeyboard
changes to: DIRECTORY, HighLightNodeFromKeyboard, AnalyzeComm, HighLightNodeFromKeyboard, HighLightNodeFromKeyboard
gbb July 31, 1985 6:53:46 pm PDT
Added command for Core output.
changes to: DIRECTORY, AnalyzeComm, CDSequencer, CDMenus
gbb November 5, 1985 5:41:29 pm PST
Converted to ChipNDale 2.2
gbb November 24, 1985 4:08:16 pm PST
Removed command for Core output.
gbb February 13, 1986 5:26:08 pm PST
Merged in SXCommands.
changes to: DIRECTORY, SXAccessImpl, design, formatKey, invocation, stopFlag, sxTech, CallingRec, Analyze, PseudoCommand, GetSXTech (local of PseudoCommand), ProtectedAnalyze, AnalyzeComm, ProtectedAnalyzeComm (local of AnalyzeComm), HighLightNode, HighLightNodeFromKeyboard, CDSequencer, CDSequencer, CDSequencer, CDSequencer, CDSequencer, CDMenus, CDMenus, CDMenus, CDMenus, CDMenus, TerminalIO, END
gbb March 14, 1986 11:40:47 am PST
Improved user interface.
changes to: DIRECTORY, SXAccessImpl, HighLightNode, HighLightNodeFromKeyboard
gbb March 16, 1986 3:42:55 pm PST
Fixed a synchronisation problem in getting the current layer.
changes to: DIRECTORY, SXAccessImpl, HighLightNode, HighLightNodeFromKeyboard
gbb March 25, 1986 10:33:18 am PST
Changed labels of menu entries.