CDBusCellsImpl.mesa (part of ChipNDale)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, June 24, 1983 4:58 pm
last edited Christian Jacobi, May 22, 1985 3:05:53 pm PDT
DIRECTORY
CD,
CDBasics,
CDBusCells,
CDCells,
CDDirectory,
CDIO,
CDRects,
TokenIO;
CDBusCellsImpl:
CEDAR
PROGRAM
IMPORTS CD, CDBasics, CDCells, CDDirectory, CDIO, CDRects, TokenIO
EXPORTS CDBusCells =
BEGIN
--========================================================
--for compatibility only
ReadBus:
CD.InternalReadProc
--PROC [] RETURNS [Object]-- =
BEGIN
sizeOfFirstX: INT = TokenIO.ReadInt[];
sizeOfFirstY: INT = TokenIO.ReadInt[];
lev: CD.Layer = CDIO.ReadLayer[];
count: INT = TokenIO.ReadInt[];
offsetX: INT = TokenIO.ReadInt[];
offsetY: INT = TokenIO.ReadInt[];
lengIncrement: INT = TokenIO.ReadInt[];
RETURN [ CreateBusCell[
design: CDIO.DesignInReadOperation[],
sizeOfFirst: [sizeOfFirstX, sizeOfFirstY],
lev: lev,
count: count,
offset: [offsetX, offsetY],
lengIncrement: lengIncrement
]];
END;
pForBusses: REF CD.ObjectClass;
Init:
PROC [] =
BEGIN
pForBusses ← CD.RegisterObjectClass[$Bus];
pForBusses.internalRead ← ReadBus;
END;
--========================================================
CreateBusCell:
PUBLIC
PROC [design:
CD.Design, sizeOfFirst:
CD.Position, lev:
CD.Layer, count:
NAT, offset:
CD.Position, lengIncrement:
CD.Number𡤀]
RETURNS [
CD.Object] =
BEGIN
sz: CD.Position ← sizeOfFirst;
pos: CD.Position ← [0, 0];
co: CD.Object ← CDCells.CreateEmptyCell[];
count ← MAX[count, 1];
IF sz.x<=0 THEN sz.x←CD.lambda;
IF sz.y<=0 THEN sz.y←CD.lambda;
IF sz.y+(count-1)*lengIncrement<0 THEN lengIncrement𡤀
IF offset.x<0 THEN {pos.x ← -offset.x*(count-1)};
IF offset.y<0 THEN {pos.y ← -offset.y*(count-1)};
FOR i:
NAT
IN [1..count]
DO
rec: CD.Object ← CDRects.CreateRect[sz, lev];
pos ← CDBasics.AddPoints[pos, offset];
sz.y ← sz.y+lengIncrement;
[] ← CDCells.IncludeOb[design:
NIL,
cell: co,
ob: rec,
position: pos,
cellCSystem: originCoords,
obCSystem: interrestCoords,
mode: dontPropagate
];
ENDLOOP;
[] ← CDCells.RepositionCell[co, NIL];
IF design#NIL THEN [] ← CDDirectory.Include[design, co, "-bus-"];
RETURN [co];
END;
Init[];
END.