IFUPLAIFetchControl.mesa
Copyright c 1984 by Xerox Corporation. All rights reserved.
Last edited by Curry, November 20, 1984 5:25:03 pm PST
DIRECTORY
Commander,
Dragon,
DragOpsCross,
IFUPLA,
IO,
PLAOps;
IFUPLAIFetchControl: CEDAR PROGRAM
IMPORTS Commander, IO, PLAOps EXPORTS IFUPLA =
BEGIN OPEN IFUPLA, PO: PLAOps;
GenIFetchControlPLA: PUBLIC PROC = {
pBusFaultIsSig:  Dragon.PBusFaults ← LAST [Dragon.PBusFaults];
jump:    PO.BoolExpr ← BE[m:[jump:    TRUE], d:[jump:   TRUE ]];
getNext:   PO.BoolExpr ← BE[m:[getNext:   TRUE], d:[getNext:  TRUE ]];
hold:    PO.BoolExpr ← BE[m:[hold:    TRUE], d:[hold:   TRUE ]];
reject:    PO.BoolExpr ← BE[m:[reject:   TRUE], d:[reject:   TRUE ]];
jumping:   PO.BoolExpr ← BE[m:[jumping:   TRUE], d:[jumping:  TRUE ]];
jumpPending: PO.BoolExpr ← BE[m:[jumpPending: TRUE], d:[jumpPending: TRUE ]];
fetching:   PO.BoolExpr ← BE[m:[fetching:   TRUE], d:[fetching:  TRUE ]];
roomFor1:   PO.BoolExpr ← BE[m:[roomFor1:  TRUE], d:[roomFor1:  TRUE ]];
roomFor2:   PO.BoolExpr ← BE[m:[roomFor2:  TRUE], d:[roomFor2:  TRUE ]];
faulted:   PO.BoolExpr ← BE[m:[faulted:   TRUE], d:[faulted:  TRUE ]];
noFault:   PO.BoolExpr ← BE[m:[fault: pBusFaultIsSig],  d:[fault:   None ]];
offSet0:   PO.BoolExpr ← BE[m:[offSet: 3],  d:[offSet:   0  ]];
offSet1:   PO.BoolExpr ← BE[m:[offSet: 3],  d:[offSet:   1  ]];
offSet2:   PO.BoolExpr ← BE[m:[offSet: 3],  d:[offSet:   2  ]];
offSet3:   PO.BoolExpr ← BE[m:[offSet: 3],  d:[offSet:   3  ]];
opLen1:   PO.BoolExpr ← BE[m:[opLen: 7],  d:[opLen:   1  ]];
opLen2:   PO.BoolExpr ← BE[m:[opLen: 7],  d:[opLen:   2  ]];
opLen3:   PO.BoolExpr ← BE[m:[opLen: 7],  d:[opLen:   3  ]];
opLen5:   PO.BoolExpr ← BE[m:[opLen: 7],  d:[opLen:   5  ]];
Set[out:[jumpInProgress: TRUE],
s:PO.Or[
jump,
jumpPending,
PO.And[jumping, reject] ] ];
Set[out:[jumpPending: TRUE],
s:PO.Or[
PO.And[reject, jump],
PO.And[reject, jumpPending] ] ];
Set[out:[newFetch: TRUE],
s:PO.Or[
PO.And[PO.Not[reject], PO.Not[fetching], roomFor1],
PO.And[PO.Not[reject], roomFor2],
PO.And[PO.Not[reject], jump],
PO.And[PO.Not[reject], jumpPending] ] ];
Set[out:[faulted: TRUE],
s:PO.Or[
PO.And[faulted,    PO.Not[jump], PO.Not[jumpPending] ],
PO.And[PO.Not[noFault], PO.Not[jump], PO.Not[jumpPending] ] ] ];
Set[out:[incrPrefetch: TRUE],
s:PO.And[fetching, PO.Not[jump], PO.Not[jumpPending] ] ];
Set[out:[wt:[set0: TRUE]],
s:jump ];
Set[out:[wt:[inc0: TRUE]],
s:PO.Or[
PO.And[PO.Not[jump], PO.Not[fetching]],
PO.And[PO.Not[jump], reject] ] ];
Set[out:[wt:[inc1: TRUE]],
s:PO.And[fetching, PO.Not[jump], PO.Not[reject]] ];
Set[out:[rd:[inc0: TRUE]], s:PO.And[PO.Not[jump], PO.Not[getNext]] ];
Set[out:[rd:[inc1: TRUE]], s:PO.And[getNext,  opLen1 ]];
Set[out:[rd:[inc2: TRUE]], s:PO.And[getNext,  opLen2 ]];
Set[out:[rd:[inc3: TRUE]], s:PO.And[getNext,  opLen3 ]];
Set[out:[rd:[inc5: TRUE]], s:PO.And[getNext,  opLen5 ]];
Set[out:[rd:[set0: TRUE]], s:PO.And[jump,   offSet0 ]];
Set[out:[rd:[set1: TRUE]], s:PO.And[jump,   offSet1 ]];
Set[out:[rd:[set2: TRUE]], s:PO.And[jump,   offSet2 ]];
Set[out:[rd:[set3: TRUE]], s:PO.And[jump,   offSet3 ]];
};
BE: PROC [m, d: IFetchControlIn] RETURNS[PO.BoolExpr] = {
mRef:  REF IFetchControlIn ← NARROW[IFetchControlPLA.mask];
dRef:  REF IFetchControlIn ← NARROW[IFetchControlPLA.data];
mRef^ ← m; dRef^ ← d; RETURN[PO.GetBEForDataMask[IFetchControlPLA]]};
Set: PROC [s: PO.BoolExpr ← NIL, m, d: IFetchControlIn ← [ ], out: IFetchControlOut] = {
res: REF IFetchControlOut ← NARROW[IFetchControlPLA.out];
IF s=NIL
THEN s ←       BE[m,d]
ELSE s ←   PO.And[s, BE[m,d] ];
res^ ← out; PO.SetOutForBE[IFetchControlPLA, s]};
IFetchControlProc: PUBLIC PROC[argRec: IFetchControlIn]
RETURNS[resRec: IFetchControlOut] = {
arg: REF IFetchControlIn ← NARROW[IFetchControlPLA.data];
res: REF IFetchControlOut ← NARROW[IFetchControlPLA.out];
arg^ ← argRec; PO.GetOutForData[IFetchControlPLA]; resRec ← res^};
IFetchControlPLA:  PUBLIC PO.PLA;
GenIFetchControl: Commander.CommandProc = {
filename: IO.ROPEPO.DefaultCMDLine[cmd.commandLine, defaultFile];
IFetchControlPLA ← PO.NewPLA[inName: "IFUPLA.IFetchControlIn", outName: "IFUPLA.IFetchControlOut"];
GenIFetchControlPLA[];
PO.WritePLAFile[filename, cmd.out, IFetchControlPLA] };
ReadIFetchControl: Commander.CommandProc = {
IFetchControlPLA ← PO.ReadPLAFile[PO.DefaultCMDLine[cmd.commandLine, defaultFile], cmd.out] };
WriteIFetchControl: Commander.CommandProc = {PO.WritePLAFile
[PO.DefaultCMDLine[cmd.commandLine, defaultFile], cmd.out, IFetchControlPLA] };
defaultFile: IO.ROPE = "IFetchControl.pla";
doc:   IO.ROPE = "Expects the name of a pla file";
Commander.Register[key:"GenIFetchControl",  proc: GenIFetchControl, doc: doc];
Commander.Register[key:"ReadIFetchControl",  proc: ReadIFetchControl, doc: doc];
Commander.Register[key:"WriteIFetchControl",  proc: WriteIFetchControl, doc: doc];
END.