DIRECTORY D2Basic USING [Number, Rect, Vector], D2Orient USING [Orientation, Transformation], Imager USING [Color, Context], PropertyLists USING [PropList], Rope USING [ROPE], TokenIO USING [Handle]; CD: CEDAR DEFINITIONS = BEGIN Number: TYPE = D2Basic.Number; Position: TYPE = D2Basic.Vector; Rect: TYPE = D2Basic.Rect; Orientation: TYPE = D2Orient.Orientation; mirrorY: Orientation = rotate180X; Transformation: TYPE = D2Orient.Transformation; Error: ERROR [ec: ErrorCode _ programmingError, explanation: Rope.ROPE _ NIL]; ErrorCode: TYPE = {programmingError, callingError, noResource, doubleRegistration, missingRegistration, other}; PropList: TYPE = PropertyLists.PropList; PropRef: TYPE = REF PropList _ ; --ABSOLUTELY NEVER NIL InitPropRef: PROC [] RETURNS [PropRef] = INLINE { RETURN [NEW[PropList_NIL]] }; layerNum: NAT = 256; Layer: TYPE = [0..layerNum); undefLayer: Layer = 0; -- layer used for object containing different or unknown Layers shadeLayer: Layer = 1; -- visualization; not for generating masks errorLayer: Layer = 2; -- real layer reserved for error messages; rarely for generating masks backgroundLayer: Layer = 3; -- special pushed-in backGround; not for generating masks outlineLayer: Layer = 4; -- special color for outline; not for generating masks selectionLayer: Layer = 5; -- special color for selection; not for generating masks commentLayer: Layer = 6; -- real layer; may or may not be used by technologies NewLayer: PROC [technology: Technology, uniqueKey: ATOM] RETURNS [Layer]; FetchLayer: PROC [t: Technology, uniqueKey: ATOM] RETURNS [Layer]; LayerTechnology: PROC [l: Layer] RETURNS [Technology]; LayerKey: PROC [l: Layer] RETURNS [ATOM]; markNum: NAT = 256; Object: TYPE = REF ObjectRep; ObjectRep: TYPE = RECORD [ class: ObjectClass, -- never modify class nor class^ bbox: Rect _ [0, 0, 2, 2], -- maximal area drawn, not electrical influence... layer: Layer _ undefLayer, marked: [0..markNum) _ 0, -- only for objects in the design's directory. try to avoid usage. specific: REF ANY _ NIL, properties: PropList _ NIL -- see warning ]; InstanceSequence: TYPE = REF InstanceSequenceRep; InstanceSequenceRep: TYPE = RECORD [length: NAT_0, elts: SEQUENCE size: NAT OF CD.Instance]; CellSpecific: TYPE = REF CellRep; CellRep: TYPE = RECORD [ contents: InstanceList _ NIL, -- used for extras/large/pushed-in cells sequence: InstanceSequence _ NIL, -- reduces memory access compared to list ir: Rect _ [0, 0, -1, -1], -- interest rect name: Rope.ROPE _ NIL, -- once included directory, use only CDDirectory to change it simplifyOn: REAL _ LAST[NAT], -- a treshold for simplification on quickdraw drawBorder: BOOL _ FALSE, -- border should be drawn changed: BOOL _ FALSE, -- cell changed since push [not IO] specifiedIr: BOOL _ FALSE, -- explicitely specified interest rect dummyCell: --READONLY-- BOOL _ FALSE, --if set, inhibits use of sequence reserved1: BOOL _ FALSE, -- for experiments reserved2: BOOL _ FALSE -- for experiments ]; RectSpecific: TYPE = REF RectRep; RectRep: TYPE = RECORD [filler: PRIVATE REF]; InstanceList: TYPE = LIST OF Instance _ NIL; Instance: TYPE = REF InstanceRep; InstanceRep: TYPE = RECORD [ ob: Object, trans: Transformation _ [], selected: BOOL _ FALSE, -- meaningfull for top levels only reserved: BOOL _ FALSE, -- for experiments properties: PropList _ NIL ]; ObjectClass: TYPE = REF ObjectClassRec; ObjectClassRec: TYPE = RECORD [ -- generic procedures for an object quickDrawMe: DrawProc _ NIL, -- an optimized draw procedure for viewers drawMe: DrawProc _ NIL, -- drawing the object into any device showMeSelected: DrawProc _ NIL, -- showing the selection hitInside: HitInsideProc _ NIL, -- for fine grain selection interestRect: RectProc _ NIL, -- the boundary the designer likes to think about technology: Technology _ NIL, -- NIL for technology independent classes objectType: ATOM _ NIL, inDirectory: BOOL _ FALSE, directoryProcs: REF _ NIL, wireTyped: BOOL _ FALSE, -- allows ChipNDale to stretch object in a certain way atomicOb: BOOL _ FALSE, -- creation using CDAtomicObjects symbolic: BOOL _ FALSE, -- object for interface specification; no mask reserved: BOOL _ FALSE, -- for experiments internalWrite: InternalWriteProc _ NIL, internalRead: InternalReadProc _ NIL, description: Rope.ROPE _ NIL, -- shortcut for the class implementor describe: DescribeProc _ NIL, describeInst: DescribeInstProc _ NIL, newLayer: ChangeLayerProc _ NIL, -- used by some simple classes [~inDirectory] only parent: ObjectClass _ NIL, -- for eventual subclassing properties: PropRef _ NIL ]; DrawProc: TYPE = PROC [inst: Instance, trans: Transformation, pr: REF DrawInformation]; HitInsideProc: TYPE = PROC [ob: Object, hitRect: Rect] RETURNS [BOOL]; RectProc: TYPE = PROC [ob: Object] RETURNS [Rect]; InternalWriteProc: TYPE = PROC [h: TokenIO.Handle, ob: Object]; InternalReadProc: TYPE = PROC [h: TokenIO.Handle, key: ATOM] RETURNS [Object]; DescribeProc: TYPE = PROC [ob: Object] RETURNS [Rope.ROPE]; DescribeInstProc: TYPE = PROC [inst: Instance] RETURNS [Rope.ROPE]; ChangeLayerProc: TYPE = PROC [inst: Instance, layer: CD.Layer] RETURNS [BOOL_TRUE]; DrawContextProc: TYPE = PROC [pr: DrawRef, proc: DrawContextLayerProc, ob: Object, trans: Transformation, layer: Layer]; DrawContextLayerProc: TYPE = PROC [context: Imager.Context, ob: Object, layer: Layer]; RegisterObjectClass: PROC [objectType: ATOM, class: ObjectClassRec] RETURNS [ObjectClass]; FetchObjectClass: PROC [objectType: REF, technology: Technology_NIL] RETURNS [--readonly-- ObjectClass]; PushRec: TYPE = RECORD [ dummyCell: Instance, mightReplace: Instance_NIL, specific: CellSpecific -- cache of dummyCell.ob.specific ]; Design: TYPE = REF DesignRec; DesignRec: TYPE = RECORD [ actual: LIST OF PushRec, name: Rope.ROPE _ NIL, -- treat readonly [internal invariants] technology: Technology _ NIL, properties: PropRef _ , edited: BOOL _ FALSE, -- treat readonly [internal invariants] changedSinceSaving: BOOL _ FALSE, -- treat readonly [internal invariants] cdDirectoryPriv: PRIVATE REF, -- used by CDDirectory for directory cdDirectoryPriv2: PRIVATE REF, -- used by CDDirectory for ownership keys cdValuePriv: PRIVATE PrivateValueDRef _ NIL, -- used by CDValue cdSequencerPriv: PRIVATE PrivateSequencerDRef, -- used by CDSequencer cdDrawQueuePriv: PRIVATE REF _ NIL, -- used by CDDrawQueue delayedRedrawsPriv: PRIVATE REF _ NIL, -- used by single module unDoBuffers: PRIVATE PropRef _, -- expect use of InitPropRef to disable undos reserved: PRIVATE REF _ NIL ]; PrivateSequencerDRef: TYPE = REF PrivateSequencerDRep; PrivateSequencerDRep: TYPE; PrivateValueDRef: TYPE = REF PrivateValueDRep; PrivateValueDRep: TYPE; Technology: TYPE = REF TechnologyRep; TechnologyRep: TYPE = RECORD [ key: ATOM _ NIL, name: Rope.ROPE _ NIL, lambda: CD.Number _ , usedLayers: LIST OF Layer, -- only technology dependent Layers properties: PropRef _ , cdPriv: PRIVATE PrivateTRef, cdValuePriv: PRIVATE PrivateValueTRef, -- used by CDValue cdSequencerPriv: PRIVATE PrivateSequencerTRef -- used by CDSequencer ]; PrivateSequencerTRef: TYPE = REF PrivateSequencerTRep; PrivateSequencerTRep: TYPE; PrivateValueTRef: TYPE = REF PrivateValueTRep; PrivateValueTRep: TYPE; PrivateTRef: TYPE = PRIVATE REF PrivateTRep; PrivateTRep: TYPE; RegisterTechnology: PROC [key: ATOM, name: Rope.ROPE _ NIL, lambda: CD.Number _ 2] RETURNS [Technology]; FetchTechnology: PROC [key: ATOM] RETURNS [Technology]; EnumerateTechnologies: PROC [proc: TechnologyEnumerator] RETURNS [quit: BOOL]; TechnologyEnumerator: TYPE = PROC[tech: CD.Technology] RETURNS [quit: BOOL_FALSE]; DrawRef: TYPE = REF DrawInformation; DrawInformation: TYPE = RECORD [ interestClip: Rect _ [Number.FIRST/2, Number.FIRST/2, Number.LAST/2, Number.LAST/2], drawChild: DrawProc _ NIL, -- drawing and recursing drawRect: DrawRectProc _ NIL, -- design coordinates stopFlag: REF BOOL _ NIL, -- setting stopFlag^ to true stops drawing drawOutLine: DrawRectProc _ NIL, -- visualization only; not for generating masks drawContext: DrawContextProc _ NIL, -- drawing into an imager context drawComment: DrawCommentProc _ NIL, -- visualization only; not for generating masks drawChildSel: DrawProc _ NIL, -- drawing of selection of child setGround: SetGroundProc _ NIL, priorityChecker: CheckPriorityProc _ NIL, --usually no-op scaleHint: REAL _ 0, -- to monitor simplifications; 0 means no simplifications environment: BOOL _ TRUE, -- draw the outside of pushed in cells symbolics: BOOL _ TRUE, -- draw symbolic objects selections: BOOL _ TRUE, -- draw selections specialFonts: BOOL _ FALSE, -- usually FALSE; device may replace fonts checkPriority: BOOL _ FALSE, -- usually FALSE; priority of running process borders: BOOL _ FALSE, -- visualization only; not for generating masks b4: BOOL _ TRUE, -- reserved for experiments b5: BOOL _ TRUE, -- reserved for experiments devicePrivate: REF _ NIL, -- differentiate among multiple (viewers) with same drawProc's viewerPrivate: ViewerPrivate _ NIL, -- speed up for viewers devicePrivate deviceContext: Imager.Context _ NIL, -- may or may not be used contextFilter: REF ContextFilter _ NIL, -- (default uses filter only if deviceContext=NIL) contextColors: REF ContextColors _ NIL,-- (default uses colors only if deviceContext#NIL) dummyInst: CD.Instance _ NIL, -- space for object class implementors design: Design _ NIL, -- optional for lots of devices properties: PropRef _ NIL ]; ViewerPrivate: TYPE = REF ViewerPrivateRep; ViewerPrivateRep: TYPE; DrawRectProc: TYPE = PROC [r: Rect, l: Layer, pr: DrawRef]; DrawCommentProc: TYPE = PROC [r: Rect, comment: Rope.ROPE, pr: DrawRef]; SetGroundProc: TYPE = PROC [pr: DrawRef, pushedOut: BOOL]; CheckPriorityProc: TYPE = PROC [pr: DrawRef]; ContextFilter: TYPE = PACKED ARRAY Layer OF BOOL _ ALL[FALSE]; ContextColors: TYPE = ARRAY Layer OF Imager.Color _ ALL[NIL]; CreateDrawRef: PROC [inf: DrawInformation] RETURNS [DrawRef]; InterestRect: PROC [ob: Object] RETURNS [r: Rect] = INLINE { RETURN [ob.class.interestRect[ob]] }; InterestBase: PROC [ob: Object] RETURNS [sz: Position] = INLINE { r: CD.Rect = ob.class.interestRect[ob]; RETURN [[r.x1, r.y1]]; }; InterestSize: PROC [ob: Object] RETURNS [sz: Position] = INLINE { r: CD.Rect = ob.class.interestRect[ob]; RETURN [[r.x2-r.x1, r.y2-r.y1]]; }; END. ͺCD.mesa Copyright c 1983, 1986 by Xerox Corporation. All rights reserved. Created by: Christian Jacobi, June 24, 1983 3:54 pm Last edited by: Christian Jacobi, October 28, 1986 6:23:43 pm PST Main definitions for ChipNDale, a VLSI design editor and database. -- Measuring -- RECORD [x, y: Number]; -- RECORD [x1, y1, x2, y2: Number]; -- A Rect is called normalized if (x1>x2) OR (y1>y2) means that the Rect is empty. -- Rects are normalized, except if an explicite comment denies. -- Rect's are closed: they include all the endpoints; as you expect, points have -- size 0. -- MACHINE DEPENDENT {original(0), mirrorX(1), rotate90(2), rotate90X(3), -- rotate180(4), rotate180X(5), rotate270(6), rotate270X(7)}; -- An orientation represents an anticlockwise rotation maybe followed by a reflection in x. -- [Reflection in x means: modify x coordinates, leave y coordinates] -- RECORD [off: D2Basic.Vector _ [0, 0], orient: Orientation _ original]; -- A transformation represents an orientation followed by a translation. -- Errors -- Properties -- Friendly use expected: don't assign properties without first registering -- their names with CDProperties. -- Use only CDProperties to modify ChipNDale PropList; NOT PropertyLists -- Layers -- creates a new layer for technology -- may raise Error[noResource] and others -- the technolgy implementation must guarantee for uniqueness of uniqueKey's -- (unique only for the technology) -- returns a layer given its technology and its unique key -- may also return technology independent layers -- returns the technology of the layer or NIL if layer is technology independent -- returns the technology specific unique key of the layer --Object, cells, instances -- Objects are the main things in ChipNDale -- Objects must draw the same way independant of their environment -- Several instances may point to same object: consider on modifications. -- Some implementors of object-classes share the bits of different ObjectRep's -- (therefore usage of properties of Objects not in the directory is restricted to -- the object class implentor.) -- if inDirectory then objects of this class must be included in designs directory; -- if ~inDirectory then objects of this class must be immutable; -- object classes of objects which have children must have inDirectory=TRUE --if wireTyped then [interestRect] y corresponds to the length -- procedure uses trans from parameter, ignores inst.trans, may use inst.properties -- object classes which uses DrawContextProc must guarantee -- ob#NIL -- ob.size < [NAT.LAST, NAT.LAST] -- objectType field must be initialized -- may raise Error[doubleRegistration] and others -- Also initializes procedures with default values -- An object type may be used either in arbitrary technology or technology-independent. -- This should be the only way to create data of type ObjectProcsRec -- NIL if not found -- consider ObjectClass as readonly if you are not the implementor of the object type -- Design -- an instance of a cell describing the current state of the pushed in cell -- originally a copy of mightReplace; dummyCell.ob is not included in the directory -- sub instances of cell are mapped to design coordinates -- size of cell object may be wrong -- the original instance into which the design is pushed in -- mightReplace is in the coordinate system of the next outer dummyCell -- and is removed from [the next outer dummyCell's] instance list. -- sub instances of mightReplace.ob are in cd coordinate system of the object -- may be NIL for top level -- use only CDOps.CreateDesign to create DesignRec records -- use CDValue or CDProperties for more fields stack of pushed in cells actual.first describes most deeply pushed in object -- Technology -- use RegisterTechnology to create TechnologyRep record -- all fields except properties read only -- use CDValue or CDProperties for more fields -- This must be the only way to create data of type TechnologyRep -- may raise Error[doubleRegistration] and others -- NIL if not found -- Drawing (interest area; not device area), in doubt must be larger -- use CreateDrawRef for creation of DrawInformation record, unless all fields are set. -- A TRUE entry means the layer is visible -- A NIL color entry means the layer is invisible -- and assigns usefull default procedures and values. -- Vanilla procedures -- Returns the interest rect of the object -- Returns the base of the interest rect -- Returns the size of the interest rect Κέ˜codešœ ™ Kšœ Οmœ7™BKšœ5™5K™A—K™KšœB™BK˜šΟk ˜ Kšœžœ˜%Kšœ žœ˜-Kšœžœ˜Kšœžœ ˜Kšœžœžœ˜Kšœžœ ˜—K˜KšΠknœžœž œ˜Kšž˜K˜Kšœ ™ K˜Kšœžœ žœ˜šœ žœ žœ˜ Kšœžœ™—šœžœ˜Kšœžœ™#KšœR™RK™@KšœQ™QKšœ ™ —K˜šœ žœ˜)KšœJ™JKšœ=™=Kšœ\™\KšœE™E—˜Kšœ"˜"—K˜šœžœ˜/KšœI™IKšœI™I—K™K™Kšœ ™ K˜KšΟbœžœ6žœžœ˜NKšœ žœ`˜oK˜K™Kšœ ™ K˜šœ žœ˜+KšœM™MKšœ!™!KšœH™H—šœ žœžœΟc˜7K˜—šΟn œžœžœ žœ˜1Kšžœžœ žœ˜K˜—K™K™Kšœ ™ K˜Kšœ žœ˜šœžœ˜Kšœ‘?˜WKšœ‘œ‘˜BKšœ‘)œ‘˜^Kšœ‘œ‘˜UKšœ‘œ‘˜OKšœ‘8˜SKšœ‘5˜NK˜K˜—š’œžœ%žœžœ ˜IKšœ%™%Kšœ)™)KšœL™LKšœ#™#K˜—š’ œžœžœžœ ˜BK™:K™0K˜—š’œžœ žœ˜6K™P—K˜š’œžœ žœžœ˜)K™:K˜—K˜Kšœ™K˜Kšœ žœ˜K˜šœžœžœ ˜K™+K™BK˜—šœ žœžœ˜Kšœ‘ ˜4Kšœ‘2˜MKšœ˜Kšœ‘C˜]Kšœ žœžœžœ˜Kšœžœ‘˜)K˜KšœI™IKšœN™NKšœS™SKšœ™K˜—Kšœžœžœ˜1Kšœžœžœ žœ žœžœžœžœ ˜\K˜Kšœžœžœ ˜!šœ žœžœ˜Kšœžœ‘(˜FKšœžœ‘)˜KKšœ‘˜+Kšœ žœžœ‘>˜UKšœ žœžœžœ‘-˜KKšœ žœžœ‘˜4Kšœ žœžœ‘#˜;Kšœ žœžœ‘&˜AKšœ ‘ œžœžœ‘"˜HKšœ žœžœ‘˜-Kšœ žœžœ‘˜,K˜K˜—Kšœžœžœ ˜!Kš œ žœžœ žœžœ˜-K˜Kš œžœžœžœ žœ˜,Kšœ žœžœ ˜!šœ žœžœ˜K˜ Kšœ˜Kšœ žœžœ‘"˜:Kšœ žœžœ‘˜*Kšœžœ˜K˜K˜—Kšœ žœžœ˜'šœžœžœ‘$˜DKšœžœ‘+˜HKšœžœ‘&˜>Kšœžœ‘˜8Kšœžœ‘˜=Kšœžœ‘3˜PKšœžœ‘)˜GKšœ žœžœ˜šœ žœžœ˜KšœS™SKšœ@™@KšœK™KKšœžœžœ˜—šœ žœžœ‘7˜PKšœ>™>—Kšœ žœžœ‘!˜9Kšœ žœžœ‘/˜HKšœ žœžœ‘˜+Kšœ#žœ˜'Kšœ!žœ˜%Kšœžœžœ‘%˜CKšœžœ˜Kšœ!žœ˜%Kšœžœ‘2˜SKšœžœ‘˜6Kšœžœ˜K˜K˜—šœ žœžœ-žœ˜WKšœS™S—Kš œžœžœžœžœ˜IKšœ žœžœžœ˜2Kšœžœžœ!˜?Kš œžœžœžœžœ ˜NKš œžœžœžœžœ˜;Kš œžœžœžœžœ˜CKš œžœžœžœžœžœžœ˜Sšœžœžœ\˜xKšœ<™Kšœžœ˜Kšœ˜Kšœžœžœ‘'˜=Kšœžœžœ‘'˜IKšœžœžœ‘$˜FKšœžœžœ‘)˜LKšœ žœžœ‘˜?Kšœžœ‘˜EKšœžœžœžœ‘˜:Kšœžœžœžœ‘˜?Kšœ žœ ‘-˜MKšœ žœžœž˜K˜K˜Kšœžœžœ˜6Kšœžœ˜Kšœžœžœ˜/Kšœžœ˜K˜—K˜Kšœ ™ K™Kšœ žœžœ˜%šœžœžœ˜Kš‘œ™8Kšœ)™)Kšœ/™/Kšœžœžœ˜Kšœ žœžœ˜Kšœžœ ˜Kšœ žœžœ‘#˜>Kšœž˜Kšœžœ ˜Kšœ žœ‘˜:Kšœžœ‘˜EK˜K˜Kšœžœžœ˜7Kšœžœ˜Kšœžœžœ‘˜/Kšœžœ˜Kšœ žœžœžœ˜-Kšœ žœ˜K˜—š’œžœžœ žœžœ žœ žœ˜hKšœA™AKšœ1™1K˜—š’œžœžœžœ˜7Kšœ™—K˜š’œžœžœžœ˜NKš œžœžœžœ žœžœžœ˜RK˜—K™Kšœ ™ K˜Kšœ žœžœ˜$šœžœžœ˜ š œžœ žœ žœ žœ˜UKšœ9™9—Kšœžœ‘˜4Kšœžœ‘˜3Kšœ žœžœžœ‘*˜DKšœžœ‘/˜PKšœžœ‘!˜EKšœžœ‘/˜SKšœžœ‘ ˜?Kšœžœ˜Kšœ%žœ‘˜9Kšœ žœ‘9˜OKšœ žœžœ‘'˜@Kšœ žœžœ‘˜1Kšœ žœžœ‘˜,Kšœžœžœ‘+˜GKšœžœžœ‘.˜KKšœ žœžœ‘/˜GKšœžœžœ‘œ˜.Kšœžœžœ‘˜-Kšœž œ‘>˜XKšœžœ‘%˜IKšœ žœ‘˜>Kšœžœžœ‘3˜ZKšœžœžœ‘2˜YKšœ žœ žœ‘&˜DKšœžœ‘ ˜6Kšœž˜K˜Kš‘X™XKšœžœžœ˜+Kšœžœ˜K˜—Kšœžœžœ!˜;Kšœžœžœžœ˜HKšœžœžœžœ˜:šœžœžœ˜-K˜—šœžœžœžœžœžœžœžœ˜>Kšœžœ!™*—š œžœžœžœžœžœ˜=Kšœ1™1K˜—š’ œžœžœ ˜=Kšœ5™5K˜—K˜K™K˜š’ œžœžœ žœ˜