LayoutSimulation.mesa
Copyright © 1984 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet August 30, 1985 11:41:04 am PDT
Bertrand Serlet June 8, 1986 11:14:51 pm PDT
Pradeep Sindhu December 2, 1985 6:42:39 pm PST
Barth, March 21, 1986 12:47:57 pm PST
DIRECTORY
CD, CDBasics, CDInstances, CDMenus, CDOps, CDOrient, CDProperties, CDSequencer,
Core, CoreClasses, CoreFlat, CoreOps, CoreProperties,
IO, Ports,
Rosemary, Sinix, SinixCMos,
TerminalIO;
LayoutSimulation: CEDAR PROGRAM
IMPORTS CDBasics, CDInstances, CDMenus, CDOps, CDOrient, CDProperties, CoreClasses, CoreFlat, CoreOps, CoreProperties, IO, Ports, Rosemary, Sinix, SinixCMos, TerminalIO =
BEGIN
ROPE: TYPE = Core.ROPE;
CellType: TYPE = Core.CellType;
Wire: TYPE = Core.Wire;
IsSingleSelected: PROC [selected: CD.Instance, multiple: BOOL] RETURNS [BOOL] = {
IF selected=NIL THEN {
TerminalIO.WriteRope["\n** No current selection--can't do it.\n"];
RETURN[FALSE];
};
IF multiple THEN {
TerminalIO.WriteRope["\n** Multiple instances selected--can't do it.\n"];
RETURN[FALSE];
};
RETURN[TRUE];
};
FindWireAtPos: PROC [ct: CellType, posInCell: CD.Position] RETURNS [wr: Wire ← NIL, path: CoreFlat.InstantiationPath ← NIL] = {
rc: CellType ← CoreOps.ToBasic[ct];
rcData: CoreClasses.RecordCellType ← NARROW [rc.data];
FindInInternal: CoreOps.EachWireProc = {
FOR geom: LIST OF CD.Instance ← Sinix.GetWireGeometryProp[SinixCMos.extractBMode, wire], geom.rest WHILE geom#NIL DO
IF CDInstances.PointToI[posInCell, geom.first] THEN {wr ← wire; quit ← TRUE}
ENDLOOP;
};
IF CoreOps.VisitWire[rcData.internal, FindInInternal] THEN RETURN;
FOR i: NAT IN [0 .. rcData.size) DO
inst: CD.Instance ← NARROW [CoreProperties.GetCellInstanceProp[rcData[i], SinixCMos.extractBMode.instanceProp]];
IF inst=NIL THEN ERROR;
IF CDInstances.PointToI[posInCell, inst] THEN {
subPos: CD.Position ← CDOrient.DeMapPoint[posInCell, inst.ob.size, inst.orientation, inst.location];
[wr, path] ← FindWireAtPos[rcData[i].type, subPos];
path ← CONS [rcData[i], path];
};
ENDLOOP;
};
SeeRoseValue: PROC [command: CDSequencer.Command] = {
simulation: Rosemary.Simulation ← NARROW [CDProperties.GetDesignProp[command.design, $Simulation]];
selected: CD.Instance;
multiple: BOOL;
pos: CD.Position ← command.pos;
ct: CellType;
wire: Wire;
path: CoreFlat.InstantiationPath;
wireSize: NAT;
wireCell: CellType;
[selected, multiple] ← CDOps.SelectedInstance[command.design];
IF ~IsSingleSelected[selected, multiple] THEN RETURN;
ct ← NARROW [Sinix.Extract[selected.ob, SinixCMos.extractBMode].result];
[wire, path] ← FindWireAtPos[ct, CDBasics.SubPoints[command.pos, selected.location]];
path ← CoreClasses.ReverseCellInstances[path];
IF path=NIL THEN wireCell ← ct
ELSE wireCell ← path.first.type;
wireSize ← CoreOps.WireBits[wire];
TerminalIO.WriteF[
"Value[%g] = %g\n",
IO.rope[CoreOps.GetFullWireName[NARROW [wireCell.data, CoreClasses.RecordCellType].internal, wire]],
IO.rope[Ports.LevelSequenceToRope[
Rosemary.WireValue[
simulation,
NEW [CoreFlat.FlatWireRec ← [CoreFlat.ComputePackedPath[simulation.coreCellType, path], wire]]
],
wireSize]]
];
};
CDMenus.ImplementEntryCommand[$OtherProgramMenu, "SeeRoseValue", SeeRoseValue];
END.