DIRECTORY CD USING [Design, Instance, InstanceList, Object, original, Position], CDCells USING [CreateEmptyCell, RepositionCell, SetInterestRect], CDCleanUp USING [CleanUp], CDGenerate USING [GeneratorProc], CDOrient USING [mirrorX, mirrorY, Orientation, rotate90, rotate180, rotate270], IO USING [Value], PWPins USING [Side], Rope USING [ROPE], TerminalIO; PW: CEDAR DEFINITIONS IMPORTS CDCells, CDCleanUp, TerminalIO = BEGIN ROPE: TYPE = Rope.ROPE; -- Unavoidable Object: TYPE = CD.Object; -- an object, i.e. a definition ListOb: TYPE = LIST OF Object; Instance: TYPE = CD.Instance; -- an instance InstanceList: TYPE = CD.InstanceList; Design: TYPE = CD.Design; UserProc: TYPE = CDGenerate.GeneratorProc; -- PROC [design: Design, key: ROPE, table: CDGenerate.Table, data: REF] RETURNS [ob: Object_NIL] AbutProblem: SIGNAL [what: ROPE, isX: BOOL, ob1, ob2: Object]; Reverse: PUBLIC PROC [listObj: ListOb] RETURNS [result: ListOb _ NIL]; ForEachInstProc: TYPE = PROC [inst: Instance, data: REF] RETURNS [newInst: Instance _ NIL]; 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: ListOb] RETURNS [obj: Object]; AbutListY: PROC [listOb: ListOb] RETURNS [obj: Object]; AbutCheckX: PROC [t1, t2, t3, t4, t5, t6: Object _ NIL] RETURNS [obj: Object]; AbutCheckY: PROC [t1, t2, t3, t4, t5, t6: Object _ NIL] RETURNS [obj: Object]; AbutCheckListX: PROC [listOb: ListOb] RETURNS [obj: Object]; AbutCheckListY: PROC [listOb: ListOb] RETURNS [obj: Object]; 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]; MapFunctionIndexPins: PROC [function: XYFunction, lx: INT _ 0, ux: INT, ly: INT _ 0, uy: INT, indexedPins: ARRAY PWPins.Side OF LIST OF ROPE _ ALL [NIL]] RETURNS [new: Object]; ArrayX: PROC [ob: Object, nx: INT _ 1] RETURNS [Object]; ArrayY: PROC [ob: Object, ny: INT _ 1] RETURNS [Object]; Array: PROC [ob: Object, nx, ny: INT _ 1] RETURNS [new: Object]; ChangeOrientation: PUBLIC PROC [obj: Object, orientation: CDOrient.Orientation] RETURNS [cell: Object]; FlipX: PROC [ob: Object] RETURNS [Object] = INLINE {RETURN [ChangeOrientation[ob, CDOrient.mirrorX]]}; FlipY: PROC [ob: Object] RETURNS [Object] = INLINE {RETURN [ChangeOrientation[ob, CDOrient.mirrorY]]}; Identity: PROC [ob: Object] RETURNS [Object] = INLINE {RETURN [ob]}; Rot90: PROC [ob: Object] RETURNS [Object] = INLINE {RETURN [ChangeOrientation[ob, CDOrient.rotate90]]}; Rot180: PROC [ob: Object] RETURNS [Object] = INLINE {RETURN [ChangeOrientation[ob, CDOrient.rotate180]]}; Rot270: PROC [ob: Object] RETURNS [Object] = INLINE {RETURN [ChangeOrientation[ob, CDOrient.rotate270]]}; InstanceName: PROC [obj: Object, instanceName: ROPE] RETURNS [cell: Object]; Copy: PROC [ob: Object] RETURNS [new: Object]; Inst: PROC [ob: Object, conds: LIST OF ROPE, removeNamed: BOOL _ TRUE] RETURNS [new: Object]; Flatten: PROC [cell: Object] RETURNS [new: Object]; Get: PROC [design: Design, name: ROPE] RETURNS [ob: Object]; OpenDesign: PROC [fileName: ROPE] RETURNS [design: Design]; CleanUp: PROC [design: Design] = INLINE {CDCleanUp.CleanUp[design]}; Register: PROC [userProc: UserProc, name: ROPE]; SharedAbutX: PROC [t1, t2: Object _ NIL] RETURNS [obj: Object]; SharedAbutY: PROC [t1, t2: Object _ NIL] RETURNS [obj: Object]; SharedAbutListX: PROC [listOb: ListOb] RETURNS [obj: Object]; SharedAbutListY: PROC [listOb: ListOb] RETURNS [obj: Object]; FlushSharedCache: PROC; RegisterProp: PROC [prop: ATOM, copy: BOOL _ FALSE, flushOnEdit: BOOL _ FALSE] RETURNS [sameAtom: ATOM]; CreateEmptyCell: PROC RETURNS [cell: Object] = INLINE {cell _ CDCells.CreateEmptyCell[]}; IncludeInCell: PROC [cell: Object, obj: Object, position: CD.Position _ [0, 0], orientation: CDOrient.Orientation _ CD.original] RETURNS [newInst: Instance]; AppendProps: PROC [newObj, obj: Object]; SetInterestRect: PROC [obj: Object, size: CD.Position] = INLINE {[] _ CDCells.SetInterestRect[obj, [0, 0, size.x, size.y]]}; RepositionCell: PROC [obj: Object] = INLINE {[] _ CDCells.RepositionCell[obj, NIL]}; GetLocation: PROC [inst: Instance, obj: Object] RETURNS [location: CD.Position]; Send: PROC [obj: Object, prop: ATOM] RETURNS [value: REF _ NIL, expandedObj: Object]; ForEachPinProc: TYPE = PROC [inst: Instance] RETURNS [obj: Object]; SelectNamesProc: TYPE = PROC [name: ROPE] RETURNS [keepIt: BOOL]; KeepAll: SelectNamesProc; TransferCell: PUBLIC PROC [template: Object, objSide: PWPins.Side, width: INT, objProc: ForEachPinProc, selectNameProc: SelectNamesProc _ KeepAll] RETURNS [cell: Object]; TopFillerCell: PROC [template: Object, height: INT, selectNameProc: SelectNamesProc _ KeepAll] RETURNS [cell: Object]; BottomFillerCell: PUBLIC PROC [template: Object, height: INT, selectNameProc: SelectNamesProc _ KeepAll] RETURNS [cell: Object]; LeftFillerCell: PROC [template: Object, width: INT, selectNameProc: SelectNamesProc _ KeepAll] RETURNS [cell: Object]; RightFillerCell: PUBLIC PROC [template: Object, width: INT, selectNameProc: SelectNamesProc _ KeepAll] RETURNS [cell: Object]; Draw: PROC [obj: CD.Object, technologyName: ATOM _ NIL] RETURNS [design: CD.Design]; WriteF: PROC [format: ROPE _ NIL, v1, v2, v3, v4, v5: IO.Value _ [null[]]] = INLINE {TerminalIO.WriteF[format, v1, v2, v3, v4, v5]}; RequestRope: PROC [text: ROPE _ NIL] RETURNS [ROPE] = INLINE {RETURN[TerminalIO.RequestRope[text]]}; RequestInt: PROC [text: ROPE _ NIL] RETURNS [INT] = INLINE {RETURN[TerminalIO.RequestInt[text]]}; ODD: PROC [i: INT] RETURNS [BOOL]; EVEN: PROC [i: INT] RETURNS [BOOL]; Log2: PROC [n: INT] RETURNS [INT]; TwoToThe: PROC [x: INT] RETURNS [INT]; TwoToTheLog2: PROC [n: INT] RETURNS [INT]; XthBitOfN: PROC [x, n: INT] RETURNS [BOOL]; END. ΠPW.mesa Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. Last Edited by: Louis Monier August 22, 1985 12:23:42 pm PDT Bertrand Serlet April 24, 1986 10:51:28 pm PST -- PatchWork (PW) is a Silicon Assembler. Types and signals -- The new hot types, identical to CD types What the user registers with PW -- This signal might be raised by an incorrect abut Utilities ListOb manipulations -- Used in enumeration procs, for example by conditional objects Safe subset -- 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. -- AbutCheck: parse the pins and check if they match; stop and complain if pin mismatch -- pins match if: same width (depth does not matter), same position, same layer, names checked by a special proc. -- 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. Does a map function and indexes at the same time pins which are in indexedPins. Other pins are propagated -- Aligns nx tiles in the X (--) direction. If nx<=0 an empty cell is created -- Aligns ny tiles in the Y (|) direction. If nx<=0 an empty cell is created -- Equivalent to ArrayY[ArrayX[ob, nx], ny]: no flat 2D array -- Planar tranformations and instance names: these properties are usually associated to instances, not objects, so we have to add an extra level of hierarchy -- Symmetry that changes X (so/Y) Symmetry that changes Y (so/X) Logically same as copy Counter-clockwise -- Copy and conditional objects -- Copy: first level only, i.e. any subcell is just referenced, not duplicated -- Parametrized cells (conditional objects only for now) -- 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. -- Designs, directories, . . . Get creates a Indirect object that is a low-weight import. Provokes an ERROR if no such name in the directory. -- Open a design, given a file name Christian requires that! -- Registration of a new UserProc Shared abuts Novice users, please skip this section You are on your own This goodie is to register a property which is an ATOM (instead of a REF), when you do not care about registering it many times, and so that it is easy to specify the copy proc. If the argument flushOnEdit is set to TRUE, all edits of a cell will provoke the dismiss of the property for that cell and all the cells that depends on it. -- Empty cell: must be repositionned and included in a directory when filled -- Include an object in a cell; position is relative to the InterestRect -- Adds the properties of obj which are copiable to the ones of newObj Sets the interestRect (for cells only) -- Reposition the object. Should be called for every cell created by CreateEmptyCell, once filled and once interestRect positionned -- The following primitive allows the use of the InterestRect coordinates only: location is the position of the InterestRect of inst in the InterestRect coordinate system of obj -- Tries to find the property on the object, if it fails on the class, and if it fails expands (a failure in expansion provokes the return of NIL) and starts all over again. High-level constructors (safe if your procs are safe) -- Transfer cell is a very Xerographic constructor: it first creates an empty cell: one dimension is the specified width, the other is the same as the side of the template; then it parses the side of the template, and for every pin it calls the objProc and sticks the resulting object in the cell so that it faces the pin; the object is rotated according to the side in use, and the right side corresponds to the original orientation -- put pins, make by rotation!!! Tools for helping the designer debug his PW code Creates a new CD viewer and displays the object. Default is $cmosB technology. The object and its depencies are NOT included in the design. Goodies -- Input and output from the terminal -- Predicates -- Dealing with Log2 of numbers -- Extract the xth bit in the interger N -- Warning: bit 0 is the LOW order bit (lsb). That is NOT the mesa convention! Κ Ω˜– "Cedar" stylešœ™Jšœ Οmœ7™BIcode™˜FJšœžœ4˜AJšœ žœ ˜Jšœ žœ˜!Jšœ žœA˜OJšžœžœ ˜Jšœžœ˜Jšœžœžœ˜Jšœ ˜ —J˜šΠbkœžœž œ˜Jšžœ!˜(Jšžœ˜—head™JšžœžœžœΟc˜&J™Jšœ+™+JšΟbœžœžœ !˜@Jš‘œžœžœžœ˜Jš‘œžœžœ ˜/Jš‘ œžœžœ˜%Jš‘œžœžœ˜J˜•StartOfExpansionh -- [design: CD.Design, key: ROPE, table: CDGenerate.Table, data: REF ANY] RETURNS [ob: CD.Object _ NIL]š‘œžœΠcs`˜‹Jšœ™—J˜š‘ œžœžœžœ˜>J™3——™ š Οnœžœžœžœžœ˜FJšœ™—J˜š £œžœžœžœžœžœ˜[J™@——šΟl ™ J™ίJ™J™aJšœ'£ ™2™±Jš£œžœ#žœžœ˜IJš£œžœ#žœžœ˜IJš£ œžœžœ˜7Jš£ œžœžœ˜7—J™J™W™qJš£ œžœ#žœžœ˜NJš£ œžœ#žœžœ˜NJš£œžœžœ˜