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 14, 1985 11:03:09 am PDT
DIRECTORY
CD,
CDBasics,
CDBusCells,
CDCells,
CDDirectory,
CDIO,
CDRects,
CDX,
TokenIO;
CDBusCellsImpl: CEDAR PROGRAM
IMPORTS CD, CDBasics, CDCells, CDDirectory, CDIO, CDRects, CDX, TokenIO
EXPORTS CDBusCells =
BEGIN
--========================================================
--for compatibility only
ReadBus: CD.InternalReadProc --PROC [] RETURNS [ObPtr]-- =
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.ObjectProcs;
Init: PROC [] =
BEGIN
pForBusses ← CD.RegisterObjectType[$Bus];
pForBusses.internalRead ← ReadBus;
END;
--========================================================
CreateBusCell: PUBLIC PROC [design: CD.Design, sizeOfFirst: CD.DesignPosition, lev: CD.Layer, count: NAT, offset: CD.DesignPosition, lengIncrement: CD.DesignNumber𡤀] RETURNS [CD.ObPtr] =
BEGIN
sz: CD.DesignPosition ← sizeOfFirst;
pos: CD.DesignPosition ← [0, 0];
co: CD.ObPtr ← 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.ObPtr ← CDRects.CreateRect[sz, lev];
pos ← CDBasics.AddPoints[pos, offset];
sz.y ← sz.y+lengIncrement;
[] ← CDX.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.