DIRECTORY CD, CDCommandOps, CDInstances, CDSequencer, Core, CoreClasses, CoreGeometry, CoreOps, IO, PW, Rope, Sinix, SinixOps, TerminalIO; WireGeometryImpl: CEDAR PROGRAM IMPORTS CDCommandOps, CDInstances, CoreClasses, CoreGeometry, CoreOps, IO, PW, Rope, SinixOps, TerminalIO = BEGIN InstanceList: TYPE = CD.InstanceList; CellType: TYPE = Core.CellType; Wire: TYPE = Core.Wire; WireSeq: TYPE = Core.WireSeq; ROPE: TYPE = Rope.ROPE; Instance: TYPE = CoreGeometry.Instance; Instances: TYPE = CoreGeometry.Instances; Decoration: TYPE = CoreGeometry.Decoration; EachInstanceProc: TYPE = CoreGeometry.EachInstanceProc; 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; [] _ CoreGeometry.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 }; GetAllGeometry: PUBLIC PROC [decoration: Decoration, cell: CellType, wire: Wire] RETURNS [geometry: Instances _ NIL] = { AddInstance: EachInstanceProc = { geometry _ CONS [instance, geometry] }; [] _ CoreGeometry.EnumerateAllGeometry[decoration: decoration, cell: cell, wire: wire, eachInstance: AddInstance]; }; 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 Bertrand Serlet September 14, 1987 4:02:29 pm PDT Contains the implementation of the wire geometry programs. Command Procs 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 returns a list of all the instances that comprise that wire. Tacks instance onto geometry. Initialization Κγ– "cedar" style˜codešœ™Kšœ<™˜c—K˜—K˜—K™—šžœœœ œ ˜Pšœ1™1šœœ˜Kšœ˜Kšœ ˜ Kš˜—K˜—K™—š žœœœ6œœ˜x™tšž œ˜!šœ™Kšœ œ˜$Kšœ˜——Kšœr˜rK˜—K˜——™šœ˜Kšœ˜Kšœ'˜'Kšœ1˜1Kšœ!˜!Kšœ ˜ K˜——Kšœ˜—…— ˜a