--File: IPMVBasicOpsImpl.mesa
Last Edited by: CSChow, February 2, 1985 3:34:49 am PST
DIRECTORY
TerminalIO,
Rope,
Convert,
Menus,
IPChWidthEst,
IPCoTab,
IPNetTab,
IPPortTab,
IPTop,
IPToolBox USING [ConstructFileName],
IPMVBasicOps;
IPMVBasicOpsImpl: CEDAR PROGRAM
IMPORTS TerminalIO, Rope, Convert, IPChWidthEst, IPCoTab, IPTop, IPNetTab, IPPortTab, IPToolBox
EXPORTS IPMVBasicOps =
BEGIN OPEN TIO: TerminalIO, 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 => {TIO.WriteRope["Geometrizing..."]; reGeom ← TRUE};
$CheckPoint => {file: Rope.ROPETIO.RequestRope["Enter File Name for CheckPoint: "];
TIO.WriteRope["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 TIO.WriteRope[Rope.Cat[IPCoTab.GetName[co], "\n\t"]];
yellow => TIO.WriteRope[Rope.Cat[IPCoTab.GetName[co], "\n\t"]];
blue => IF IPCoTab.CoActive[co] THEN TIO.WriteRope[Rope.Cat[IPCoTab.GetName[co], "\n\t"]];
ENDCASE => ERROR}; --allCompProc
eachNetAction: IPNetTab.EachNetAction ={
printNet: PROC[net: IPNetTab.Net] ={
TIO.WriteRope[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],")"];
TIO.WriteRope[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);
TIO.WriteRope[howListed];
top.coTab.AllComponents[allCompProc]};
IF shift THEN {
--Print Nets
SELECT mouse FROM
red => TIO.WriteRope["List of Active (Net Length) Pairs:\n\t"];
yellow => TIO.WriteRope["List of All (Net Length) Pairs:\n\t"];
blue => TIO.WriteRope["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 => TIO.WriteRope["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;
TIO.WriteRope["\n\tTotalNetLength = "];
TIO.WriteInt[IPNetTab.TotalNetLength[top.nets]];
RETURN;
}; -- used for interactive debugging
TIO.WriteRope["\nEstimating Channel Width.."];
[totalNetLength, totalActivePins, totalNonActivePins, xDim, yDim] ← IPChWidthEst.EstimateAndAssignChWidth[top];
TIO.WriteRope["\n\tTotalNetLength = "]; TIO.WriteInt[totalNetLength];
TIO.WriteRope["\n\tTotalActivePins = "]; TIO.WriteInt[totalActivePins];
TIO.WriteRope["\n\tTotalNonActivePins = "]; TIO.WriteInt[totalNonActivePins];
TIO.WriteRope["\n\tXDim = "]; TIO.WriteInt[xDim];
TIO.WriteRope["\n\tYDim = "]; TIO.WriteInt[yDim];
TIO.WriteRope["\n"];
reGeom ← TRUE};
$ChkSlf => {
TIO.WriteRope["Checking Self..."];
IPTop.CheckSelf[top];
refreshFlag ← FALSE};
ENDCASE => ERROR;
};
END.