--File: IPMVBasicOpsImpl.mesa
Last Edited by: CSChow, February 2, 1985 3:34:49 am PST
DIRECTORY
Convert,
Menus,
IO,
IPChWidthEst,
IPCoTab,
IPNetTab,
IPPortTab,
IPTop,
IPToolBox USING [ConstructFileName],
IPMVBasicOps,
Rope,
TerminalIO,
ViewerClasses;
IPMVBasicOpsImpl: CEDAR PROGRAM
IMPORTS Convert, IO, IPChWidthEst, IPCoTab, IPTop, IPNetTab, IPPortTab, IPToolBox, Rope, TerminalIO
EXPORTS IPMVBasicOps =
BEGIN OPEN IPMVBasicOps;
MenuHit: PUBLIC PROC [top: IPTop.Ref, defaultDir: Rope.ROPE, command: ATOM, mouse: Menus.MouseButton, shift, control: BOOL] RETURNS [reGeom: BOOLFALSE, refreshFlag: BOOLTRUE] ={
SELECT command FROM
$Geom => {TerminalIO.PutRope["Geometrizing..."]; reGeom ← TRUE};
$CheckPoint => {file: Rope.ROPE ← TerminalIO.RequestRope["Enter File Name for CheckPoint: "];
TerminalIO.PutRope["Creating CheckPoint..."];
IPTop.DescribeSelf[top, IPToolBox.ConstructFileName[defaultDir, file, "chp"]];
refreshFlag ← FALSE};
$List => {
allCompProc: IPCoTab.EachComponentAction ={
SELECT mouse FROM
red => IF ~ IPCoTab.CoActive[co] THEN TerminalIO.PutRope[Rope.Cat[IPCoTab.GetName[co], "\n\t"]];
yellow => TerminalIO.PutRope[Rope.Cat[IPCoTab.GetName[co], "\n\t"]];
blue => IF IPCoTab.CoActive[co] THEN TerminalIO.PutRope[Rope.Cat[IPCoTab.GetName[co], "\n\t"]];
ENDCASE => ERROR}; --allCompProc
eachNetAction: IPNetTab.EachNetAction ={
printNet: PROC[net: IPNetTab.Net] ={
TerminalIO.PutRope[Rope.Cat["(", net.name, " ", Convert.RopeFromInt[IPNetTab.NetLength[net]], ")\n\t"]]
}; --printNet
SELECT mouse FROM
red => IF IPNetTab.NetActive[net] THEN printNet[net];
yellow => printNet[net];
blue => IF ~ IPNetTab.NetActive[net] THEN printNet[net];
ENDCASE => ERROR;
}; -- eachNetAction
eachPortAction: IPPortTab.EachPortAction ={
pCoord: Rope.ROPE;
IF port.position = NIL
THEN pCoord ← "()"
ELSE pCoord ← Rope.Cat["(",
Convert.RopeFromInt[port.position.x],
Convert.RopeFromInt[port.position.y],")"];
TerminalIO.PutRope[Rope.Cat[port.name, "\t", pCoord, "\n\t"]];
}; --eachPortAction
IF ~shift AND ~ control THEN {
--Print Components
howListed: Rope.ROPE ← (SELECT mouse FROM
red => "List of Non-Active Components:\n\t",
yellow => "List of All Components:\n\t",
blue => "List of Active Components:\n\t",
ENDCASE => ERROR);
TerminalIO.PutRope[howListed];
top.coTab.AllComponents[allCompProc]};
IF shift THEN {
--Print Nets
SELECT mouse FROM
red => TerminalIO.PutRope["List of Active (Net Length) Pairs:\n\t"];
yellow => TerminalIO.PutRope["List of All (Net Length) Pairs:\n\t"];
blue => TerminalIO.PutRope["List of Non-Active (Net Length) Pairs:\n\t"];
ENDCASE => ERROR;
IPNetTab.Nets[top.nets, eachNetAction];};
IF control THEN {
--Print Ports
SELECT mouse FROM
--May differentiate later when needed
red, yellow, blue => TerminalIO.PutRope["List of All Ports:\n\t"];
ENDCASE => ERROR;
IPPortTab.Ports[top.ports, eachPortAction];
};
refreshFlag ← FALSE};
$EstChs => {
totalNetLength, totalActivePins, totalNonActivePins, xDim, yDim: INT;
IF control AND shift THEN {
IF IPTop.NoTopology[top] THEN RETURN;
TerminalIO.PutRope["\n\tTotalNetLength = "];
TerminalIO.PutF1["%g", IO.int[IPNetTab.TotalNetLength[top.nets]]];
RETURN;
}; -- used for interactive debugging
TerminalIO.PutRope["\nEstimating Channel Width.."];
[totalNetLength, totalActivePins, totalNonActivePins, xDim, yDim] ← IPChWidthEst.EstimateAndAssignChWidth[top];
TerminalIO.PutRope["\n\tTotalNetLength = "]; TerminalIO.PutF1["%g", IO.int[totalNetLength]];
TerminalIO.PutRope["\n\tTotalActivePins = "]; TerminalIO.PutF1["%g", IO.int[totalActivePins]];
TerminalIO.PutRope["\n\tTotalNonActivePins = "]; TerminalIO.PutF1["%g", IO.int[totalNonActivePins]];
TerminalIO.PutRope["\n\tXDim = "]; TerminalIO.PutF1["%g", IO.int[xDim]];
TerminalIO.PutRope["\n\tYDim = "]; TerminalIO.PutF1["%g", IO.int[yDim]];
TerminalIO.PutRope["\n"];
reGeom ← TRUE};
$ChkSlf => {
TerminalIO.PutRope["Checking Self..."];
IPTop.CheckSelf[top];
refreshFlag ← FALSE};
ENDCASE => ERROR;
};
END.