DIRECTORY CD, CDDirectory, CDProperties, CDRects, CDTexts, Core, CoreOps, CMosB, IO, PW, Sinix, Sisyph; WireIcons: CEDAR PROGRAM IMPORTS CDDirectory, CDProperties, CDRects, CDTexts, CoreOps, IO, PW, Sinix, Sisyph = BEGIN ROPE: TYPE = Core.ROPE; Wire: TYPE = Core.Wire; CellType: TYPE = Core.CellType; l: INT _ CMosB.lambda; font: CDTexts.CDFont _ CDTexts.MakeFont["Xerox/TiogaFonts/Helvetica8", 2]; MakeComposer: PROC [size: NAT] RETURNS [wire: Wire, obj: CD.Object] = { increment: INT _ SELECT TRUE FROM size<4 => 8, size<6 => 6, size<8 => 4, size<16 => 2, size<32 => 2, ENDCASE => 1; wire _ CoreOps.CreateWires[size: size]; obj _ PW.CreateEmptyCell[]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[increment*(size-1)*l+7*l/2, 7*l/2], CD.commentLayer], [0, l/2]]; Sinix.AddPinsProp[ Sisyph.sisyphMode, wire, PW.IncludeInCell[obj, CDRects.CreateRect[[l/2, l/2], CD.commentLayer], [increment*(size-1)*l/2+2*l, 4*l]] ]; FOR i: NAT IN [0 .. size) DO wire[i] _ CoreOps.CreateWire[]; Sinix.AddPinsProp[ Sisyph.sisyphMode, wire[i], PW.IncludeInCell[obj, CDRects.CreateRect[[l/2, l/2], CD.commentLayer], [increment*i*l+2*l, 0]] ]; ENDLOOP; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[l, l/2], CD.commentLayer], [3*l/2, 0]]; CDProperties.PutObjectProp[obj, $ComposerSize, NEW [INT _ size]]; CDProperties.PutObjectProp[obj, Sisyph.sisyphMode.extractProcProp, $WireIconsExtractComposer]; PW.RepositionCell[obj]; }; Composer: PW.UserProc = { name: ROPE; int: INT _ PW.RequestInt["Size of the composer? "]; IF int<1 THEN RETURN; name _ IO.PutFR[":Composer[%g].icon", IO.int[int]]; ob _ CDDirectory.Fetch[design, name].object; IF ob=NIL THEN { ob _ MakeComposer[NAT [int]].obj; [] _ CDDirectory.Include[design, ob, name]; }; }; ExtractComposer: Sinix.ExtractProc = { refNat: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $ComposerSize]]; size: NAT _ NAT [refNat^]; result _ MakeComposer[size].wire; }; MakeSlash: PROC [] RETURNS [obj: CD.Object] = { obj _ PW.CreateEmptyCell[]; FOR i: INT IN [0 .. 2*l+l/4) DO [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[l/4, l/4], CD.commentLayer], [i, 2*i]]; ENDLOOP; PW.RepositionCell[obj]; }; MakeBus: PROC [size: NAT, slash: CD.Object _ NIL] RETURNS [wire: Wire, obj: CD.Object] = { wire _ CoreOps.CreateWires[size: size]; obj _ PW.CreateEmptyCell[]; IF slash#NIL THEN [] _ PW.IncludeInCell[obj, slash, [l-l/4, 0]]; Sinix.AddPinsProp[ Sisyph.sisyphMode, wire, PW.IncludeInCell[obj, CDRects.CreateRect[[9*l/2, l/2], CD.commentLayer], [0, 2*l]] ]; FOR i: NAT IN [0 .. size) DO wire[i] _ CoreOps.CreateWire[]; ENDLOOP; [] _ PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [2*l, -3*l/4]]; CDProperties.PutObjectProp[obj, $BusSize, NEW [INT _ size]]; CDProperties.PutObjectProp[obj, Sisyph.sisyphMode.extractProcProp, $WireIconsExtractBus]; PW.SetInterestRect[obj, [9*l/2, 9*l/2]]; PW.RepositionCell[obj]; }; Bus: PW.UserProc = { slash: CD.Object; name: ROPE; int: INT _ PW.RequestInt["Size of the bus? "]; IF int<1 THEN RETURN; slash _ CDDirectory.Fetch[design, ":SlashForBusIcon"].object; IF slash=NIL THEN { slash _ MakeSlash[]; [] _ CDDirectory.Include[design, slash, ":SlashForBusIcon"]; }; name _ IO.PutFR[":Bus[%g].icon", IO.int[int]]; ob _ CDDirectory.Fetch[design, name].object; IF ob=NIL THEN { ob _ MakeBus[NAT [int], slash].obj; [] _ CDDirectory.Include[design, ob, name]; }; }; ExtractBus: Sinix.ExtractProc = { refNat: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $BusSize]]; size: NAT _ NAT [refNat^]; result _ MakeBus[size].wire; }; MakeExtractor: PROC [index, size: NAT] RETURNS [wire: Wire, obj: CD.Object] = { wire _ CoreOps.CreateWires[size: size]; FOR i: NAT IN [0 .. size) DO wire[i] _ CoreOps.CreateWire[] ENDLOOP; obj _ PW.CreateEmptyCell[]; Sinix.AddPinsProp[ Sisyph.sisyphMode, wire, PW.IncludeInCell[obj, CDRects.CreateRect[[9*l/2, l/2], CD.commentLayer], [0, 2*l]] ]; Sinix.AddPinsProp[ Sisyph.sisyphMode, wire[index], PW.IncludeInCell[obj, CDRects.CreateRect[[l/2, 3*l/2], CD.commentLayer], [2*l, 0]] ]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l/2]]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l]]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [19*l/8, 13*l/8]]; [] _ PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[index]], font], [5*l/2, -3*l/4]]; [] _ PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [5*l/2, 2*l]]; CDProperties.PutObjectProp[obj, $ExtractorIndex, NEW [INT _ index]]; CDProperties.PutObjectProp[obj, $ExtractorSize, NEW [INT _ size]]; CDProperties.PutObjectProp[obj, Sisyph.sisyphMode.extractProcProp, $WireIconsExtractExtractor]; PW.SetInterestRect[obj, [9*l/2, 7*l/2]]; PW.RepositionCell[obj]; }; Extractor: PW.UserProc = { name: ROPE; int: INT _ PW.RequestInt["Index of the extracted wire? "]; int2: INT _ PW.RequestInt["Size of the structured wire? "]; IF int<0 OR int2<1 OR int>=int2 THEN RETURN; name _ IO.PutFR[":Extractor[%g, %g].icon", IO.int[int], IO.int[int2]]; ob _ CDDirectory.Fetch[design, name].object; IF ob=NIL THEN { ob _ MakeExtractor[NAT [int], NAT [int2]].obj; [] _ CDDirectory.Include[design, ob, name]; }; }; ExtractExtractor: Sinix.ExtractProc = { refNat: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]]; refNat2: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]]; index: NAT _ NAT [refNat^]; size: NAT _ NAT [refNat2^]; result _ MakeExtractor[index, size].wire; }; MakeRangeExtractor: PROC [index, subSize, size: NAT] RETURNS [wire: Wire, obj: CD.Object] = { structWire: Wire _ CoreOps.CreateWires[size: size]; subWire: Wire _ CoreOps.CreateWires[size: subSize]; wire _ CoreOps.CreateWire[LIST [subWire, structWire]]; FOR i: NAT IN [0 .. size) DO structWire[i] _ CoreOps.CreateWire[] ENDLOOP; FOR i: NAT IN [0 .. subSize) DO subWire[i] _ structWire[i+index] ENDLOOP; obj _ PW.CreateEmptyCell[]; Sinix.AddPinsProp[ Sisyph.sisyphMode, structWire, PW.IncludeInCell[obj, CDRects.CreateRect[[19*l/2, l/2], CD.commentLayer], [0, 2*l]] ]; Sinix.AddPinsProp[ Sisyph.sisyphMode, subWire, PW.IncludeInCell[obj, CDRects.CreateRect[[l, 3*l/2], CD.commentLayer], [5*l/2, 0]] ]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l/2]]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l]]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]]; [] _ PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [27*l/8, 13*l/8]]; [] _ PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutFR["%g/%g", IO.int[index], IO.int[subSize]], font], [7*l/2, -3*l/4]]; [] _ PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [7*l/2, 2*l]]; CDProperties.PutObjectProp[obj, $ExtractorIndex, NEW [INT _ index]]; CDProperties.PutObjectProp[obj, $ExtractorSubSize, NEW [INT _ subSize]]; CDProperties.PutObjectProp[obj, $ExtractorSize, NEW [INT _ size]]; CDProperties.PutObjectProp[obj, Sisyph.sisyphMode.extractProcProp, $WireIconsExtractRangeExtractor]; PW.SetInterestRect[obj, [19*l/2, 7*l/2]]; PW.RepositionCell[obj]; }; RangeExtractor: PW.UserProc = { name: ROPE; int: INT _ PW.RequestInt["Index of the extracted wire? "]; int2: INT _ PW.RequestInt["Size of the extracted wire? "]; int3: INT _ PW.RequestInt["Size of the structured wire? "]; IF int<0 OR int2<1 OR int3<1 OR int>=int3 OR int+int2>int3 THEN RETURN; name _ IO.PutFR[":RangeExtractor[%g/%g, %g].icon", IO.int[int], IO.int[int2], IO.int[int3]]; ob _ CDDirectory.Fetch[design, name].object; IF ob=NIL THEN { ob _ MakeRangeExtractor[NAT [int], NAT [int2], NAT [int3]].obj; [] _ CDDirectory.Include[design, ob, name]; }; }; ExtractRangeExtractor: Sinix.ExtractProc = { refNat: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]]; refNat2: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $ExtractorSubSize]]; refNat3: REF INT _ NARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]]; index: NAT _ NAT [refNat^]; subSize: NAT _ NAT [refNat2^]; size: NAT _ NAT [refNat3^]; result _ MakeRangeExtractor[index, subSize, size].wire; }; PW.Register[Composer, "Composer"]; Sinix.RegisterExtractProc[$WireIconsExtractComposer, ExtractComposer]; PW.Register[Bus, "Bus"]; Sinix.RegisterExtractProc[$WireIconsExtractBus, ExtractBus]; PW.Register[Extractor, "Extractor"]; Sinix.RegisterExtractProc[$WireIconsExtractExtractor, ExtractExtractor]; PW.Register[RangeExtractor, "Range Extractor"]; Sinix.RegisterExtractProc[$WireIconsExtractRangeExtractor, ExtractRangeExtractor]; END. ’WireIcons.mesa Copyright c 1986 by Xerox Corporation. All rights reversed. Bertrand Serlet June 3, 1986 5:32:08 pm PDT Types and constants Composer icon The big rectangle The structured wire The composed wires The first composed wire Bus icon The slash (if not present, the resulting obj should NOT be used) The structured wire The composed wires The text Extractor icon The composed wires The structured wire The extracted wire The square The texts Range Extractor icon We create an extra level of hierarchy in the wires to extract things properly The composed wires The structured wire The extracted wire The rectangle The texts Initialization Κ m– "cedar" style˜codešœ™Kšœ Οmœ1™