PipalMos.mesa 
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Created by Bertrand Serlet March 6, 1988 1:20:51 pm PST
Bertrand Serlet May 9, 1988 11:58:04 pm PDT
DIRECTORY
Imager,
Pipal, PipalInt;
PipalMos: CEDAR DEFINITIONS = BEGIN
Theory
The Pipal data structures which will some day turn to silicon.
Layers
Layer: TYPE = ATOM;
errorLayer: Layer;
Compatibility with CD only.
commentLayer: Layer;
Layer used for schematics.
blueCommentLayer: Layer;
Layer used for schematics. Invisible for connectization.
RopeToLayer: PROC [rope: Pipal.ROPE] RETURNS [layer: Layer ← NIL];
LayerToRope: PROC [layer: Layer] RETURNS [rope: Pipal.ROPE];
RegisterLayerColor: PROC [layer: Layer, color: Imager.ConstantColor];
FetchLayerColor: PROC [layer: Layer] RETURNS [color: Imager.ConstantColor ← NIL];
IsDifLayer: PROC [layer: Layer] RETURNS [BOOL];
IsWellLayer: PROC [layer: Layer] RETURNS [BOOL];
IsSchematicLayer: PROC [layer: Layer] RETURNS [BOOL];
Box
Corresponds to the basic materials IC are made of (rectangles in CD).
boxClass: Pipal.Class;
Box: TYPE = REF BoxRec;
BoxRec: TYPE = RECORD [size: PipalInt.Size, layer: Layer];
CreateBox: PROC [size: PipalInt.Size, layer: Layer] RETURNS [box: Box];
It is not legal for a box to be reduced to a line or a point.
Star
Corresponds to CD instance Satellites.
starClass: Pipal.Class;
Star: TYPE = REF StarRec;
StarRec: TYPE = RECORD [
overlayStar: BOOL, -- allows distinguishing between instance satellites and object satellites
master: Pipal.Object,
satellites: SEQUENCE size: NAT OF Pipal.Object -- satellites can only be Text or transformations of Text
];
CreateStar: PROC [master: Pipal.Object, satellites: Pipal.Objects, overlayStar: BOOLFALSE] RETURNS [star: Star];
Check that satellites are Text or transformations of Text.
GetSatelliteText: PROC [satellite: Pipal.Object] RETURNS [text: Text ← NIL];
Returns the satellite itself if it's a text, or the child if it's a transformed text.
GetStarTexts: PROC [star: Star] RETURNS [LIST OF Text];
Discards any transformation of the satellites' texts.
GetNonItalicRopes: PROC [star: Star] RETURNS [LIST OF Pipal.ROPE];
Discards any transformation of the satellites' texts.
Routing
Corresponds to PW routing objects. Keeps connectivity.
routingClass: Pipal.Class;
Routing: TYPE = REF RoutingRec;
RoutingRec: TYPE = RECORD [nodes: SEQUENCE size: NAT OF Pipal.Object];
CreateRouting: PROC [nodes: Pipal.Objects] RETURNS [routing: Routing];
Tiling
A Tiling is two dimensional abuts. Having a special class allows fast extraction.
tilingClass: Pipal.Class;
Tiling: TYPE = REF TilingRec;
TilingRec: TYPE = RECORD [sizeX, sizeY: NAT, xyTile: XYTileProc, data: REFNIL];
XYTileProc: TYPE = PROC [x, y: NAT, data: REFNIL] RETURNS [Pipal.Object];
All tiles in a row should have same height and all tiles in a column should have same width.
CreateTiling: PROC [sizeX, sizeY: NAT, xyTile: XYTileProc, data: REFNIL] RETURNS [tiling: Tiling];
xyTile must be fast since it might be called often (e.g. when extracting).
sizeX and sizeY must be >0
EachTileProc: TYPE = PROC [x, y: NAT, tile: Pipal.Object, pos: PipalInt.Position] RETURNS [quit: BOOLFALSE];
pos is relative to the [0, 0] of the tiling.
EnumerateTiles: PROC [tiling: Tiling, each: EachTileProc] RETURNS [quit: BOOLFALSE];
Marker
Denotes an area, for something like a routing program. Corresponds to CD symbolic objects.
markerClass: Pipal.Class;
Marker: TYPE = REF MarkerRec;
MarkerRec: TYPE = RECORD [size: PipalInt.Size, layer: Layer];
CreateMarker: PROC [size: PipalInt.Size, layer: Layer] RETURNS [marker: Marker];
denotedSize can be reduced to a line or a point.
Schematic Icons
schematicIconClass: Pipal.Class;
SchematicIcon: TYPE = REF SchematicIconRec;
SchematicIconRec: TYPE = RECORD [
child: Pipal.Object,
expression: Pipal.ROPE, -- name of referee or expr to evaluate
code: BOOL,   -- indicate whether expr is code or the name of a cell
type: SchematicIconType
];
SchematicIconType: TYPE = {cell, wire, unnamedWire};
CreateSchematicIcon: PROC [child: Pipal.Object, expression: Pipal.ROPE, code: BOOL, type: SchematicIconType] RETURNS [icon: SchematicIcon];
Schematic Sequences
schematicSequenceClass: Pipal.Class;
SchematicSequence: TYPE = REF SchematicSequenceRec;
SchematicSequenceRec: TYPE = RECORD [
child: Pipal.Object,
repetition: Pipal.ROPE-- expression to evaluate indicating the repetition factor
];
CreateSchematicSequence: PROC [child: Pipal.Object, repetition: Pipal.ROPE] RETURNS [seq: SchematicSequence];
Text
textClass: Pipal.Class;
Text: TYPE = REF TextRec;
TextRec: TYPE = RECORD [contents: Pipal.ROPE, font: Imager.Font];
CreateText: PROC [contents: Pipal.ROPE, font: Imager.Font] RETURNS [text: Text];
GetTextFontName: PROC [text: Text] RETURNS [fontName: Pipal.ROPE];
IsItalic: PROC [fontName: Pipal.ROPE] RETURNS [BOOL];
Picture
pictureClass: Pipal.Class;
Picture: TYPE = REF PictureRec;
PictureRec: TYPE = RECORD [size: PipalInt.Size, imagerObject: Imager.Object];
CreatePicture: PROC [size: PipalInt.Size, imagerObject: Imager.Object] RETURNS [picture: Picture];
CreatePictureFromInterpress: PROC [size: PipalInt.Size, master: Pipal.ROPE] RETURNS [picture: Picture];
Creates a picture from an Interpress master, expressed as a ROPE.
Annotations
Indirect
Indirect annotations introduce one level of indirection, so that users can store properties both on indirect objects and their source, or so that there is a way to guarantee that 2 objects are different.
indirectProp: ATOM;
The annotation value is NIL
Atomic Objects
It is convenient to mark certain objects as "atomic". Such annotations are not editable.
Example of use: contacts without well.
atomicProp: ATOM;
The annotation value is the type ATOM.
BiAtomic Objects
It is convenient to mark certain objects as "bi-atomic". Such annotations are not editable.
Example of use: contacts containing well.
biAtomicProp: ATOM;
The annotation value is the type ATOM.
Transistors
It is convenient to mark certain atomic objects as "transistor". Such annotations are not editable.
transistorProp: ATOM;
The annotation value is the type ATOM.
Atomicity
Some programs (e.g. PipalCore) want to deal with complex entities as if they were "atomic". The obvious thing to do is to consider the presence of the enumerateMethod as the atomic predicate. Unfortunately some classes of objects (e.g. Star) that should be atomic but have an enumerateMethod. Therefore a new message is needed.
isAtomicMethod: Pipal.Method;
IsAtomicProc: TYPE = PROC [object: Pipal.Object] RETURNS [BOOL];
IsAtomic: IsAtomicProc;
Short cut for applying the isAtomicMethod method.
No isAtomicMethod => iff object has an Int enumerate method it is not atomic.
EnumerateAtomic: PipalInt.EnumerateProc;
Short cut for applying the Int enumerate method only on atomic objects.
If argument is atomic itself, each is called once with it.
clippedEnumerationClass: Pipal.Class;
New class for representing collections of atomic objects in a dense way.
ClippedEnumeration: TYPE = REF ClippedEnumerationRec;
ClippedEnumerationRec: TYPE = RECORD [
clipRect: PipalInt.Rectangle,
child: Pipal.Object
];
CreateClippedEnumeration: PROC [clipRect: PipalInt.Rectangle, child: Pipal.Object] RETURNS [clippedEnumeration: ClippedEnumeration];
Raw creation of a clippedEnumeration.
CreateClipEnum: PROC [clipRect: PipalInt.Rectangle, child: Pipal.Object] RETURNS [Pipal.Object];
This function usually creates a ClippedEnumeration, but may creates an overlay if more appropriate. The atomic objects of are enumerated. No atomic object => Pipal.void is returned.
Mask Layers and Touching
In order to generate masks, any Object should be projected into a bunch of rectangles.
EachRectangleLayerProc: TYPE = PROC [rect: PipalInt.Rectangle, layer: Layer, isMarker: BOOL] RETURNS [quit: BOOLFALSE];
EnumerateRectangleLayers: PROC [object: Pipal.Object, each: EachRectangleLayerProc, transformation: PipalInt.Transformation ← [], includeMarkers, includeSchematicLayer: BOOLTRUE] RETURNS [quit: BOOLFALSE];
If argument is a box or a marker itself, each is called once with it (if the flags apply).
ContainsWell: PROC [object: Pipal.Object] RETURNS [BOOL];
TouchProc: TYPE = PROC [touch: TouchProc, trans1: PipalInt.Transformation, object1: Pipal.Object, trans2: PipalInt.Transformation, object2: Pipal.Object] RETURNS [BOOLFALSE];
Returns TRUE if instance1 touches instance2.
A strong assumption made all over the code is that instances with non-overlapping bbox can not touch.
Function is passed itself for recursive calls with simpler instances.
Touch: TouchProc;
Generic one, only using EnumerateRectangleLayers.
LayoutTouch: TouchProc;
As Touch, but hacked for well and ovg rectangles.
SchematicTouch: TouchProc;
Funny touching for schematics. Only knows about boxes.
Transistors
Interface to Saguaro.
TransistorType: TYPE ~ {nE, pE};
extractTransistorMethod: Pipal.Method;
ExtractTransistorProc: TYPE = PROC [object: Pipal.Object] RETURNS [type: TransistorType, ch1, ch2, gate, bulk: Pipal.Object, width, length: INT];
Object must be an atomicObject annotation with value one of the transistor types.
ExtractTransistor: ExtractTransistorProc;
END.