DIRECTORY CD, CDBasics, CDCells, CDInstances, CDOrient, CDSymbolicObjects, CDProperties, CDRects, Core, CoreClasses, CoreOps, CoreProperties, PW, PWPins, Rope, Sinix, Stix, StixParser; StixParserImpl: CEDAR PROGRAM IMPORTS CD, CDBasics, CDCells, CDInstances, CDSymbolicObjects, CDProperties, CDRects, CoreClasses, CoreOps, CoreProperties, PW, PWPins, Rope, Sinix, Stix EXPORTS StixParser = BEGIN OPEN Stix, StixParser; InputStix: PUBLIC PROC [cell: Object, from: CD.Design] RETURNS [cellType: CellType] = { DecorateSpecials[cell]; cellType _ Sinix.ExtractCell[cell].cellType; InitTechno[from.technology]; AddStixObjects[cellType]; FinishCell[cellType]; }; AddStixObjects: PROC [cellType: CellType] ~ { PublicPins: CoreOps.EachWireProc ~ { }; PutStixGeomOnWire: CoreOps.EachWireProc ~ { FOR l: InstanceList _ Sinix.GetWireGeometryPropFromWire[wire], l.rest WHILE l#NIL DO TranslateWireGeom[l.first, cellType, wire]; -- pin, contact or wire ENDLOOP; }; recCell: RecordCell _ NARROW[cellType.data]; cell: Object _ NARROW[CoreProperties.GetCellTypeProp[cellType, Sinix.layoutProp]]; cellPtr: CD.CellPtr _ NARROW[cell.specificRef, CD.CellPtr]; stickCell: StickPtr _ CreateStickCell[name: cellPtr.name]; PutStickPtr[cellType, stickCell]; stickCell.properties _ CoreProperties.PutProp[stickCell.properties, extractedCoreProp, cellType]; [] _ CoreOps.VisitWire[cellType.public, PublicPins]; -- pinsProp [] _ CoreOps.VisitWire[recCell.internal, PutStixGeomOnWire]; -- wireGeometryProp FOR i: NAT IN [0..recCell.size) DO -- instanceProp inst: Instance; coreInst: CoreInst _ recCell[i]; inst _ NARROW[CoreProperties.GetCellInstanceProp[coreInst, Sinix.instanceProp]]; TranslateTransistor[inst, coreInst, cellType]; ENDLOOP; }; InsertInStickCell: PROC [stickPtr: StickPtr, cellType: CellType] ~ { cell: StickPtr _ GetStickPtr[cellType]; stickCell: StickCell _ NARROW[cell.data]; }; TranslateWireGeom: PROC [inst: Instance, cellType: CellType, wire: Wire] ~ { stickPtr: StickPtr _ SELECT TRUE FROM IsContact[inst.ob] => TranslateContact[inst, cellType, wire], IsRect[inst.ob] => TranslateWire[inst, cellType, wire], ENDCASE => NIL; -- HighLightInstance[cell, inst, "unknown"] and log on terminal? IF stickPtr=NIL THEN RETURN; AppendWireGeom[wire, stickPtr]; InsertInStickCell[stickPtr, cellType]; }; TranslateContact: PROC [inst: Instance, cellType: CellType, wire: Wire] RETURNS [stickPtr: StickPtr] = { stickPtr _ CreateContact[ node: OriginOnGrid[inst, cellType, wire]]; }; TranslateWire: PROC [inst: Instance, cellType: CellType, wire: Wire] RETURNS [stickPtr: StickPtr] = { ref: REF _ CDProperties.GetPropFromInstance[inst, stickWidthProp]; stickPtr _ CreateWire[ n1: OriginOnGrid[inst, cellType, wire], n2: OtherEndOnGrid[inst, cellType, wire], color: ToColor[inst.ob.layer], width: IF ref#NIL THEN NARROW[ref, REF INT]^ ELSE 0]; }; TranslateTransistor: PROC [inst: Instance, coreInst: CoreInst, cellType: CellType] = { IncludeExtraWireProc: CoreOps.EachWirePairProc = { extraWire: StickPtr; pin, pinOutside: Instance; pinName: ROPE; node: Node; i: INT; IF publicWire.size#0 THEN RETURN; -- deal with atomic wires only pin _ NARROW[CoreProperties.GetWireProp[publicWire, Sinix.pinsProp], InstanceList].first; pinName _ CDSymbolicObjects.GetName[pin]; i _ SELECT TRUE FROM -- same as in DecorateTr Rope.Equal[pinName, "gate"] => 0, Rope.Equal[pinName, "ch1"] => 1, Rope.Equal[pinName, "ch2"] => 2, ENDCASE => ERROR; pinOutside _ PWPins.TransformInstance[pin, inst.ob.size, inst.location, inst.orientation]; node _ CreateNode[PutOnGrid[PW.GetLocation[pinOutside, cell]], actualWire, cellType]; prNodes[i] _ CreateNode[node.pos, actualWire, cellType, TRUE]; extraWire _ CreateWire[n1: prNodes[i], n2: node, color: pinColors[i]]; AppendWireGeom[actualWire, extraWire]; InsertInStickCell[extraWire, cellType]; }; trans: StickPtr; cell: Object _ NARROW[CoreProperties.GetCellTypeProp[cellType, Sinix.layoutProp]]; color: Color _ SELECT TRUE FROM IsNTr[inst.ob] => nTrColor, IsPTr[inst.ob] => pTrColor, ENDCASE => NIL; -- HighLightInstance[cell, inst, "unknown"] and log on terminal? pinColors: ARRAY [0..3) OF Color _ [trGateColor, color, color]; prNodes: ARRAY [0..3) OF Node; [] _ CoreOps.VisitBinding[coreInst.actual, coreInst.type.public, IncludeExtraWireProc]; trans _ CreateTransistor[ gate: prNodes[0], ch1: prNodes[1], ch2: prNodes[2], color: color, width: GetInt[inst, stickWidthProp], length: GetInt[inst, stickLengthProp]]; PutInstance[coreInst, trans]; InsertInStickCell[trans, cellType]; }; GetInt: PROC [inst: Instance, prop: ATOM] RETURNS [INT] ~ { ref: REF _ CDProperties.GetPropFromInstance[inst, prop]; RETURN [IF ref#NIL THEN NARROW[ref, REF INT]^ ELSE 0]; }; contactName: PUBLIC ROPE _ "StixContact"; nTransistorName: PUBLIC ROPE _ "StixNeTr"; pTransistorName: PUBLIC ROPE _ "StixPeTr"; stickWidthProp: PUBLIC ATOM _ $stickWidthProp; stickLengthProp: PUBLIC ATOM _ $stickLengthProp; lambda: INT; -- lambda in the source design grid: INT; -- all objects endpoints (nodes) should be on this grid (not necessary) IsRect: PROC [ob: Object] RETURNS [BOOL] = { RETURN[ob.class.wireTyped AND ~ob.class.symbolic]}; IsContact: PROC [ob: Object] RETURNS [BOOL] = { RETURN[IsNamedCell[ob, contactName]]}; IsNTr: PROC [ob: Object] RETURNS [BOOL] = { RETURN[IsNamedCell[ob, nTransistorName]]}; IsPTr: PROC [ob: Object] RETURNS [BOOL] = { RETURN[IsNamedCell[ob, pTransistorName]]}; IsTransistor: PROC [ob: Object] RETURNS [BOOL] = { RETURN[IsNTr[ob] OR IsPTr[ob]]}; IsNamedCell: PROC [ob: Object, name: ROPE] RETURNS [BOOL] = { RETURN[CDCells.IsCell[ob] AND Rope.Equal[NARROW[ob.specificRef, CD.CellPtr].name, name]]}; TouchGenericContact: Sinix.TouchProc = {RETURN [TRUE]}; DecorateSpecials: PROC [cell: Object] ~ { contents: InstanceList _ NARROW[cell.specificRef, CD.CellPtr].contents; nTrCt, pTrCt: CellType _ NIL; DecorateTr: PROC [ob: Object, ct: CellType] ~ { FindTrPins: CDSymbolicObjects.InstEnumerator ~ { name: ROPE _ CDSymbolicObjects.GetName[inst]; index: INT _ SELECT TRUE FROM Rope.Equal[name, "gate"] => 0, Rope.Equal[name, "ch1"] => 1, Rope.Equal[name, "ch2"] => 2, ENDCASE => ERROR; pins: InstanceList _ LIST[inst]; CoreProperties.PutWireProp[ct.public[index], Sinix.pinsProp, pins]; }; [] _ CDSymbolicObjects.EnumerateSymbolicObs[ob, FindTrPins]; }; FOR l: InstanceList _ contents, l.rest WHILE l#NIL DO ob: Object _ l.first.ob; SELECT TRUE FROM IsContact[ob] => { -- Generic Contact is extracted like a wire CDProperties.PutPropOnObject[ob, Sinix.extractProcProp, NEW[Sinix.ExtractProc _ Sinix.ExtractWire]]; CDProperties.PutPropOnObject[ob, Sinix.touchProcProp, NEW[Sinix.TouchProc _ TouchGenericContact]]; }; IsNTr[ob] => { -- Generic Transistors: we put result of the extraction directly IF nTrCt=NIL THEN { nTrCt _ CoreClasses.CreateTransistor[[type: nE]]; DecorateTr[ob, nTrCt]}; CDProperties.PutPropOnObject[ob, Sinix.extractedCoreProp, nTrCt]}; IsPTr[ob] => { IF pTrCt=NIL THEN { pTrCt _ CoreClasses.CreateTransistor[[type: pE]]; DecorateTr[ob, pTrCt]}; CDProperties.PutPropOnObject[ob, Sinix.extractedCoreProp, pTrCt]}; ENDCASE => NULL; ENDLOOP; }; PutOnGrid: PROC [pos: CD.Position] RETURNS [gridPos: CD.Position] = { -- why always say "round" ? Chubby: PROC [n: INT] RETURNS [g: INT] = {RETURN [((n+grid/2)/grid)]}; gridPos _ [Chubby[pos.x], Chubby[pos.y]]}; OriginOnGrid: PROC [inst: Instance, cellType: CellType, wire: Wire] RETURNS [Node] ~ { cell: Object _ NARROW[CoreProperties.GetCellTypeProp[cellType, Sinix.layoutProp]]; RETURN[CreateNode[PutOnGrid[PW.GetLocation[inst, cell]], wire, cellType]]; }; OtherEndOnGrid: PROC [inst: Instance, cellType: CellType, wire: Wire] RETURNS [Node] ~ { rect: CD.Rect _ CDInstances.InstRectI[inst]; cell: Object _ NARROW[CoreProperties.GetCellTypeProp[cellType, Sinix.layoutProp]]; pos2: CD.Position _ PutOnGrid[CDBasics.AddPoints[ PW.GetLocation[inst, cell], CDBasics.SizeOfRect[rect]]]; RETURN[CreateNode[pos2, wire, cellType]]; }; ToColor: PROC [cdLayer: Layer] RETURNS [color: Color] ~ {color _ CD.LayerKey[cdLayer];}; InitTechno: PROC [techno: Techno] ~ { lambda _ techno.lambda; grid _ 4*lambda; }; HighLightInstance: PROC [cell: CD.Object, inst: CD.Instance, msg: ROPE _ NIL] = { cellPtr: CD.CellPtr _ NARROW [cell.specificRef]; hinst: CD.Instance _ NEW [CD.InstanceRep _ [ ob: CDRects.CreateRect[inst.ob.size, CD.highLightShade], location: inst.location, orientation: inst.orientation]]; CDProperties.PutPropOnInstance[hinst, $SignalName, msg]; cellPtr.contents _ CONS [hinst, cellPtr.contents]; }; [] _ CDProperties.RegisterProperty[stickWidthProp, $Stix]; CDProperties.InstallProcs[prop: stickWidthProp, new: [makeCopy: CDProperties.CopyVal]]; [] _ CDProperties.RegisterProperty[stickLengthProp, $Stix]; CDProperties.InstallProcs[prop: stickLengthProp, new: [makeCopy: CDProperties.CopyVal]]; END. (StixParserImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Louis Monier December 6, 1985 2:28:13 pm PST Input procedure -- The proc uses Sinix to create a new celltype decorated with CD geometry, translate every Instance into a StickPtr (or several) and decorates the celltype with these StickPtrs. -- Put the properties on generic contacts and transistors for Sinix -- Get a decorated CellType from Sinix -- Get the input technology (useless!) -- Decorate the CellType with the corresponding StickPtrs -- Finish it -- Decorate the CellType with the corresponding StickPtrs -- maybe I just ignore since the pins also appear on the internal wire -- Create a new symbolic (empty) cell, and bind it to the CellType -- Translate every CD.Instance into a StickPtr (and bind it ?) -- Binds the StickPtr corresponding to the instance to the wire -- Inserts three wires to make the transistor stretchable [actualWire: Core.Wire, publicWire: Core.Wire] RETURNS [subWires: BOOL _ TRUE, quit: BOOL _ FALSE] -- Create the three private and three public nodes . . . -- and the objects defined with respect to these nodes -- Bind the Stix transistor corresponding to the transistor or subcell to the CellInstance Symbolic input conventions -- for positions: target lambda = (source int/grid) (see Chubby) -- for width: target lambda = source int (which the user should think of as target lambda) -- The following procs define the input accepted by the parser -- Decorates the special objects (symbolic transistors and contacts) for Sinix's use. Must be done after the interactive edition (which might include an IO to file which would destroy these properties) but before any extraction -- look for special objects -- Nearest point on the grid, e.g. divide coords by stickGrid(=32) and round; the result is thus expressed in target lambda. -- Later this numbers will be multiplied by a large constant to make sure that we always do a compaction, not a stretch; it does not cost anything and makes things simpler; Layers -- used when inputing stick representation from any decent technology -- simply return the atom associated with the layer Accessing the source technology HighLighting errors utilities (should be exported by Sinix) -- put msg as a InstanceName of hinst so it can be read by selecting it Initialization Κ Z˜šœ™Icodešœ Οmœ1™™>Kšœ5  ˜@Kšœ= ˜Pšžœžœžœž ˜4Kšœ˜Kšœ ˜ KšœžœC˜PKšœ.˜.Kšžœ˜—K˜—K˜š’œžœ-˜DKšœ'˜'Kšœžœ ˜)K˜—K˜Kšœ?™?š’œžœ5˜Lšœžœžœž˜%Kšœ=˜=Kšœ7˜7Kšžœžœ @˜P—Kšžœ žœžœžœ˜Kšœ˜Kšœ&˜&K˜—K˜š’œžœ2žœ˜hšœ˜Kšœ*˜*—K˜—š’ œžœ2žœ˜eKšœžœ;˜Cšœ˜Kšœ(˜(Kšœ*˜*Kšœ˜Kšœžœžœžœžœžœžœžœ˜5—K˜—Kšœ:™:š’œžœ=˜V•StartOfExpansionf -- [actualWire: Core.Wire, publicWire: Core.Wire] RETURNS [subWires: BOOL _ TRUE, quit: BOOL _ FALSE]š’œ˜2KšΠckb™bKšœ˜Kšœ˜Kšœ žœ˜Kšœ ˜ Kšœžœ˜Kšžœžœžœ ˜@KšœžœM˜YKšœ)˜)šœžœžœžœ ˜-Kšœ!˜!Kšœ ˜ Kšœ ˜ Kšžœžœ˜—KšœZ˜ZKšœžœ7˜UKšœ8žœ˜>KšœF˜FKšœ&˜&Kšœ'˜'Kšœ˜—Kšœ˜Kšœžœ>˜Sšœžœžœž˜Kšœ˜Kšœ˜Kšžœžœ @˜P—Kšœ žœžœ%˜?Kšœ žœžœ˜K™8KšœW˜WK™6šœ˜Kšœ4˜4Kšœ˜Kšœ%˜%Kšœ'˜'—KšœZ™ZKšœ˜Kšœ#˜#K˜—š ’œžœžœžœžœ˜;Kšœžœ1˜9Kšžœžœžœžœžœžœžœžœ˜6K˜——š‘™Jšœ"  œ ™@Jšœ .œ  ™ZJšœ ž œ˜)Jšœž œ˜*Jšœž œ˜*K˜Kšœžœžœ˜.Kšœžœžœ˜0K˜Kšœžœ ˜+Kšœžœ G˜SK˜K™>š’œžœžœžœ˜,Kšžœžœ˜3—š’ œžœžœžœ˜/Kšžœ ˜&—š’œžœžœžœ˜+Kšžœ$˜*—š’œžœžœžœ˜+Kšžœ$˜*—š’ œžœžœžœ˜2Kšžœ žœ ˜ —š ’ œžœžœžœžœ˜=šžœžœ˜Kšœ žœžœ˜<——K™Kš’œžœžœ˜7K™K™γš’œžœ˜)Kšœžœžœ˜GKšœžœ˜š’ œžœ˜/š’ œ&˜0Kšœžœ#˜-šœžœžœžœž˜Kšœ˜Kšœ˜Kšœ˜Kšžœžœ˜—Kšœžœ˜ KšœC˜CKšœ˜—Kšœ<˜šœ8˜8Kšžœ)˜,—šœ6˜6Kšžœ)˜,—Kšœ˜—šœ @˜Ošžœžœžœ˜Kšœ1˜1Kšœ˜—KšœB˜B—šœ˜šžœžœžœ˜Kšœ1˜1Kšœ˜—KšœB˜B—Kšžœžœ˜—Kšžœ˜—K˜—K˜K™Kšœ|™|Kšœ­™­š ’ œžœžœ žœ žœ˜EKš ˜Kš ’œžœžœžœžœžœ˜FKšœ*˜*—š’ œžœ2žœ ˜VKšœžœ>˜SKšžœžœ,˜JK˜—š’œžœ2žœ ˜XKšœžœ$˜,Kšœžœ=˜Ršœžœ)˜1Kšžœ˜Kšœ˜—Kšžœ#˜)K˜——š‘™K™EK™3Kš’œžœžœžœ˜XK™—š‘™š’ œžœ˜%Kšœ˜Kšœ˜J˜——š‘Πls™;š ’œžœžœžœžœžœ˜QJšœ žœ žœ˜0šœžœ žœžœ˜,Jšœ&žœ˜:Jšœ9˜9—JšœG™GJšœ8˜8Jšœžœ˜2J˜——š‘™Kšœ:˜:KšœW˜WKšœ;˜;KšœX˜X—˜Kšžœ˜K˜——…—"l5ξ