IFUSrcFetchControler.mesa
Copyright c 1986 by Xerox Corporation. All rights reserved.
Last Edited by Curry, July 23, 1986 4:07:43 pm PDT
DIRECTORY CCDUtils, CDOrient, Core, CoreBlock, CoreFrame, CoreGlue, CoreName, CoreXform, IFUSrc, IFUCoreCtl, IFUCoreData, IFUCoreDrive;
IFUSrcFetchControler: CEDAR PROGRAM
IMPORTS CCDUtils, CoreFrame, CoreGlue, CoreName, CoreXform, IFUCoreData, IFUCoreCtl, IFUCoreDrive
EXPORTS IFUSrc =
BEGIN
ROPE:    TYPE = Core.ROPE;
CellType:   TYPE = Core.CellType;
Signal:   SIGNAL = CODE;
xForm:   CoreXform.Xform ← CoreXform.GenXform[ LIST[ [5, 0] ] ];
GND:    ROPE ← CoreName.RopeNm["GND"];
VDD:    ROPE ← CoreName.RopeNm["VDD"];
pcBus:   ROPE = "(NIL NIL NIL PCBus.36 PCBus.37)";
opLength:  ROPE = "(NIL NIL OpLengthAB.0 OpLengthAB.1 OpLengthAB.2)";
fetchWtAB01: ROPE = "(NIL FetchWtAB.0 FetchWtAB.1 NIL NIL)";
fetchRdBA03: ROPE = "(NIL FetchRdBA.0 FetchRdBA.1 FetchRdBA.2 FetchRdBA.3)";
WtAdder: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpAdderSerial",
name:  "WtAdder",
top:  NIL,
in:   "(
WtAB.
(GND  GND  VDD  GND  GND)
(WtCry.1 WtCry.2 WtCry.3 WtCry.4 GND) )",
out:  "( WtSumB. NIL (NIL WtCry.1 WtCry.2 WtCry.3 WtCry.4) )",
bot:  WtMuxTop,
xform:  xForm ]};
WtMuxTop: LIST OF REF = LIST[
"WtAB.",
NIL,
NIL,
NIL,
"WtSumB." ];
WtMux: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "WtMux",
top:  WtMuxTop,
right:  "(FetchWtIndexCtlHoldBA FetchWtIndexCtlIncBA FetchWtIndexCtlClearBA)",
in:   "(WtAB.   WtSumB.   GND)",
out:  "(WtB.)",
bot:  WtLatchBTop,
xform:  xForm ]};
WtLatchBTop: LIST OF REF = LIST[
"WtAB.",
NIL,
NIL,
NIL,
NIL,
"WtB." ];
WtLatchB: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpLatch",
name:  "WtLatchB",
top:  WtLatchBTop,
right:  "(PhB VBB)",
in:   "(WtB.)",
out:  "(WtBA.)",
bot:  WtLatchATop,
xform:  xForm ]};
WtLatchATop: LIST OF REF = LIST[
"WtAB.",
"WtBA."];
WtLatchA: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpLatch",
name:  "WtLatchA",
top:  WtLatchATop,
right:  "(PhA VBB)",
in:   "(WtBA.)",
out:  "(WtAB.)",
bot:  WtLatchABot,
xform:  xForm ]};
WtLatchABot: LIST OF REF = LIST[
"WtAB.",
"WtBA."];
FetchWtAB01 ← WtAB12
RdAdderTop: LIST OF REF = LIST[
fetchWtAB01,
"WtBA."];
RdAdder: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpAdderSerial",
name:  "RdAdder",
top:  RdAdderTop,
in:   "(
RdAB.
(GND  GND  OpLengthAB.0 OpLengthAB.1 OpLengthAB.2)
(RdCry.1 RdCry.2 RdCry.3 RdCry.4 GND) )",
out:  "( RdSumB. NIL (NIL RdCry.1 RdCry.2 RdCry.3 RdCry.4) )",
bot:  RdMuxTop,
xform:  xForm ]};
RdMuxTop: LIST OF REF = LIST[
fetchWtAB01,
"WtBA.",
opLength,
"RdSumB.",
NIL,
"RdAB."];
RdMux: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "Mux",
name:  "RdMux",
top:  RdMuxTop,
right:  "(
NextMacroJumpBA
NextMacroHoldBA
NextMacroGetBA)",
in:   "(
(GND GND  GND    PCBus.36   PCBus.37)
(GND GND OpLengthAB.0 OpLengthAB.1 OpLengthAB.2)
RdSumB. ) ",
out:  "(RdB.)",
bot:  RdLatchBTop,
xform:  xForm ]};
RdLatchBTop: LIST OF REF = LIST[
fetchWtAB01,
"WtBA.",
opLength,
pcBus,
"RdB.",
"RdAB."];
RdLatchB: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpLatch",
name:  "RdLatchB",
top:  RdLatchBTop,
right:  "(PhB VBB)",
in:   "(RdB.)",
out:  "(RdBA.)",
bot:  RdLatchATop,
xform:  xForm ]};
RdLatchATop: LIST OF REF = LIST[
fetchWtAB01,
"WtBA.",
opLength,
pcBus,
"RdBA.",
"RdAB."];
RdLatchA: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpLatch",
name:  "RdLatchA",
top:  RdLatchATop,
right:  "(PhA VBB)",
in:   "(RdBA.)",
out:  "(RdAB.)",
bot:  RdInvertTop,
xform:  xForm ]};
RdInvertTop: LIST OF REF = LIST[
fetchWtAB01,
"WtBA.",
opLength,
pcBus,
"RdBA." ];
RdInvert: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpInv",
name:  "RdInvert",
top:  RdInvertTop,
in:   "(RdBA.)",
out:  "(NotRdBA.)",
bot:  RdInvertBot,
xform:  xForm ]};
RdInvertBot: LIST OF REF = LIST[
fetchWtAB01,
"WtBA.",
opLength,
pcBus,
"RdBA.",
"NotRdBA." ];
FetchRdBA03 ← RdBA14
DiffAdderTop: LIST OF REF = LIST[
fetchWtAB01,
"WtBA.",
opLength,
pcBus,
fetchRdBA03,
"NotRdBA." ];
DiffAdder: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpAdderSerial",
name:  "DiffAdder",
top:  DiffAdderTop,
in:   "( WtBA. NotRdBA.
(FetchDiffCry.1 FetchDiffCry.2 FetchDiffCry.3 FetchDiffCry.4 GND) )",
out:  "( FetchBytesM1A. NIL
(NIL    FetchDiffCry.1 FetchDiffCry.2 FetchDiffCry.3 FetchDiffCry.4) )",
bot:  DiffLatchBTop,
xform:  xForm ]};
DiffLatchBTop: LIST OF REF = LIST[
fetchWtAB01,
NIL,
opLength,
pcBus,
fetchRdBA03,
"FetchBytesM1A." ];
DiffLatchA: PROC RETURNS [cellType: CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "GPRow",
type:   "DpLatch",
name:  "DiffLatchA",
top:  DiffLatchBTop,
right:  "(PhA VBB)",
in:   "(FetchBytesM1A.)",
out:  "(FetchBytesM1AB.)",
bot:  DiffLatchABot,
xform:  xForm ]};
DiffLatchABot: LIST OF REF = LIST[
fetchWtAB01,
NIL,
opLength,
pcBus,
fetchRdBA03,
"FetchBytesM1AB." ];
FetchIndexingData: PROC RETURNS[cellType: Core.CellType] = {
name: ROPE ← CoreName.RopeNm["IFUFetchIndexingData"];
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:  "FetchIndexingMain",
rec:  [first: top, orient: CDOrient.rotate270X], -- adder carry at bottom
cells: LIST[
WtAdder[],
WtMux[],
WtLatchB[],
WtLatchA[],
RdAdder[],
RdMux[],
RdLatchB[],
RdLatchA[],
RdInvert[],
DiffAdder[],
DiffLatchA[] ] ];
cellType ← CoreFrame.NewFrameCells[name: name, rec: [first: top], cells: LIST[
CoreGlue.CellProc[],
cellType,
CoreGlue.CellProc[l: chan, t: conn, r: sum, lCell: leftRouting] ]];
CoreFrame.WriteFrameCache[cellType]} };
FetchIndexing: PUBLIC PROC RETURNS[cellType: Core.CellType] = {
cellType ← CoreFrame.NewFrameCells[name: "FetchIndexXFill", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn], FetchIndexingData[] ]] };
FetchControler: PUBLIC PROC [sIn: ROPE, altOut: ROPENIL]
RETURNS [cellType: Core.CellType, sOut: ROPE] = {
name:   ROPE ← CoreName.RopeNm["IFUFetchControler"];
IF (cellType ← CoreFrame.ReadFrameCache[name])=NIL THEN {
PLAD:   TYPE = IFUCoreCtl.PLADescriptionRec;
FetchSection: TYPE = {pre, ctl, idx, wt, rd};
plaDscs:  ARRAY FetchSection OF IFUCoreCtl.PLADescription ← [
rd:  NEW[PLAD ← [name: "IFUPLAFetchRdDecode", plaPhs: [BA, B, BAA, B, Ac] ]],
wt: NEW[PLAD ← [name: "IFUPLAFetchWtDecode", plaPhs: [AB, A, ABB, A, Bc] ]],
idx: NIL,
ctl: NEW[PLAD ← [name: "IFUPLAFetchControl",  plaPhs: [BA, A, AB,  B, BA] ]],
pre: NEW[PLAD ← [name: "IFUPLAFetchPreDecode", plaPhs: [AB, A, ABB, A, AB] ]] ];
plaDscs[ctl].nofOrCols ← 0; plaDscs[ctl].nofTermCols ← 2;
plaDscs[pre].nofOrCols ← 0; plaDscs[pre].nofTermCols ← 2;
sOut ← sIn;
FOR p: FetchSection IN FetchSection DO
OPEN DR: IFUCoreDrive;
drs: IFUCoreDrive.Drives;
dr:  IFUCoreDrive.Drive;
IF plaDscs[p]=NIL THEN LOOP;
plaDscs[p].inSh ← sOut;
plaDscs[p].plaType ← hot;
IFUCoreCtl.MakePLA1[plaDscs[p]];
IF p=ctl THEN {
drs ← plaDscs[p].inDrs;
dr←DR.FindDrive[drs, "JumpPendingBA"];   dr.in.ph ← AB;
dr←DR.FindDrive[drs, "FetchingBA"];    dr.in.ph ← AB;
dr←DR.FindDrive[drs, "FetchBytesM1BA.4"]; dr.in.ph ← AB;
dr←DR.FindDrive[drs, "FetchBytesM1BA.3"]; dr.in.ph ← AB;
dr←DR.FindDrive[drs, "FetchBytesM1BA.2"]; dr.in.ph ← AB;
dr←DR.FindDrive[drs, "FetchBytesM1BA.1"]; dr.in.ph ← AB;
dr←DR.FindDrive[drs, "FetchBytesM1BA.0"]; dr.in.ph ← AB;
dr←DR.FindDrive[drs, "IPFaultedBA"];    dr.in.ph ← AB;
drs ← plaDscs[p].outDrs;
dr←DR.FindDrive[drs, "JumpPendingBA"]; dr.ref.ph ← A; dr.out.ph ← AB;
dr←DR.FindDrive[drs, "FetchingBA"];   dr.ref.ph ← A; dr.out.ph ← AB;
dr←DR.FindDrive[drs, "IPFaultedBA"];   dr.ref.ph ← A; dr.out.ph ← AB};
IF p=pre THEN {
drs ← plaDscs[p].inDrs;
dr←DR.FindDrive[drs, "IPFaultingAB"];  dr.in.ph ← BA;
drs ← plaDscs[p].outDrs;
dr←DR.FindDrive[drs, "OpLengthbAB.0"]; dr.ref.ph ← B; dr.out.ph ← BA;
dr←DR.FindDrive[drs, "OpLengthbAB.1"]; dr.ref.ph ← B; dr.out.ph ← BA;
dr←DR.FindDrive[drs, "OpLengthbAB.2"]; dr.ref.ph ← B; dr.out.ph ← BA;
dr←DR.FindDrive[drs, "InstFault0AB"];  dr.ref.ph ← B; dr.out.ph ← BA};
IF altOut # NIL AND p=rd THEN {
list: IFUCoreDrive.Drives ← plaDscs[rd].outDrs;
FOR list ← list, list.rest WHILE list.rest#NIL DO ENDLOOP;
plaDscs[rd].outSh ← altOut; -- does this work?
list.first.outSh  ← altOut};
IFUCoreCtl.MakePLA2[plaDscs[p]];
sOut ← plaDscs[p].outSh;
ENDLOOP;
cellType ← CoreFrame.NewFrameCells[
name:  name,
rec:  [first: top],
cells:  LIST[
CoreFrame.NewFrameCells[name: "ExtendedFetchRdCtl", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ rd ]] ]],
CoreFrame.NewFrameCells[name: "ExtendedFetchWtCtl", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ wt ]] ]],
CoreFrame.NewFrameCells[name: "ExtendedFetchCtl",  rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ ctl ]] ]],
CoreFrame.NewFrameCells[name: "ExtendedFetchPreCtl", rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
IFUCoreCtl.CellProc[ complete, plaDscs[ pre ]] ]] ]];
IFUCoreDrive.SetDShiftIO[cellType, sIn, sOut];
CoreFrame.WriteFrameCache[cellType]};
[sIn, sOut] ← IFUCoreDrive.GetDShiftIO[cellType];
cellType ← CoreFrame.NewFrameCells[ name: "FetchControlerFillX", rec: [first: left], cells: LIST[ CoreGlue.CellProc[l: ext, r: conn], cellType ]]};
FetchControler: PUBLIC PROC [sIn: ROPE] RETURNS [cellType: Core.CellType, sOut: ROPE] = {
PLAD:   TYPE = IFUCoreCtl.PLADescriptionRec;
FetchSection: TYPE = {rd};
plaDscs:  ARRAY FetchSection OF IFUCoreCtl.PLADescription ← [
rd:  NEW[PLAD ← [name: "IFUPLAFetchRdDecode", plaPhs: [BA, B, BAA, B, Ac] ]] ];
inSh: ROPE ← "FetchControler.inSh";
FOR p: FetchSection IN FetchSection DO
IF plaDscs[p]=NIL THEN LOOP;
plaDscs[p].inSh ← inSh;
plaDscs[p].plaType ← static;
IFUCoreCtl.MakePLA[plaDscs[p]];
IFUCoreCtl.MakePLA[plaDscs[p]];
inSh ← plaDscs[p].outSh;
ENDLOOP;
cellType ← CoreFrame.NewFrameCells[
name:  "FetchControler",
rec:  [first: top],
cells:  LIST[ IFUCoreCtl.CellProc[complete, plaDscs[rd]] ] ] };
END.