-- WireLengthAnalysis.mesa -- Last edited by McCreight, May 5, 1983 2:21 pm DIRECTORY DoradoBoard, IO USING [STREAM, Close, PutF, real, rope, CreateViewerStreams, SetIndex, PutChar], PriorityQueue USING [Ref, SortPred, Create, Empty, Insert, Remove], Real USING [Float, RoundLI, SqRt], Rope USING [ROPE]; WireLengthAnalysis: --CEDAR-- PROGRAM IMPORTS DoradoBoard, IO, PriorityQueue, Real = BEGIN OPEN DoradoBoard; LengthRecRef: TYPE = REF LengthRec; LengthRec: TYPE = RECORD[length: INT _ 0, canonPad: CARDINAL]; CompareLength: PriorityQueue.SortPred = TRUSTED BEGIN xl: LengthRecRef = NARROW[x]; yl: LengthRecRef = NARROW[y]; RETURN[xl.length>yl.length]; END; IntSquare: PROC [x: INT] RETURNS [INT] = INLINE {RETURN[x*x]}; Distance: PROC [first, second: Point] RETURNS [distance: INT] = INLINE {RETURN[IntSquare[second.x - first.x] + IntSquare[second.y - first.y]]}; Analyze: PROC [state: Board _ NIL] = BEGIN pq: PriorityQueue.Ref = PriorityQueue.Create[CompareLength]; s: IO.STREAM _ IO.CreateViewerStreams[name: "Net Length Analysis"].out; IF state=NIL THEN state _ DoradoBoard.board; FOR pad: CARDINAL IN [0..state.padCount) DO netLength: LengthRecRef = NEW[LengthRec _ [canonPad: pad]]; IF state.pads[pad].segs#NIL THEN BEGIN segs: REF SegTab = state.pads[pad].segs; s.PutChar['*]; FOR layer: WiringLayer IN WiringLayer DO IF segs.l[layer]#0 THEN BEGIN segCount: CARDINAL; state.asiFile.SetIndex[segs.l[layer]]; segCount _ GetCardinal[state]; FOR i: CARDINAL IN [0 ..segCount) DO start: Point = GetPoint[state]; end: Point = GetPoint[state]; netLength.length _ netLength.length+Real.RoundLI[Real.SqRt[Distance[start, end]]]; ENDLOOP; END; ENDLOOP; pq.Insert[item: netLength]; END; ENDLOOP; -- empty out priority queue into text viewer s.PutF["\n"]; WHILE NOT pq.Empty[] DO netLength: LengthRecRef = NARROW[pq.Remove[]]; IF netLength.length>0 THEN s.PutF[format: "%6g %s\n", v1: IO.real[Real.Float[netLength.length]/1000.], v2: IO.rope[state.pads[netLength.canonPad].segs.sigName]]; ENDLOOP; s.Close[]; END; -- of Analyze END. -- of WireLengthAnalysis -- CHANGE LOG Created by McCreight/Pier, May 5, 1983 11:48 am ʘJš¼ÏcLœÏk œžœžœžœUžœ9žœ!žœžœÏbœ œžœžœžœžœžœžœžœžœžœ žœžœ.žœžœžœžœ žœžœÏn œžœžœžœžœžœžœ  œžœžœ žœžœžœC œžœžœžœEžœžœžœ9žœžœžœžœžœžœžœžœ#žœžœžœžœ žœ;žœžœ žœ žœžœ žœžœbžœžœžœžœ¢žœ žœ žœ*žœžœœ-œžœžœ žœžœžœžœ(žœ7žœ9žœžœœžœœžœžœ2˜¹—…— < ß