Types and signals
ROPE: TYPE = Rope.ROPE;
ROPES: TYPE = LIST OF ROPE;
-- The new hot types, identical to CD types
Object: TYPE = CD.Object; -- an object, i.e. a definition
Objects: TYPE = LIST OF Object;
Instance: TYPE = CD.Instance; -- an instance
InstanceList: TYPE = CD.InstanceList;
Design: TYPE = CD.Design;
UserProc:
TYPE = CDGenerate.GeneratorProc;
What the user registers with PW
AbutProblem:
SIGNAL [what:
ROPE, isX:
BOOL, ob1, ob2: Object];
This signal might be raised by an incorrect abut
Safe subset
Reverse:
PUBLIC
PROC [objects: Objects]
RETURNS [result: Objects ←
NIL];
Objects manipulations
-- The use of this subset is safe in the following sense: if a novice user (i.e. not Christian Jacobi or Don Curry) creates interactively cells with ChipNDale, and assembles them using only Abuts, MapFunction, and the like, then the resulting design is not going to give him any trouble: it should display, plot and turn into CIF with no complication.
-- Abuts: the following procs create an Abut, which is not a cell, but a new class of CD object.
-- All these proc can raise the signal AbutProblem
-- The simple abutment uses the interestrect; it stops and complains if size mismatch; NIL is the neutral element. AbutX builds from left to right, and AbutY from bottom to top.
AbutX: PROC [t1, t2, t3, t4, t5, t6: Object ← NIL] RETURNS [obj: Object];
AbutY: PROC [t1, t2, t3, t4, t5, t6: Object ← NIL] RETURNS [obj: Object];
AbutListX: PROC [listOb: Objects] RETURNS [obj: Object];
AbutListY: PROC [listOb: Objects] RETURNS [obj: Object];
-- Arrays and other repetitions
-- MapFunction evaluates the function over the domain [lx..ux)*[ly..uy) and abuts the resulting tiles in an array. Creates empty cell when lx>=ux or ly>=uy.
XYFunction: TYPE = PROC [x, y: INT] RETURNS [resultingOb: Object];
MapFunctionX: PROC [function: XYFunction, lx: INT ← 0, ux: INT] RETURNS [new: Object];
MapFunctionY: PROC [function: XYFunction, ly: INT ← 0, uy: INT] RETURNS [new: Object];
MapFunction:
PROC [function: XYFunction, lx:
INT ← 0, ux:
INT, ly:
INT ← 0, uy:
INT]
RETURNS [new: Object];
-- Aligns nx tiles in the X (--) direction. If nx<=0 an empty cell is created
ArrayX: PROC [ob: Object, nx: INT ← 1] RETURNS [Object];
-- Aligns ny tiles in the Y (|) direction. If nx<=0 an empty cell is created
ArrayY: PROC [ob: Object, ny: INT ← 1] RETURNS [Object];
-- Equivalent to ArrayY[ArrayX[ob, nx], ny]: no flat 2D array
Array: PROC [ob: Object, nx, ny: INT ← 1] RETURNS [new: Object];
-- Planar tranformations and instance names: these properties are usually associated to instances, not objects, so we have to add an extra level of hierarchy
ChangeOrientation: PUBLIC PROC [obj: Object, orientation: CD.Orientation] RETURNS [cell: Object];
-- Symmetry that changes X (so/Y)
FlipX:
PROC [ob: Object]
RETURNS [Object] =
INLINE {RETURN [ChangeOrientation[ob, mirrorX]]};
Symmetry that changes Y (so/X)
FlipY:
PROC [ob: Object]
RETURNS [Object] =
INLINE {RETURN [ChangeOrientation[ob, rotate180X]]};
Logically same as copy
Identity:
PROC [ob: Object]
RETURNS [Object] =
INLINE {RETURN [ob]};
Counter-clockwise
Rot90:
PROC [ob: Object]
RETURNS [Object] =
INLINE {RETURN [ChangeOrientation[ob, rotate90]]};
Rot180:
PROC [ob: Object]
RETURNS [Object] =
INLINE {RETURN [ChangeOrientation[ob, rotate180]]};
Rot270:
PROC [ob: Object]
RETURNS [Object] =
INLINE {RETURN [ChangeOrientation[ob, rotate270]]};
Flatten:
PROC [cell: Object]
RETURNS [new: Object];
Flattens the content of a cell.
Works all the way (not just the top level), and even on Abuts.
Does not flatten cell marked with a non-nil $DontFlatten property.
Get:
PROC [design: Design, name:
ROPE]
RETURNS [ob: Object];
Get creates a Indirect object that is a low-weight import. Provokes an ERROR if no such name in the directory.
OpenDesign:
PROC [fileName:
ROPE]
RETURNS [design: Design];
Open a design, given a file name. No cache
Register:
PROC [userProc: UserProc, name:
ROPE];
-- Registration of a new UserProc
Old way to create cells
-- Empty cell: must be repositionned and included in a directory when filled
Compatibility only
CreateEmptyCell:
PRIVATE
PROC
RETURNS [cell: Object] =
INLINE {cell ← CDCells.CreateEmptyCell[]};
-- Include an object in a cell; position is relative to the InterestRect
Compatibility only
IncludeInCell:
PRIVATE
PROC [cell: Object, obj: Object, position:
CD.Position ← [0, 0], orientation:
CD.Orientation ← original]
RETURNS [newInst: Instance] =
INLINE {newInst ← CDCells.IncludeOb[design:
NIL, cell: cell, ob: obj, trans: [CDBasics.SubPoints[position, CDBasics.BaseOfRect[CDBasics.MapRect[
CD.InterestRect[obj], [[0, 0], orientation]]]], orientation], mode: dontResize].newInst};
Sets the interestRect (for cells only)
Compatibility only
SetInterestRect:
PRIVATE
PROC [obj: Object, size:
CD.Position] =
INLINE {[] ← CDCells.SetInterestRect[
NIL, obj, [0, 0, size.x, size.y], dontNotify]};
-- Reposition the object. Should be called for every cell created by CreateEmptyCell, once filled and once interestRect positionned
Compatibility only
RepositionCell: PRIVATE PROC [obj: Object] = INLINE {[] ← CDCells.ResizeCell[NIL, obj]};
Goodies
-- Predicates
ODD: PROC [i: INT] RETURNS [BOOL];
EVEN: PROC [i: INT] RETURNS [BOOL];
-- Dealing with Log2 of numbers
Log2: PROC [n: INT] RETURNS [INT];
TwoToThe: PROC [x: INT] RETURNS [INT];
TwoToTheLog2: PROC [n: INT] RETURNS [INT];
-- Extract the xth bit in the interger N
-- Warning: bit 0 is the LOW order bit (lsb). That is NOT the mesa convention!
XthBitOfN: PROC [x, n: INT] RETURNS [BOOL];