IFUSrcStackControler.mesa
Copyright c 1986 by Xerox Corporation. All rights reserved.
Curry, July 9, 1986 11:01:56 am PDT
DIRECTORY CCDUtils, CDOrient, Core, CoreBlock, CoreFrame, CoreGlue, CoreName, CoreXform, IFUSrc, IFUCoreCtl, IFUCoreData, IFUCoreDrive, PLAOps, Rope;
IFUSrcStackControler: CEDAR PROGRAM
IMPORTS CCDUtils, CoreFrame, CoreGlue, CoreName, CoreXform, IFUCoreData, IFUCoreCtl, IFUCoreDrive, PLAOps, Rope
EXPORTS IFUSrc =
BEGIN
ROPE:   TYPE = Core.ROPE;
GND:   ROPE = CoreName.RopeNm["GND"];
VDD:   ROPE = CoreName.RopeNm["VDD"];
one:   ROPE = "(   GND GND GND GND VDD )";
xform:   CoreXform.Xform ← CoreXform.GenXform[LIST[ [5, 0] ]];
Signal:  SIGNAL = CODE;
LtArgForm: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "LtArgForm",
top:  NIL,
right:  "( StackAdjTosAB NotStackAdjTosAB )",
in:   "( TosBA. BosBA. )",
out:  "( LtArg. )",
bot:  SwitchInAddendTop,
xform:  xform ]};
SwitchInAddendTop: ROPE = "(  TosBA. BosBA. NIL NIL LtArg.  )";
SwitchInAddend: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "SwitchBox",
name:  "SwitchInAddend",
top:  SwitchInAddendTop,
right:  "( StackAddendIsOnesAB )",
bot:  AdderTop,
xform:  xform ]};
AdderTop: ROPE = "(  TosBA. BosBA. NIL NIL LtArg. StackAddendIsOnesAB  )";
Adder: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "Adder",
type:   "DpAdderSerial",
top:  AdderTop,
in:   "( LtArg. StackAddendIsOnesAB
(StackCryAB.1 StackCryAB.2 StackCryAB.3 StackCryAB.4 StackCarryIsOneAB) )",
out:  "( Sum. NIL
(NIL    StackCryAB.1 StackCryAB.2 StackCryAB.3 StackCryAB.4) )",
bot:  PreTosMuxTop,
xform:  xform ]};
PreTosMuxTop: ROPE = "(  TosBA. BosBA. NIL NIL Sum.  )";
PreTosMux: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "PreTosMux",
top:  PreTosMuxTop,
right:  "( StackAdjTosAB NotStackAdjTosAB )",
in:   "( Sum. TosBA. )",
out:  "( PreTosA. )",
bot:  PreBosMuxTop,
xform:  xform ]};
PreBosMuxTop: ROPE = "(TosBA. BosBA. NIL NIL Sum. NIL GND VDD PreTosA. NIL )";
PreBosMux: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "PreBosMux",
top:  PreBosMuxTop,
right:  "( StackAdjTosAB NotStackAdjTosAB )",
in:   "( BosBA. Sum. )",
out:  "( PreBosA. )",
bot:  TosMuxTop,
xform:  xform ]};
TosMuxTop: ROPE = "(TosBA. BosBA. NIL NIL NIL NIL GND VDD PreTosA. PreBosA. )";
TosMux: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "TosMux",
top:  TosMuxTop,
right:  "( ResetBA NotResetBA )",
in:   "( GND PreTosA. )",
out:  "( TosA. )",
bot:  BosMuxTop,
xform:  xform ]};
BosMuxTop: ROPE = "( TosBA. BosBA. NIL NIL TosA. NIL GND VDD NIL PreBosA.  )";
BosMux: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "BosMux",
top:  BosMuxTop,
right:  "( ResetBA NotResetBA )",
in:   LIST[one, "PreBosA."],
out:  "( BosA. )",
bot:  TosLatchATop,
xform:  xform ]};
TosLatchATop: ROPE = "(  TosBA. BosBA. NIL NIL TosA. BosA.  )";
TosLatchA: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "TosLatchA",
type:   "DpLatch",
top:  TosLatchATop,
right:  "( PhA VBB )",
in:   "( TosA. )",
out:  "( TosAB.  )",
bot:  BosLatchATop,
xform:  xform ]};
BosLatchATop: ROPE = "(  TosBA. BosBA. TosAB. NIL NIL BosA.  )";
BosLatchA: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "BosLatchA",
type:   "DpLatch",
top:  BosLatchATop,
right:  "( PhA VBB )",
in:   "( BosA. )",
out:  "( BosAB.  )",
bot:  BosInvTop,
xform:  xform ]};
BosInvTop: ROPE = "(  TosBA. BosBA. TosAB. BosAB.  )";
BosInv: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "BosInv",
type:   "DpInv",
top:  BosInvTop,
in:   "( BosAB. )",
out:  "( InvBosB.  )",
bot:  DiffTop,
xform:  xform ]};
DiffTop: ROPE = "(  TosBA. BosBA. TosAB. BosAB. InvBosB.  )";
Diff: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "Diff",
type:   "DpAdderSerial",
top:  DiffTop,
in:   "( TosAB. InvBosB.
(StackDiffCry.1 StackDiffCry.2 StackDiffCry.3 StackDiffCry.4 VDD) )",
out:  "( DiffB. NIL
(NIL   StackDiffCry.1 StackDiffCry.2 StackDiffCry.3 StackDiffCry.4) )",
bot:  DiffLatchBTop,
xform:  xform ]};
DiffLatchBTop: ROPE = "(  TosBA. BosBA. TosAB. BosAB. DiffB.  )";
DiffLatchB: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "DiffLatchB",
type:   "DpLatch",
top:  DiffLatchBTop,
right:  "( PhB VBB )",
in:   "( DiffB. )",
out:  "( StackDiffBA.  )",
bot:  TosLatchBTop,
xform:  xform ]};
TosLatchBTop: ROPE = "(  TosBA. BosBA. TosAB. BosAB. StackDiffBA.  )";
TosLatchB: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "TosLatchB",
type:   "DpLatch",
top:  TosLatchBTop,
right:  "( PhB VBB )",
in:   "( TosAB. )",
out:  "( TosBA.  )",
bot:  BosLatchBTop,
xform:  xform ]};
BosLatchBTop: ROPE = "(  TosBA. BosBA. NIL BosAB. StackDiffBA.  )";
BosLatchB: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
name:  "BosLatchB",
type:   "DpLatch",
top:  BosLatchBTop,
right:  "( PhB VBB )",
in:   "( BosAB. )",
out:  "( BosBA.  )",
bot:  BosLatchBBot,
xform:  xform ]};
BosLatchBBot: ROPE = "(  TosBA. BosBA. NIL NIL StackDiffBA.  )";
StackIndexingData: PROC RETURNS [cellType: Core.CellType] = {
name: ROPE ← CoreName.RopeNm["IFUStackIndexingData"];
IF (cellType ← CoreFrame.ReadFrameCache[name])=NIL THEN {
leftRouting: Core.CellType ← CoreGlue.ChanSideCell
[side: left, layer: CCDUtils.cmosMet, list: LIST["GND/50", "VDD/50"] ];
cellType ← CoreFrame.NewFrameCells[
name:  name,
rec:  [first: top, orient: CDOrient.rotate90],
cells: LIST[
LtArgForm[],
SwitchInAddend[],
Adder[],
PreTosMux[],
PreBosMux[],
TosMux[],
BosMux[],
TosLatchA[],
BosLatchA[],
BosInv[],
Diff[],
DiffLatchB[],
TosLatchB[],
BosLatchB[] ] ];
cellType ← CoreFrame.NewFrameCells[name: name, rec: [first: top], cells: LIST[
CoreGlue.CellProc[l: chan, b: conn, r: sum, lCell: leftRouting],
cellType ]];
CoreFrame.WriteFrameCache[cellType]} };
StackIndexing: PUBLIC PROC RETURNS[cellType: Core.CellType] = {
cellType ← CoreFrame.NewFrameCells[ name: "StackIndexXFill", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn], StackIndexingData[] ]] };
StackControler: PUBLIC PROC [sIn: ROPE, altOut: ROPENIL]
RETURNS [cellType: Core.CellType, sOut: ROPE] = {
name:    ROPE ← CoreName.RopeNm["IFUStackControler"];
IF altOut#NIL THEN Signal[];
IF (cellType ← CoreFrame.ReadFrameCache[name])=NIL THEN {
PLAD:    TYPE = IFUCoreCtl.PLADescriptionRec;
StackSection: TYPE = {bCnt, aCnt, decRd, decL, decP };
plaDscs:   ARRAY StackSection OF REF PLAD ← [
decP: NEW[PLAD ← [name: "IFUPLAStackDecodeWtP", plaPhs: [BA, B, BAA, B, Ac] ]],
decL: NEW[PLAD ← [name: "IFUPLAStackDecodeWtL", plaPhs: [BA, B, BAA, B, Ac] ]],
decRd: NEW[PLAD ← [name: "IFUPLAStackDecodeRd", plaPhs: [BA, B, BAA, B, Ac] ]],
aCnt: NEW[PLAD ← [name: "IFUPLAStackAControl", plaPhs: [BA, B, BAA, A, AB] ]],
bCnt: NEW[PLAD ← [name: "IFUPLAStackBControl", plaPhs: [AB, B, BAA, B, BA] ]] ];
sOut ← sIn;
plaDscs[bCnt].plaType   ← hot;
plaDscs[aCnt].plaType   ← hot;
plaDscs[decP].plaType   ← hot;
plaDscs[decL].plaType   ← hot;
plaDscs[decRd].plaType   ← hot;
plaDscs[decP].nofOrCols  ← 16;
plaDscs[decL].nofOrCols  ← 16;
plaDscs[decRd].nofOrCols  ← 16;
plaDscs[decP].capSides   ← top;
plaDscs[decL].capSides   ← none;
plaDscs[decRd].capSides  ← none;
FOR index: StackSection IN StackSection DO
OPEN DR: IFUCoreDrive;
dr: IFUCoreDrive.Drive;
plaDscs[index].ttt ← PLAOps.ReadPLAFile[plaDscs[index].name.Cat[".ttt"]];
plaDscs[index].inSh ← sOut;
plaDscs[index].includeIns ← index#decP AND index#decL;
IFUCoreCtl.MakePLA1[plaDscs[index]];
IF index=aCnt THEN {
dr ← DR.FindDrive[plaDscs[aCnt].outDrs, "StackAdjTosAB"];  dr.dualOut ← TRUE};
IF index=bCnt THEN {
dr ← DR.FindDrive[plaDscs[bCnt].inDrs, "StackDiffAB.0"];  dr.in.ph ← BA;
dr ← DR.FindDrive[plaDscs[bCnt].inDrs, "StackDiffAB.1"];  dr.in.ph ← BA;
dr ← DR.FindDrive[plaDscs[bCnt].inDrs, "StackDiffAB.2"];  dr.in.ph ← BA;
dr ← DR.FindDrive[plaDscs[bCnt].inDrs, "StackDiffAB.3"];  dr.in.ph ← BA;
dr ← DR.FindDrive[plaDscs[bCnt].inDrs, "StackDiffAB.4"];  dr.in.ph ← BA;
dr ← DR.FindDrive[plaDscs[bCnt].outDrs, "Push3BA"];   dr.dualOut ← TRUE};
IFUCoreCtl.MakePLA2[plaDscs[index]];
sOut ← plaDscs[index].outSh;
ENDLOOP;
cellType ← CoreFrame.NewFrameCells[name: name, rec:[first: top], cells:LIST[
CoreFrame.NewFrameCells[ name: "StackDecoder", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ outSec, plaDscs[ decP ]] ]],
CoreFrame.NewFrameCells[ name: "StackDecoder", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ outSec, plaDscs[ decL ]] ]],
CoreFrame.NewFrameCells[ name: "StackDecoder", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ decRd ]] ]],
CoreFrame.NewFrameCells[ name: "StackAControler", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ aCnt ]] ]],
CoreFrame.NewFrameCells[ name: "StackBControler", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ bCnt ]] ]] ]];
IFUCoreDrive.SetDShiftIO[cellType, sIn, sOut];
CoreFrame.WriteFrameCache[cellType]};
[sIn, sOut] ← IFUCoreDrive.GetDShiftIO[cellType];
cellType ← CoreFrame.NewFrameCells[ name: "StackControlerFillX", rec: [first: left], cells: LIST[ CoreGlue.CellProc[l: ext, r: conn], cellType ]]};
StackControler: PUBLIC PROC [sIn: ROPE] RETURNS [cellType: Core.CellType, sOut: ROPE] = {
PLAD:    TYPE = IFUCoreCtl.PLADescriptionRec;
StackSection: TYPE = {bCnt, aCnt};
plaDscs:   ARRAY StackSection OF REF PLAD ← [
aCnt: NEW[PLAD ← [name: "IFUPLAStackAControl", plaPhs: [BA, B, BAA, A, AB] ]],
bCnt: NEW[PLAD ← [name: "IFUPLAStackBControl", plaPhs: [BA, B, BAA, B, BA] ]] ];
sOutsIn;
plaDscs[bCnt].plaType   ← decoder;
plaDscs[aCnt].plaType   ← decoder;
plaDscs[bCnt].plaType   ← precharged;
plaDscs[aCnt].plaType   ← precharged;
FOR index: StackSection IN StackSection DO
plaDscs[index].ttt ← PLAOps.ReadPLAFile[plaDscs[index].name.Cat[".ttt"]];
plaDscs[index].inSh ← sOut;
IFUCoreCtl.MakePLA[plaDscs[index]];
sOut ← plaDscs[index].outSh;
ENDLOOP;
cellType ← CoreFrame.NewFrameCells[name:"StackControler", rec:[first: bottom], cells:LIST[
CoreFrame.NewFrameCells[ name: "StackBControler", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ bCnt ]] ]],
CoreFrame.NewFrameCells[ name: "StackAControler", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ aCnt ]] ]] ]]};
END.