IFUPLAFetchDecodeImpl:
CEDAR
PROGRAM
IMPORTS Commander, IO, PLAOps ~
BEGIN OPEN IFUPLAFetchDecode, PO: PLAOps;
FetchRdDecodePLA: PLAOps.PLA;
FetchWtDecodePLA: PLAOps.PLA;
FetchRdDecodeProc: PROC[argRec: FetchRdDecodeIn] RETURNS[resRec: FetchRdDecodeOut];
FetchWtDecodeProc: PROC[argRec: FetchWtDecodeIn] RETURNS[resRec: FetchWtDecodeOut];
GenFetchRdDecodePLA:
PROC = {
FOR fetchRd:
CARDINAL
IN [0..16)
DO
val: CARDINAL ← 1;
THROUGH [0..fetchRd) DO val ← val*2 ENDLOOP;
SetRd[m:[fetchRd: 15], d:[fetchRd: fetchRd], out:[fetchBufRdByte: val]];
ENDLOOP};
GenFetchWtDecodePLA:
PROC = {
FOR fetchWt:
CARDINAL
IN [0..4)
DO
val: CARDINAL ← 1;
THROUGH [0..fetchWt) DO val ← val*2 ENDLOOP;
SetWt[
m: [fetching: TRUE, fetchWt: 3],
d: [fetching:
TRUE, fetchWt: fetchWt],
out:[fetchBufWtWd: val]];
ENDLOOP};
BER:
PROC [m, d: FetchRdDecodeIn]
RETURNS[PLAOps.BoolExpr] = {
mRef: REF FetchRdDecodeIn ← NARROW[FetchRdDecodePLA.mask];
dRef: REF FetchRdDecodeIn ← NARROW[FetchRdDecodePLA.data];
mRef^ ← m; dRef^ ← d; RETURN[PLAOps.GetBEForDataMask[FetchRdDecodePLA]]};
BEW:
PROC [m, d: FetchWtDecodeIn]
RETURNS[PLAOps.BoolExpr] = {
mRef: REF FetchWtDecodeIn ← NARROW[FetchWtDecodePLA.mask];
dRef: REF FetchWtDecodeIn ← NARROW[FetchWtDecodePLA.data];
mRef^ ← m; dRef^ ← d; RETURN[PLAOps.GetBEForDataMask[FetchWtDecodePLA]]};
SetRd:
PROC [s: PLAOps.BoolExpr ←
NIL, m, d: FetchRdDecodeIn ←[], out: FetchRdDecodeOut]={
res: REF FetchRdDecodeOut ← NARROW[FetchRdDecodePLA.out];
IF s=
NIL
THEN s ← BER[m,d]
ELSE s ← PLAOps.And[s, BER[m,d] ];
res^ ← out; PLAOps.SetOutForBE[FetchRdDecodePLA, s]};
SetWt:
PROC [s: PLAOps.BoolExpr ←
NIL, m, d: FetchWtDecodeIn←[], out: FetchWtDecodeOut]={
res: REF FetchWtDecodeOut ← NARROW[FetchWtDecodePLA.out];
IF s=
NIL
THEN s ← BEW[m,d]
ELSE s ← PLAOps.And[s, BEW[m,d] ];
res^ ← out; PLAOps.SetOutForBE[FetchWtDecodePLA, s]};
GenFetchDecode: Commander.CommandProc = {
rdInType: IO.ROPE ← "IFUPLAFetchDecode.FetchRdDecodeIn";
wtInType: IO.ROPE ← "IFUPLAFetchDecode.FetchWtDecodeIn";
FetchRdDecodePLA ← PO.NewPLA[rdInType, "IFUPLAFetchDecode.FetchRdDecodeOut"];
FetchWtDecodePLA ← PO.NewPLA[wtInType, "IFUPLAFetchDecode.FetchWtDecodeOut"];
GenFetchRdDecodePLA [];
GenFetchWtDecodePLA [];
[] ←PO.ConvertTermListToCompleteSum[FetchRdDecodePLA.termList, FALSE,FALSE,cmd.out];
[] ←PO.ConvertTermListToCompleteSum[FetchWtDecodePLA.termList, FALSE,FALSE,cmd.out];
[] ←PO.FindAMinimalCover[FetchRdDecodePLA.termList, 120, cmd.out];
[] ←PO.FindAMinimalCover[FetchWtDecodePLA.termList, 120, cmd.out];
PO.WritePLAFile[ "IFUPLAFetchRdDecode.ttt", cmd.out, FetchRdDecodePLA];
PO.WritePLAFile[ "IFUPLAFetchWtDecode.ttt", cmd.out, FetchWtDecodePLA]};
Commander.Register[key:"GenFetchDecode", proc: GenFetchDecode];
END.