<> <> <> <> <> DIRECTORY CD, Onion, PGA144, PW, PWDescr, PWPins, Rope, TerminalIO; DemoDecoderPins: CEDAR PROGRAM IMPORTS Onion, PGA144, PW, PWDescr, PWPins, Rope, TerminalIO = BEGIN OPEN PW; FullDecoder: UserProc = { zero: Object _ Get[design, "zero"]; one: Object _ Get[design, "one"]; left: Object _ Get[design, "left"]; right: Object _ Get[design, "right"]; inverter: Object _ Get[design, "inverter"]; invLeft: Object _ Get[design, "invLeft"]; invRight: Object _ Get[design, "invRight"]; DecGen: PROC [n: INT] RETURNS [decoder: Object] = { subDecoder: Object; IF n=0 THEN RETURN[NIL]; subDecoder _ DecGen[n-1]; decoder _ AbutY[design, AbutX[design, ArrayY[design, zero, TwoToThe[n-1]], subDecoder], AbutX[design, ArrayY[design, one, TwoToThe[n-1]], subDecoder]]; }; RenamePadsProc: PWPins.RenameProc = { newRope _ SELECT TRUE FROM Rope.Match["*.dataIn", oldRope] => Rope.Substr[oldRope, 0, Rope.Size[oldRope]-7], Rope.Match["*.dataOut", oldRope] => Rope.Substr[oldRope, 0, Rope.Size[oldRope]-8], Rope.Match["*.enableWrite", oldRope] => "enableWrite", ENDCASE => oldRope; }; MakeRight: PROC [nb: INT] RETURNS [Object] = { list: LIST OF Object _ NIL; FOR i: INT IN [0 .. nb) DO Rename: PWPins.RenameProc = { newRope _ SELECT TRUE FROM Rope.Equal["Output", oldRope] => PWPins.Index["Out", i], ENDCASE => oldRope; }; list _ CONS[PWPins.RenamePins[design, right, Rename], list]; ENDLOOP; RETURN [AbutListY[design, list]]; }; MakeTop: PROC [nb: INT] RETURNS [top: Object] = { listOb: PW.ListOb _ NIL; FOR n: INT IN [0..nb) DO Rename: PWPins.RenameProc = { newRope _ SELECT TRUE FROM Rope.Equal["Input", oldRope] => PWPins.Index["In", n], ENDCASE => oldRope; }; listOb _ CONS[PWPins.RenamePins[design, inverter, Rename], listOb]; ENDLOOP; top _ AbutX[design, invLeft, AbutListX[design, listOb], invRight]; }; PadFrameProc: PROC [n: INT] RETURNS [padFrame: Object] = { padNames: LIST OF ROPE _ LIST["In", "Out", "Decode", "Precharge", "enableWrite"]; padDescr: PWDescr.Descriptor _ PWDescr.RopesToDescr[padNames]; p: INT = TwoToThe[n]; PWDescr.SetTypePad[padDescr, "Decode" , PGA144.Single[20], $In]; PWDescr.SetTypePad[padDescr, "enableWrite" , PGA144.Single[21], $In]; PWDescr.SetTypePad[padDescr, "Precharge" , PGA144.Single[22], $In]; PWDescr.SetTypePad[padDescr, "In", PGA144.Segment[74, n], $In]; PWDescr.SetTypePad[padDescr, "Out", PGA144.Segment[128, p], $IOTst]; RETURN [PGA144.MakePadFrame[design, padDescr, , TRUE]]; }; StopPins: PWPins.RenameProc = {newRope _ NIL}; inner, outer, result, array: CD.Object; layersParams: Onion.LayersParameters _ Onion.defaultLayersParameters; n: INT _ 0; WHILE n<1 DO n _ TerminalIO.RequestInt["How many bits in the decoder? "]; ENDLOOP; layersParams.wireExtendProc _ Onion.WireExtendPolToMetForPads; array _ AbutX[design, ArrayY[design, left, TwoToThe[n]], DecGen[n]]; array _ PWPins.RenamePins[design, array, StopPins]; inner _ AbutX[design, array, MakeRight[TwoToThe[n]]]; inner _ AbutY[design, inner, MakeTop[n]]; inner _ Onion.MakeInner[design, inner]; outer _ PGA144.MakeOuter[design, PadFrameProc[n], RenamePadsProc]; result _ Onion.LRSRoute[design, inner, outer, Onion.Center[inner, outer], layersParams].cell; RETURN [result]; }; Register[FullDecoder, "FullDecoder"]; END. <<>>