DIRECTORY CD, CDCommandOps, CDInstances, CDOps, CDSequencer, Core, CoreClasses, CoreGeometry, CoreOps, IO, PW, RefTab, Rope, Sinix, SinixOps, TerminalIO, WireGeometry; WireGeometryImpl: CEDAR PROGRAM IMPORTS CDCommandOps, CDInstances, CoreClasses, CoreGeometry, CoreOps, IO, PW, RefTab, Rope, SinixOps, TerminalIO EXPORTS WireGeometry = BEGIN OPEN WireGeometry; InstanceList: TYPE = CD.InstanceList; ExtractAndShowPins: PROC [command: CDSequencer.Command] = { design: CD.Design = command.design; mode: Sinix.Mode = SinixOps.GetExtractMode[tech: design.technology]; root, cell: CellType; trans: CoreGeometry.Transformation; [root: root, cell: cell, trans: trans] _ SinixOps.SelectedCellType[design: design, mode: mode]; IF root # NIL THEN { cellName: ROPE = CoreOps.GetCellTypeName[cellType: cell]; wireName: ROPE = TerminalIO.RequestRope[prompt: "\nEnter name of public wire that pins are to be shown for: "]; wire: Wire = GetWire[cell: cell, name: wireName]; IF wire = NIL THEN TerminalIO.PutRopes[t1: cellName, t2: " contains no such wire.\n"] ELSE { AddCDInstance: EachInstanceProc = { instanceList _ CONS[CDInstances.NewInst[ob: instance.obj, trans: instance.trans], instanceList] }; instanceList: InstanceList _ NIL; [] _ CoreGeometry.EnumeratePins[decoration: mode.decoration, public: wire, eachInstance: AddCDInstance]; TerminalIO.PutF[format: "%g's geometry in %g contains %g pins.\n", v1: IO.rope[wireName], v2: IO.rope[cellName], v3: IO.int[CountCDInstances[instanceList: instanceList]]]; [] _ PW.Draw[obj: PW.CreateCell[instances: instanceList]] } } }; ExtractAndShowAllGeometry: PROC [command: CDSequencer.Command] = { design: CD.Design = command.design; mode: Sinix.Mode = SinixOps.GetExtractMode[tech: design.technology]; root, cell: CellType; trans: CoreGeometry.Transformation; [root: root, cell: cell, trans: trans] _ SinixOps.SelectedCellType[design: design, mode: mode]; IF root # NIL THEN { cellName: ROPE = CoreOps.GetCellTypeName[cellType: cell]; wireName: ROPE = TerminalIO.RequestRope[prompt: "\nEnter name of wire that geometry is to be shown for: "]; wire: Wire = GetWire[cell: cell, name: wireName]; IF wire = NIL THEN TerminalIO.PutRopes[t1: cellName, t2: " contains no such wire.\n"] ELSE { AddCDInstance: EachInstanceProc = { instanceList _ CONS[CDInstances.NewInst[ob: instance.obj, trans: instance.trans], instanceList] }; instanceList: InstanceList _ NIL; [] _ EnumerateAllGeometry[decoration: mode.decoration, cell: cell, wire: wire, eachInstance: AddCDInstance]; TerminalIO.PutF[format: "%g's geometry in %g contains %g instances.\n", v1: IO.rope[wireName], v2: IO.rope[cellName], v3: IO.int[CountCDInstances[instanceList: instanceList]]]; [] _ PW.Draw[obj: PW.CreateCell[instances: instanceList]] } } }; GetWire: PUBLIC PROC [cell: CellType, name: ROPE] RETURNS [wire: Wire _ NIL] = { IF NOT Rope.IsEmpty[name] THEN { index: INT = CoreOps.GetWireIndex[wire: cell.public, name: name]; IF index >= 0 THEN RETURN [cell.public[index]]; wire _ CoreOps.FindWire[root: cell.public, name: name]; IF wire = NIL AND cell.class = CoreClasses.recordCellClass THEN RETURN [CoreOps.FindWire[root: NARROW[cell.data, CoreClasses.RecordCellType].internal, name: name]] } }; CountCDInstances: PROC [instanceList: InstanceList] RETURNS [count: NAT _ 0] = { UNTIL instanceList = NIL DO count _ count + 1; instanceList _ instanceList.rest ENDLOOP }; EnumerateAllGeometry: PUBLIC PROC [decoration: Decoration, cell: CellType, wire: Wire, eachInstance: EachInstanceProc] RETURNS [quit: BOOL _ FALSE] = { SELECT cell.class FROM CoreClasses.recordCellClass => { recordCell: CoreClasses.RecordCellType = NARROW[cell.data]; quit _ CoreGeometry.EnumerateGeometry[decoration: decoration, wire: wire, eachInstance: eachInstance]; FOR i: NAT IN [0..recordCell.size) UNTIL quit = TRUE DO EnumerateSubInstances: CoreOps.EachWirePairProc = { EachTransSubInstance: EachInstanceProc = { RETURN [eachInstance[instance: CoreGeometry.Transform[trans: trans, instance: instance]]] }; IF actualWire = wire THEN quit _ EnumerateAllGeometry[decoration: decoration, cell: instanceType, wire: publicWire, eachInstance: EachTransSubInstance] }; cellInstance: CoreClasses.CellInstance = recordCell[i]; instanceType: CellType = cellInstance.type; trans: CoreGeometry.Transformation = CoreGeometry.GetTrans[decoration: decoration, cellInstance: cellInstance]; quit _ CoreOps.VisitBinding[actual: cellInstance.actual, public: instanceType.public, eachWirePair: EnumerateSubInstances].quit ENDLOOP }; CoreClasses.transistorCellClass => quit _ CoreGeometry.EnumerateGeometry[decoration: decoration, wire: wire, eachInstance: eachInstance]; ENDCASE => { recastCell: CellType = CoreOps.Recast[me: cell]; wireTab: RefTab.Ref _ CoreOps.CreateBindingTable[wire1: cell.public, wire2: recastCell.public]; quit _ EnumerateAllGeometry[decoration: decoration, cell: recastCell, wire: NARROW[RefTab.Fetch[x: wireTab, key: wire].val], eachInstance: eachInstance] } }; GetAllGeometry: PUBLIC PROC [decoration: Decoration, cell: CellType, wire: Wire] RETURNS [geometry: Instances _ NIL] = { AddInstance: EachInstanceProc = { geometry _ CONS [instance, geometry] }; [] _ EnumerateAllGeometry[decoration: decoration, cell: cell, wire: wire, eachInstance: AddInstance]; }; CDCommandOps.RegisterWithMenu[ menu: $OtherProgramMenu, entry: "Extract and Show Pins", doc: "shows the pins of specified wire", proc: ExtractAndShowPins, key: $ExtractAndShowPins]; CDCommandOps.RegisterWithMenu[ menu: $OtherProgramMenu, entry: "Extract and Show All Geometry", doc: "shows all the geometry of specified wire", proc: ExtractAndShowAllGeometry, key: $ExtractAndShowAllGeometry] END. >WireGeometryImpl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Bruce Wagar, August 16, 1987 6:15:31 pm PDT Contains the implementation of the wire geometry programs. Command Procs Extracts selected object and displays the pins of specified public wire. Converts instance to a CD instance and tacks it onto instanceList. Extracts selected object and displays all the geometry of specified wire. Converts instance to a CD instance and tacks it onto instanceList. Main Routines Retrieves a wire with the corresponding name (short or full). Returns NIL if name = NIL or there is no such wire. Counts the number of CDInstances in instanceList. Takes a Core cell and a specified wire of that cell and enumerates all the instances that comprise that wire. Instances can be enumerated more than once. Enumerates next level instances. Applies eachInstance to the appropriate transformed subInstances. Takes a Core cell and a specified wire of that cell and returns a list of all the instances that comprise that wire. Tacks instance onto geometry. Initialization Κ2– "cedar" style˜codešœ™Kšœ<™˜c—K˜—K˜—K™—šŸœœœ œ ˜Pšœ1™1šœœ˜Kšœ˜Kšœ ˜ Kš˜—K˜—K™—š ŸœœœVœœœ˜—™ššœ ˜šœ ˜ Kšœ)œ ˜;Kšœf˜fš œœœœœ˜7šŸœ˜3™ šŸœ˜*™AKšœS˜YK˜——šœœ˜Kšœ}˜}—K˜——Kšœ7˜7Kšœ+˜+Kšœo˜oKšœ˜Kš˜—Kšœ˜—šœ"˜"Kšœf˜f—šœ˜ Kšœ0˜0Kšœ_˜_KšœLœF˜˜K˜——K˜—K˜—š Ÿœœœ6œœ˜x™tšŸ œ˜!šœ™Kšœ œ˜$Kšœ˜——Kšœe˜eK˜—K˜——™šœ˜Kšœ˜Kšœ˜Kšœ)˜)Kšœ˜Kšœ˜K˜—šœ˜Kšœ˜Kšœ'˜'Kšœ1˜1Kšœ!˜!Kšœ ˜ K˜——Kšœ˜—…— ˆ