JasmineMonitorImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Created by Neil Gunther, July 17, 1986 2:34:22 pm PDT
Last Edited by: Neil Gunther July 24, 1986 3:16:36 pm PDT
DIRECTORY
CD USING [Object, Design, FetchTechnology, Position, Instance, InstanceList, RegisterTechnology, Technology],
CDOps USING [CreateDesign, IncludeObjectI, InstList],
CDOrient,
CDRemote USING [Get],
CDViewer USING [CreateViewer],
Jasmine,
JasmineMonitor,
Rope USING [Cat, ROPE],
SymTab USING [Fetch, Ref],
ViewerClasses USING [Viewer],
ViewerOps USING [DestroyViewer, FindViewer];
JasmineMonitorImpl: CEDAR PROGRAM
IMPORTS CD, CDOps, CDRemote, CDViewer, Jasmine, Rope, SymTab, ViewerOps
EXPORTS JasmineMonitor
= BEGIN
DisplayModel: PUBLIC PROC [model: SymTab.Ref, name: Rope.ROPENIL] RETURNS [viewer: ViewerClasses.Viewer] = {
PositionIcon: PROC [mapX, mapY: INT, icon: CD.Object, aspect: Jasmine.AspectType] = {
AssignSchematicCoords: PROC [mapX, mapY: INT] RETURNS [cdX, cdY: INT] = {
gridSize: INT ← 15*8;
scaleFactor: NAT;
SELECT Jasmine.resolution FROM
high => {scaleFactor ← 5};
medium => {};
low => {};
ENDCASE => NULL;
cdX ← mapX*gridSize/scaleFactor;
cdY ← mapY*gridSize/scaleFactor;
};
--Original = vertical in Jasmine library.
--Use rotation of 270 to abide by CDOrient algorithms.
loc: CD.Position;
--Fetch previous included object
instances: CD.InstanceList ← CDOps.InstList[design: design];
instance: CD.Instance;
IF instances=NIL THEN {
[loc.x, loc.y] ← AssignSchematicCoords[mapX, mapY];
}
ELSE {
instance ← instances.first;
loc ← instance.location;
SELECT instance.orientation FROM
CDOrient.original => {
[loc.x, loc.y] ← AssignSchematicCoords[mapX, mapY];
};
CDOrient.rotate270 => { --cross object coords
[loc.x, loc.y] ← AssignSchematicCoords[mapX, mapY];
};
ENDCASE => ERROR;
};
CDOps.IncludeObjectI[design: design, ob: icon, location: loc, orientation: IF aspect=vert THEN CDOrient.original ELSE CDOrient.rotate270];
}; --PositionIcon
BuildSchematic: PROC [library: Rope.ROPE] = {
icon: CD.Object;
thereIs: BOOL;
val: REF ANY;
aspect: Jasmine.AspectType;
FOR indices: LIST OF Jasmine.MacroLocation ← Jasmine.locations, indices.rest UNTIL indices=NIL DO
[thereIs, val] ← SymTab.Fetch[model, Jasmine.MapConvert[indices.first]];
IF thereIs THEN {
macro: Jasmine.JasmineMacro ← NARROW[val];
SELECT macro.macroType FROM
m1Wire, m2Wire, nDifWire, pDifWire, polyWire => {
icon ← CDRemote.Get[design, library, "Resistor.icon"];
};
nDifCont => {
icon ← CDRemote.Get[design, library, "nDiffCont.icon"];
SELECT macro.branch FROM
leftT, rightT, straight => {aspect ← horiz};
inverseT, T, L, reverseL, inverseL, inverseRevL => {
aspect ← vert;
};
fourWay=> {aspect ← vert};
ENDCASE => NULL;
};
pDifCont => {
icon ← CDRemote.Get[design, library, "nDiffCont.icon"];
SELECT macro.branch FROM
leftT, rightT, straight => {aspect ← horiz};
inverseT, T, L, reverseL, inverseL, inverseRevL => {
aspect ← vert;
};
fourWay=> {aspect ← vert};
ENDCASE => NULL;
};
polyCont => {
icon ← CDRemote.Get[design, library, "PolyCont.icon"];
SELECT macro.branch FROM
leftT, rightT, straight => {aspect ← horiz};
inverseT, T, L, reverseL, inverseL, inverseRevL => {
aspect ← vert;
};
fourWay=> {aspect ← vert;};
ENDCASE => NULL;
};
Via => {
icon ← CDRemote.Get[design, library, "Via.icon"];
SELECT macro.branch FROM
leftT, rightT, straight => {aspect ← horiz};
inverseT, T, L, reverseL, inverseL, inverseRevL => {
aspect ← vert;
};
fourWay=> {aspect ← vert};
ENDCASE => NULL;
};
nTran, nTranL, pTran, pTranL => {
aspect ← IF macro.xtorAspect=gateTied THEN horiz ELSE vert;
SELECT macro.xtorType FROM
nE => {
icon ← CDRemote.Get[design, library, "nETran.icon"];
};
pE => {
icon ← CDRemote.Get[design, library, "pETran.icon"];
};
ENDCASE => NULL;
};
ENDCASE => ERROR;
PositionIcon[indices.first.mapX, indices.first.mapY, icon, aspect];
};
ENDLOOP;
};
design: CD.Design;
prevMapX: INT ← 0; prevMapY: INT ← 0;
runningX: INT ← 0; runningY: INT ← 0;
jasmineTechnology: CD.Technology ← CD.FetchTechnology[key: $cmosB];
IF jasmineTechnology=NIL THEN jasmineTechnology ← CD.RegisterTechnology[key: $JasmineMonitorTech, name: "JasmineMonitor", lambda: 1];
design← CDOps.CreateDesign[technology: jasmineTechnology];
design.name ← IF name#NIL THEN name ELSE "Jasmine Model";
viewer ← CDViewer.CreateViewer[design];
BuildSchematic[library: "Jasmine.dale"];
DestroyCDPanel[Rope.Cat[design.name, " ", "CMosB", " ", "top level"]]; --krok!!!!
}; --DisplayModel
DestroyCDPanel: PROC [caption: Rope.ROPE] = {
This hack is necessary because CDViewer.CreateViewer (in CD23) does not have a boolean flag to inhibit the appearance of a CD control panel ... sigh!
The CD panel stuff resides in CDVMain.CreateViewer & CDPanelImpl.CreatePanel/Caption
ViewerOps.DestroyViewer[ViewerOps.FindViewer[caption]];
};
END.