ExtendCellsImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet, February 11, 1987 5:53:16 pm PST
Bertrand Serlet March 15, 1987 11:11:45 pm PST
DIRECTORY CD, CDInstances, CDRects, Core, CoreClasses, CoreGeometry, CoreOps, ExtendCells, PWObjects;
ExtendCellsImpl: CEDAR PROGRAM
IMPORTS CD, CDInstances, CDRects, CoreClasses, CoreGeometry, CoreOps, PWObjects
EXPORTS ExtendCells
~ BEGIN OPEN ExtendCells;
Types and Defaults
ExtendSegment: PUBLIC ExtendSegmentProc = {
IF extension=0 THEN RETURN;
RETURN [CDRects.CreateRect[
IF side=top OR side=bottom THEN [max-min, extension] ELSE [extension, max-min],
layer]];
};
Extentions returning Objects
ExtendObject: PUBLIC PROC [wirePins: LIST OF WirePin, size: CD.Position, side: Side, extendProc: ExtendSegmentProc ← ExtendSegment] RETURNS [extendedCell: Object] = {
instances: CD.InstanceList ← NIL;
extension: INTIF side=top OR side=bottom THEN size.y ELSE size.x;
WHILE wirePins#NIL DO
wirePin: WirePin = wirePins.first;
object: Object ← extendProc[wirePin.wire, wirePin.min, wirePin.max, wirePin.layer, side, extension];
IF object#NIL THEN instances ← CONS [
CDInstances.NewInst[
ob: object,
trans: [IF side=top OR side=bottom THEN [wirePin.min, 0] ELSE [0, wirePin.min]]
],
instances];
wirePins ← wirePins.rest;
ENDLOOP;
extendedCell ← PWObjects.CreateCell[instances: instances, ir: [0, 0, size.x, size.y], name: "ExtendObject"];
};
Extentions returning CellTypes
ExtendCellType: PUBLIC PROC [decoration: Decoration, cellType: CellType, extensions: Extensions ← nullExtensions, extendProc: ExtendSegmentProc ← ExtendSegment, name: ROPENIL, props: Properties ← NIL] RETURNS [extendedCell: CellType] = {
cdInstances: CD.InstanceList ← NIL;
instance: CoreClasses.CellInstance ← NIL;
public: Wire ← CoreOps.CopyWire[cellType.public];
subObject: Object = CoreGeometry.GetObject[decoration, cellType];
isize: CD.Position = CD.InterestSize[subObject];
ir: CD.Rect = [-extensions[left], -extensions[bottom], isize.x+extensions[right], isize.y+extensions[top]];
EachBinding: CoreOps.EachWirePairProc = {
EachPin: CoreGeometry.EachPinProc = {
object: Object;
extension: INT = extensions[side];
IF extension=0 THEN RETURN;
object ← extendProc[publicWire, min, max, layer, side, extension];
IF object#NIL THEN {
trans: CD.Transformation = [SELECT side FROM
top => [min, isize.y],
bottom => [min, -extension],
right => [isize.x, min],
left => [-extension, min],
ENDCASE => ERROR];
cdInstances ← CONS [CDInstances.NewInst[ob: object, trans: trans], cdInstances];
CoreGeometry.AddGeometry[decoration, actualWire, LIST [[object, trans]]];
CoreGeometry.AddPins[decoration, actualWire, LIST [[object, trans]]];
};
};
CoreGeometry.PutTransWireIRLazyPins[decoration, actualWire, publicWire, [], ir];
[] ← CoreGeometry.EnumerateSides[decoration, cellType, publicWire, EachPin];
};
[] ← CoreOps.VisitBindingSeq[public, cellType.public, EachBinding];
cdInstances ← CONS [CDInstances.NewInst[ob: subObject, trans: []], cdInstances];
instance ← CoreClasses.CreateInstance[public, cellType];
CoreGeometry.PutTrans[decoration, instance, []];
extendedCell ← CoreClasses.CreateRecordCell[public, public, LIST [instance], name, props];
CoreGeometry.PutObject[decoration, extendedCell, PWObjects.CreateCell[instances: cdInstances, ir: ir, name: name]];
};
END.