IFUPLAFetchWtDecodeImpl:
CEDAR
PROGRAM
IMPORTS Commander, IFUPLAFetchWtDecode, IO, PLAOps ~
BEGIN OPEN IFUPLAFetchWtDecode;
GenFetchWtDecodePla:
PROC = {
FOR wtIndex:
CARDINAL
IN [0..4)
DO
val: CARDINAL ← 1;
THROUGH [0..wtIndex) DO val ← val*2 ENDLOOP;
Set[
m: [writing: TRUE, wtIndex: 3],
d: [writing:
TRUE, wtIndex: wtIndex],
out:[wtEnable: val]];
ENDLOOP};
BE:
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]]};
Set:
PROC [s: PLAOps.BoolExpr ←
NIL, m, d: FetchWtDecodeIn ← [ ], out: FetchWtDecodeOut] = {
res: REF FetchWtDecodeOut ← NARROW[FetchWtDecodePLA.out];
IF s=
NIL
THEN s ← BE[m,d]
ELSE s ← PLAOps.And[s, BE[m,d] ];
res^ ← out; PLAOps.SetOutForBE[FetchWtDecodePLA, s]};
GenFetchWtDecode: Commander.CommandProc = {
filename: IO.ROPE ← PLAOps.DefaultCMDLine[cmd.commandLine, defaultFile];
FetchWtDecodePLA ← PLAOps.NewPLA["IFUPLAFetchWtDecode.FetchWtDecodeIn", "IFUPLAFetchWtDecode.FetchWtDecodeOut"];
GenFetchWtDecodePla[];
[ ] ← PLAOps.ConvertTermListToCompleteSum[FetchWtDecodePLA.termList, FALSE, FALSE, cmd.out];
[ ] ← PLAOps.FindAMinimalCover[FetchWtDecodePLA.termList, 120, cmd.out];
PLAOps.WritePLAFile[filename, cmd.out, FetchWtDecodePLA] };
defaultFile: IO.ROPE = "IFUPLAFetchWtDecode.ttt";
doc: IO.ROPE = "Expects the name of a ttt file";
Commander.Register[key:"GenFetchWtDecode", proc: GenFetchWtDecode, doc: doc];
END.