DIRECTORY BasicTime USING [GMT, Now, Period], CD USING [CreateDrawRef, Design, DrawProc, DrawRef, Instance, InstanceList, Layer, Number, Object], CDCommandOps USING [CallWithResource], CDDirectory USING [Fetch, Name], CDEvents USING [EventProc, RegisterEventProc], CDInstances USING [NewInst], CDMenus USING [CreateEntry], CDMenuSpecials USING [SelectOneOf], CDOps USING [InstList, LayerName], CDProperties USING [GetDesignProp, GetObjectProp, PutDesignProp, RegisterProperty], CDSequencer USING [Command, CommandRec, ExecuteCommand, ImplementCommand], Core USING [CellType, Wire], CoreClasses USING [recordCellClass, RecordCellType], CoreGeometry, CoreOps USING [GetCellTypeName, PrintCellType], CoreProperties USING [GetProp], IO USING [int, noWhereStream, PutF, PutFR, PutFR1, rope, STREAM], PrincOpsUtils USING [], Process USING [priorityBackground, SetPriority], Rope USING [Cat, ROPE], Sinix USING [Extract, Mode], SinixCMos USING [extractAMode, extractBMode], SinixNMos USING [extractMode], Mayday USING [CheckDesignRules, coreInconsistent, DRV, DRVkey, ErrorRect], SymTab USING [Create, Delete, EachPairAction, Fetch, GetSize, Insert, Pairs, Ref], TerminalIO USING [WriteRope, WriteLn], ViewerIO USING [CreateViewerStreams], ViewerTools USING [FindExistingViewer, Viewer]; MaydayCommandImpl: CEDAR PROGRAM IMPORTS BasicTime, CD, CDCommandOps, CDDirectory, CDEvents, CDInstances, CDMenus, CDMenuSpecials, CDOps, CDProperties, CDSequencer, CoreClasses, CoreOps, CoreProperties, IO, Process, Rope, Sinix, SinixCMos, SinixNMos, TerminalIO, ViewerIO, ViewerTools, Mayday, SymTab ~ BEGIN debug: BOOL _ FALSE; -- to start debugging enter: _ MaydayCommandImpl.Debug[] timing: BOOL _ FALSE; -- turn off fast mouse failureReason: Rope.ROPE; failureTorch: REF ANY; dLog: IO.STREAM _ IO.noWhereStream; currentLambda: CD.Number; -- sorry for the hack instead of using the handle DRVSummary: TYPE = SymTab.Ref; Execute: PROC [comm: CDSequencer.Command] ~ BEGIN ENABLE Mayday.coreInconsistent [failureReason, failureTorch] => GOTO failure; violations: DRVSummary = SymTab.Create []; abort: REF BOOL _ NEW [BOOL _ FALSE]; ExtractAndCheck: PROC [comm: CDSequencer.Command] ~ BEGIN startTime1, startTime2, lapTime, stopTime: BasicTime.GMT; tech: Sinix.Mode; cdObjHint: ATOM _ $PWCoreLayout; SELECT comm.design.technology.key FROM $cmos => tech _ SinixCMos.extractAMode; $cmosB => tech _ SinixCMos.extractBMode; $nmos => tech _ SinixNMos.extractMode; ENDCASE => BEGIN TerminalIO.WriteRope [Rope.Cat ["The technology ", comm.design.technology.name, " is not implemented in Sinix or Mayday.\n"]]; RETURN END; FOR all: CD.InstanceList _ CDOps.InstList [comm.design], all.rest WHILE all # NIL DO IF all.first.selected THEN BEGIN TRUSTED {Process.SetPriority [Process.priorityBackground]}; startTime1 _ BasicTime.Now []; WITH Sinix.Extract [obj: all.first.ob, mode: tech].result SELECT FROM coreCell: Core.CellType => BEGIN lapTime _ BasicTime.Now []; IF debug THEN CoreOps.PrintCellType [coreCell, dLog]; startTime2 _ BasicTime.Now []; [] _ Mayday.CheckDesignRules [cell: coreCell, design: comm.design, abortFlag: abort, cdObjKey: cdObjHint, decoration: tech.decoration]; stopTime _ BasicTime.Now []; IF debug THEN BEGIN currentLambda _ comm.design.technology.lambda; VerifyObjects [comm.design, all.first.ob] END; IF timing THEN BEGIN TerminalIO.WriteRope [Rope.Cat ["\nElapsed time for extraction: ", TimeToRope [startTime1, lapTime]]]; TerminalIO.WriteRope [Rope.Cat [". Elapsed time for DRC: ", TimeToRope [startTime2, stopTime]]]; TerminalIO.WriteRope [Rope.Cat ["\nTotal elapsed time: ", TimeToRope [startTime1, stopTime], "\n"]] END; UpdateDRVDirectory [coreCell, violations] END; w: Core.Wire => NULL; ENDCASE => NULL END -- if selected ENDLOOP END; -- ExtractAndCheck TerminalIO.WriteRope ["Mayday.\n"]; CDProperties.PutDesignProp [comm.design, $MaydayCmdDir]; [] _ CDCommandOps.CallWithResource [ExtractAndCheck, comm, $Mayday, abort]; TerminalIO.WriteRope ["Mayday done.\n"]; IF (violations.GetSize[] > 0) THEN BEGIN TerminalIO.WriteRope ["Summary of design rule violations:\n"]; CDProperties.PutDesignProp [comm.design, $MaydayCmdDir, violations]; [] _ violations.Pairs [PrintDRVSummary] END; EXITS failure => BEGIN TerminalIO.WriteRope [failureReason]; TerminalIO.WriteRope [". Core structure inconsistent. Mayday aborted.\n"] END END; -- Execute List: PROC [comm: CDSequencer.Command] ~ BEGIN violations: DRVSummary = NARROW [CDProperties.GetDesignProp [comm.design, $MaydayCmdDir]]; abort: REF BOOL _ NEW [BOOL_FALSE]; ListDRV: PROC [comm: CDSequencer.Command] ~ BEGIN existsInCD: BOOL; drv: Mayday.DRV; cell: Rope.ROPE _ CDMenuSpecials.SelectOneOf [violations, "Cells with errors"]; IF (cell = NIL) THEN RETURN; -- no selection drv _ NARROW [SymTab.Fetch[violations, cell].val, Mayday.DRV]; FOR e: LIST OF Mayday.ErrorRect _ drv.places, e.rest WHILE e # NIL DO TerminalIO.WriteRope [e.first.msg]; TerminalIO.WriteLn; IF abort^ THEN ERROR ABORTED ENDLOOP; existsInCD _ CDDirectory.Fetch [comm.design, cell].found; IF NOT existsInCD THEN TerminalIO.WriteRope ["No ChipNDale correspondent found for this cell.\n"] ELSE BEGIN nestedCmd: CDSequencer.Command _ NEW [CDSequencer.CommandRec _ [key: $PushNamed, design: comm.design, data: cell, ref: comm.ref]]; TerminalIO.WriteRope ["Trying to push into ChipNDale correspondent for this cell. Pop out of current cell if it fails.\n"]; CDSequencer.ExecuteCommand [comm: nestedCmd, queue: dontQueue]; END END; -- ListDRV TerminalIO.WriteRope ["List design rule violations.\n"]; IF (violations = NIL) THEN TerminalIO.WriteRope ["None available.\n"] ELSE [] _ CDCommandOps.CallWithResource [ListDRV, comm, $Mayday, abort]; TerminalIO.WriteRope ["Design rule violations listed.\n"] END; -- List ListAll: PROC [comm: CDSequencer.Command] ~ BEGIN violations: DRVSummary = NARROW [CDProperties.GetDesignProp [comm.design, $MaydayCmdDir]]; abort: REF BOOL _ NEW [BOOL_FALSE]; PrintDRV: SymTab.EachPairAction ~ BEGIN drv: Mayday.DRV = NARROW [val]; TerminalIO.WriteRope [IO.PutFR ["cell %g, %g violations:\n", IO.rope [key], IO.int [drv.count]]]; FOR e: LIST OF Mayday.ErrorRect _ drv.places, e.rest WHILE e # NIL DO TerminalIO.WriteRope [e.first.msg]; TerminalIO.WriteLn; IF abort^ THEN ERROR ABORTED ENDLOOP; RETURN [abort^] END; -- PrintDRV ListDRV: PROC [comm: CDSequencer.Command] ~ BEGIN IF violations.Pairs [PrintDRV] THEN TerminalIO.WriteRope ["Aborted.\n"] END; -- ListDRV TerminalIO.WriteRope ["List all design rule violations.\n"]; IF (violations = NIL) THEN TerminalIO.WriteRope ["None available.\n"] ELSE [] _ CDCommandOps.CallWithResource [ListDRV, comm, $Mayday, abort]; TerminalIO.WriteRope ["All design rule violations listed.\n"] END; -- ListAll UpdateDRVDirectory: PROC [cell: Core.CellType, dir: DRVSummary] ~ BEGIN name: Rope.ROPE = CoreOps.GetCellTypeName[cell]; IF SymTab.Fetch[dir, name].found THEN RETURN; -- prune SELECT cell.class FROM CoreClasses.recordCellClass => BEGIN data: CoreClasses.RecordCellType = NARROW [cell.data]; drv: Mayday.DRV = NARROW [CoreProperties.GetProp [cell.properties, Mayday.DRVkey]]; FOR sub: NAT IN [0 .. data.size) DO UpdateDRVDirectory [data.instances[sub].type, dir] ENDLOOP; IF (drv # NIL) THEN [] _ dir.Insert [name, drv] END; ENDCASE => NULL END; -- UpdateDRVDirectory PrintDRVSummary: SymTab.EachPairAction ~ BEGIN drv: Mayday.DRV = NARROW [val]; TerminalIO.WriteRope [IO.PutFR ["cell %g: %g\n", IO.rope [key], IO.int [drv.count]]]; RETURN [FALSE] END; -- PrintDRVSummary InvalidateDRV: CDEvents.EventProc ~ BEGIN violations: DRVSummary = NARROW [CDProperties.GetDesignProp [design, $MaydayCmdDir]]; cellName: Rope.ROPE = CDDirectory.Name [NARROW [x, CD.Object]]; IF (violations # NIL) AND (cellName # NIL) THEN [] _ violations.Delete [cellName] END; -- InvalidateDRV VerifyRect: CD.DrawProc ~ BEGIN specialLayers: CD.Layer = 5; -- combined, highLightShade, highLightError, pinRepresentation IF (inst.ob.class.objectType = $Rect) AND (inst.ob.layer >= specialLayers) AND (CDProperties.GetObjectProp [inst.ob, $MaydaySeparationChecked] = NIL) THEN IO.PutF [stream: dLog, format: "Failed to check rectangle at [%g, %g] %l %g%l\n", v1: IO.int [pos.x / currentLambda], v2: IO.int [pos.y / currentLambda], v3: IO.rope ["b"], v4: IO.rope [CDOps.LayerName[inst.ob.layer]], v5: IO.rope ["B"]] END; -- VerifyRect VerifyObjects: PROC [design: CD.Design, obj: CD.Object] ~ BEGIN envelope: CD.Instance = CDInstances.NewInst [obj]; drawRef: CD.DrawRef _ CD.CreateDrawRef [[design: design]]; drawRef.drawChild _ VerifyRect; envelope.location _ [0, 0]; obj.class.drawMe [envelope, envelope.location, 0, drawRef] END; -- VerifyObjects TimeToRope: PROC [from, to: BasicTime.GMT] RETURNS [time: Rope.ROPE] ~ BEGIN tmp: Rope.ROPE; sec: INT = BasicTime.Period [from, to]; min: INT = sec / 60; h: INT = min / 60; tmp _ IO.PutFR1 [value: IO.int [h]]; time _ SELECT h FROM = 0 => "00", < 10 => Rope.Cat ["0", tmp], ENDCASE => tmp; tmp _ IO.PutFR1 [value: IO.int [min MOD 60]]; time _ Rope.Cat [time, ":", SELECT min FROM = 0 => "00", < 10 => Rope.Cat ["0", tmp], ENDCASE => tmp]; tmp _ IO.PutFR1 [value: IO.int [sec MOD 60]]; time _ Rope.Cat [time, ":", SELECT sec FROM = 0 => "00", < 10 => Rope.Cat ["0", tmp], ENDCASE => tmp] END; -- TimeToRope Debug: PROC ~ BEGIN viewer: ViewerTools.Viewer; dummy: IO.STREAM; debug _ TRUE; -- Get all in one viewer _ ViewerTools.FindExistingViewer ["Mayday debug"]; IF viewer # NIL THEN [in: dummy, out: dLog] _ ViewerIO.CreateViewerStreams ["Mayday debug", viewer] ELSE BEGIN viewer _ ViewerTools.FindExistingViewer ["Terminal"]; [in: dummy, out: dLog] _ ViewerIO.CreateViewerStreams ["Terminal", viewer] END END; -- Debug [] _ CDProperties.RegisterProperty [$MaydayCmdDir, $gbb]; CDSequencer.ImplementCommand [key: $MaydaySel, proc: Execute, queue: doQueue]; CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Extract & DRC (Sinix & Mayday)", key: $MaydaySel]; CDSequencer.ImplementCommand [key: $MaydayDir, proc: List, queue: doQueue]; CDMenus.CreateEntry [menu: $ProgramMenu, entry: "List Violations (Mayday)", key: $MaydayDir]; CDSequencer.ImplementCommand [key: $MaydayAll, proc: ListAll, queue: doQueue]; CDMenus.CreateEntry [menu: $ProgramMenu, entry: "List All Violations (Mayday)", key: $MaydayAll]; CDEvents.RegisterEventProc [proc: InvalidateDRV, event: $AfterCellReplacement]; CDEvents.RegisterEventProc [proc: InvalidateDRV, event: $AfterChange]; IF debug THEN Debug []; TerminalIO.WriteRope ["Mayday package loaded.\n"] END. VMaydayCommandImpl.mesa Copyright (C) 1985, 1986 by Xerox Corporation. All rights reserved. Written by gbb September 3, 1986 7:07:32 pm PDT gbb September 3, 1986 7:07:36 pm PDT Bertrand Serlet August 20, 1986 4:25:48 pm PDT Interface to ChipNDale. Called by ChipNDale upon activation of the command. Protected procedure. Called by ChipNDale upon activation of the command. Protected procedure. muss Variable sein nicht Konstante [Compiler]. IF (ISTYPE [comm.ref, CDVPrivate.VRef]) THEN BEGIN Display error messages in the layout. viewer: ViewerClasses.Viewer = NARROW [comm.ref, CDVPrivate.VRef].viewer; IF (viewer # NIL) THEN ViewerOps.PaintViewer [viewer, client, FALSE, $DrawInstanceNames] END Called by ChipNDale upon activation of the command. [key: Key, val: Val] RETURNS [quit: BOOL] Protected procedure. Enumerates the cell and puts the DesignRuleViolations in the directory. [key: Key, val: Val] RETURNS [quit: BOOL] [event: REF, design: CD.Design, x: REF] RETURNS [dont: BOOL _ FALSE] Deletes a cell from the table when the cell has been edited. violations is NIL if the design has not yet been checked by Mayday. [inst: Instance, pos: Position, orient: Orientation, pr: REF DrawInformation] Traverses the cell and reports undiscovered rectangles. Although the INT returned BasicTime.Period is the same as GMT and might hence be loopholed to use IO.time from Conversions, the latter uses BasicTime.Unpack which allows only values that give a valid date. For convenience in debugging. Call this procedure in the Interpreter. gbb March 25, 1986 10:39:05 am PST Changed labels of menu entries. gbb March 27, 1986 3:13:47 pm PST Added cosmetics to make it look more like Spinifex. changes to: DIRECTORY, IMPORTS, Execute, ExtractAndCheck (local of Execute), UpdateDRVDirectory, PrintDRVSummary, VerifyRect gbb March 30, 1986 3:17:31 pm PST Added cosmetics to make it look better than Spinifex. changes to: ListDRV (local of List), InvalidateDRV gbb June 9, 1986 6:09:27 pm PDT Tracked addition of a parameter in the call of Mayday changes to: ExtractAndCheck (local of Execute): new parameter technology (is not used). Κ {˜™J™DIcode™/K™$K™.K˜—Icode2šΟl™šΟk ˜ Kšœ žœžœ˜#Kšžœžœ[˜cKšœ žœ˜&Kšœ žœ˜ Kšœ žœ ˜.Kšœ žœ ˜Kšœžœ˜Kšœžœ˜#Kšœžœ˜"Kšœ žœA˜SKšœ žœ9˜JKšœžœ˜Kšœ žœ#˜4Kšœ ˜ Kšœžœ"˜/Kšœžœ ˜Kšžœžœ1žœ˜AKšœžœ˜Kšœžœ#˜0Kšœžœžœ˜Kšœžœ˜Kšœ žœ˜-Kšœ žœ˜Kšœžœ&žœ˜JKšœžœF˜RKšœ žœ˜&Kšœ žœ˜%Kšœ žœ˜/—LšΠlnœž ˜ Lšžœ žœ•žœ_˜‹šœž˜LšœžœžœΟcΟo˜MKšœžœžœ ˜,Kšœžœžœžœ˜1Kšœžœž œ˜#Kšœžœ  1˜KLšœ žœ˜šΟnœžœž˜1L™3Kšžœ:žœ ˜MKšœ*˜*Lš œžœžœžœžœžœ˜%unitš’œžœž˜9K™Kšœ5žœ˜9Kšœ˜Kšœ žœ˜ šžœž˜&Kšœ'˜'Kšœ(˜(Kšœ&˜&šžœž˜Kšœ~˜~Kšž˜Kšžœ˜——š žœžœ7žœžœž˜Tšžœžœž˜ Kšžœ4˜;Kšœ˜šž œ'ž ˜Ešœž˜ Kšœ˜Kšžœžœ(˜5Kšœ˜Kšœk˜‡Kšœ˜šžœžœž˜Kšœ.˜.Kšœ)˜)Kšž˜—šžœžœž˜Kšœf˜fKšœa˜aKšœc˜cKšž˜—Kšœ)˜)Kšžœ˜—Kšœžœ˜Kšžœž˜Kšžœ ˜——Jšž˜—Kšžœ ˜—Mšœ#˜#Kšœ8˜8KšœK˜KKšœ(˜(šžœžœž˜(Kšœ>˜>KšœD˜DKšœ'˜'Kšžœ˜—šž˜šœ ž˜Kšœ%˜%KšœI˜IKšž˜——Lšžœ  ˜—š’œžœž˜.K™3Kšœžœ;˜ZLš œžœžœžœžœžœ˜#š’œžœž˜1K™Kšœ žœžœ˜"šœ žœ@˜OKšœ.™.—Kš žœ žœžœžœ ˜,Kšœžœ-žœ˜>š žœžœžœ'žœžœž˜EJšœ8˜8Kšžœžœžœž˜Jšžœ˜—Kšœ9˜9šžœžœ ž˜KšœJ˜J—šžœž˜ Kšœ!žœ^˜‚Kšœ|˜|Kšœ?˜?šžœžœžœž™2K™%Kšœžœ$™IKšžœ žœžœ(žœ™XKšž™—Kšž˜—Kšžœ  ˜—Mšœ8˜8Kšžœžœžœ+˜EKšžœD˜HKšœ9˜9Kšžœ ˜ —š’œžœž˜1K™3Kšœžœ;˜ZLš œžœžœžœžœžœ˜#š’œž˜'Kšœžœžœ™)Kšœ žœžœ˜Kšœžœ%žœ žœ˜aš žœžœžœ'žœžœž˜EJšœ8˜8Kšžœžœžœž˜Jšžœ˜—Kšžœ ˜Kšžœ  ˜—š’œžœž˜1K™Kšžœžœ$˜GKšžœ  ˜—Mšœ<˜£ œžœ2™Kšœžœ6˜UKš œžœžœžœžœ ˜?Kš žœžœžœ žœžœ"˜QKšžœ ˜—š’ œžœ ž˜Kšœ9žœ™MKšœžœ  >˜[š žœ$žœ"žœCžœž˜šKš žœTžœ"žœ"žœžœ,žœ ˜νKšœ˜—Kšžœ  ˜—š ’ œžœ žœžœ ž˜?K™7Kšœ žœ&˜2Kšœ žœ žœ"˜:Kšœ˜Kšœ˜Jšœ:˜:Kšžœ  ˜—š ’ œžœžœžœ žœž˜LKšœ Πekœ £œ€œ%€£œ£ œ£œ1™ΝKšœ žœ˜Kšœžœ˜'Kšœžœ ˜Kšœžœ ˜Mšœžœžœ ˜$Kšœžœžœ+žœ˜NMšœžœžœ žœ˜-Kšœžœžœ+žœ ˜fMšœžœžœ žœ˜-Kšœžœžœ+žœ˜eKšžœ  ˜—š’œžœž˜K™EKšœ˜Kšœžœžœ˜Kšœžœ ˜Kšœ9˜9šžœ ž˜KšœN˜N—šžœž˜ Kšœ5˜5KšœJ˜JKšž˜—Kšžœ ˜ —Lšœ9˜9LšœN˜NKšœc˜cLšœK˜KKšœ]˜]LšœN˜NKšœa˜aLšœO˜OKšœF˜FLšžœžœ ˜Kšœ1˜1—Lšžœ˜™"K™—™!K™3Kšœ Οr,œ₯1™|—™!K™5Kšœ ₯œ₯ ™2—™K™5Kšœ ₯œ<™W—K™—…—(Ϊ<«