DemoDecoderPins.mesa
Copyright © 1985 by Xerox Corporation. All rights reversed.
Created by: Bertrand Serlet, August 23, 1985 2:25:40 pm PDT
Bertrand Serlet February 10, 1986 9:33:11 pm PST
Louis Monier October 10, 1985 2:59:08 pm PDT
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[
AbutX[ArrayY[zero, TwoToThe[n-1]], subDecoder],
AbutX[ArrayY[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[right, Rename], list];
ENDLOOP;
RETURN [AbutListY[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[inverter, Rename], listOb];
ENDLOOP;
top ← AbutX[invLeft, AbutListX[listOb], invRight];
};
PadFrameProc: PROC [n: INT] RETURNS [padFrame: Object] = {
padNames: LIST OF ROPELIST["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[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[ArrayY[left, TwoToThe[n]], DecGen[n]];
array ← PWPins.RenamePins[array, StopPins];
inner ← AbutX[array, MakeRight[TwoToThe[n]]];
inner ← AbutY[inner, MakeTop[n]];
inner ← Onion.MakeInner[inner];
outer ← PGA144.MakeOuter[PadFrameProc[n], RenamePadsProc];
result ← Onion.LRSRoute[inner, outer, Onion.Center[inner, outer], layersParams].cell;
RETURN [result];
};
Register[FullDecoder, "FullDecoder"];
END.