<> <> <> <> <> <<>> DIRECTORY Commander, Dragon, DragOpsCross, IFUPLAFetchControl, IO, PLAOps; IFUPLAFetchControlImpl: CEDAR PROGRAM IMPORTS Commander, IO, PLAOps = BEGIN OPEN PO: PLAOps; FetchRdDecodePLA: PLAOps.PLA; FetchWtDecodePLA: PLAOps.PLA; FetchControlPLA: PLAOps.PLA; FetchControlIn: TYPE = IFUPLAFetchControl.FetchControlIn; FetchControlOut: TYPE = IFUPLAFetchControl.FetchControlOut; FetchRdDecodeIn: TYPE = IFUPLAFetchControl.FetchRdDecodeIn; FetchRdDecodeOut: TYPE = IFUPLAFetchControl.FetchRdDecodeOut; FetchWtDecodeIn: TYPE = IFUPLAFetchControl.FetchWtDecodeIn; FetchWtDecodeOut: TYPE = IFUPLAFetchControl.FetchWtDecodeOut; JumpOffsetSel: TYPE = IFUPLAFetchControl.JumpOffsetSel; GenFetchControlPLA: PUBLIC PROC = { pBusFaultIsSig: Dragon.PBusFaults _ LAST [Dragon.PBusFaults]; jump: PO.BoolExpr _ BE[m:[nextMacroJump: TRUE], d:[nextMacroJump: TRUE]]; reset: PO.BoolExpr _ BE[m:[reset: TRUE], d:[reset: TRUE]]; reject: PO.BoolExpr _ BE[m:[iPReject: TRUE], d:[iPReject: TRUE]]; jumpPending: PO.BoolExpr _ BE[m:[jumpPendingIn: TRUE], d:[jumpPendingIn: TRUE]]; fetching: PO.BoolExpr _ BE[m:[fetchingIn: TRUE], d:[fetchingIn: TRUE]]; roomFor1: PO.BoolExpr _ PO.Not[BE[m:[fetchBytesM1: 28], d:[fetchBytesM1: 12]] ]; roomFor2: PO.BoolExpr _ PO.Not[BE[m:[fetchBytesM1: 24], d:[fetchBytesM1: 8]] ]; iPFaulted: PO.BoolExpr _ BE[m:[iPFaultedIn: TRUE], d:[iPFaultedIn: TRUE]]; newFault: PO.BoolExpr _ BE[m:[iPFaulting: TRUE], d:[iPFaulting: TRUE]]; jmpOrJmpPend: PO.BoolExpr _ PO.Or[jump, jumpPending]; roomForFetch: PO.BoolExpr _ PO.Or[roomFor2, PO.And[PO.Not[fetching], roomFor1]]; Set[out:[jumpPending: TRUE], s:PO.And[PO.Not[reset], PO.Not[iPFaulted], jmpOrJmpPend, reject ] ]; Set[out:[newFetch: TRUE], -- sets IPCmnd3A to Fetch in next A s:PO.And[ PO.Not[reset], PO.Not[iPFaulted], PO.Not[reject], PO.Or[roomForFetch, jmpOrJmpPend] ] ]; Set[out:[fetching: TRUE], -- enables write in next B s:PO.And[ PO.Not[reset], PO.Not[iPFaulted], PO.Or[ PO.And[ reject, fetching], PO.And[PO.Not[reject], roomForFetch], PO.And[PO.Not[reject], jmpOrJmpPend] ] ] ]; Set[out:[iPFaulted: TRUE], s:PO.Or[ reset, PO.And[ PO.Not[jmpOrJmpPend], PO.Or[iPFaulted, newFault] ] ] ]; Set[out:[fetchWtIndexCtl: clear], s: jmpOrJmpPend ]; Set[out:[fetchWtIndexCtl: hold], s:PO.And[ PO.Not[jmpOrJmpPend], PO.Or[PO.Not[fetching], reject, iPFaulted] ] ]; Set[out:[fetchWtIndexCtl: inc], s:PO.And[ PO.Not[jmpOrJmpPend], fetching, PO.Not[reject], PO.Not[iPFaulted] ] ]; GenPreDecode[]}; GenPreDecode: PUBLIC PROC = { SetJumpOffset: PROC[inst: DragOpsCross.Inst, val: JumpOffsetSel] = { op: INT [0..8) _ LOOPHOLE[inst, CARDINAL]/32; IF NOT reservations[op].used THEN reservations[op] _ [TRUE, val]; IF reservations[op].val # val THEN ERROR; Set[out:[jumpOffset: val], s: BE[m:[op: 7], d:[op: op]]] }; reservations: ARRAY [0..8) OF RECORD [used: BOOL _ FALSE, val: JumpOffsetSel_beta ]; op0: PO.BoolExpr _ BE[m:[op: 4], d:[op: 4]]; op1: PO.BoolExpr _ BE[m:[op: 2], d:[op: 2]]; op2: PO.BoolExpr _ BE[m:[op: 1], d:[op: 1]]; oneByter: PO.BoolExpr _ PO.Or[ PO.And[ PO.Not[op0], PO.Not[op1], PO.Not[op2] ], PO.And[ PO.Not[op0], op1 ] ]; twoByter: PO.BoolExpr _ PO.And[ op0, PO.Not[op1] ]; threeByter: PO.BoolExpr _ PO.And[ op0, op1 ]; fiveByter: PO.BoolExpr _ PO.And[ PO.Not[op0], PO.Not[op1], op2 ]; bytesAvail0: PO.BoolExpr _ BE[m:[fetchBytesM1: 16], d:[fetchBytesM1: 16 ]]; bytesAvail1: PO.BoolExpr _ BE[m:[fetchBytesM1: 31], d:[fetchBytesM1: 0 ]]; bytesAvail2: PO.BoolExpr _ BE[m:[fetchBytesM1: 31], d:[fetchBytesM1: 1 ]]; bytesAvail3: PO.BoolExpr _ BE[m:[fetchBytesM1: 31], d:[fetchBytesM1: 2 ]]; bytesAvail4: PO.BoolExpr _ BE[m:[fetchBytesM1: 31], d:[fetchBytesM1: 3 ]]; notReady: PO.BoolExpr _ PO.Or[ bytesAvail0, PO.And[ bytesAvail1, PO.Or[ twoByter, threeByter, fiveByter ] ], PO.And[ bytesAvail2, PO.Or[ threeByter, fiveByter ] ], PO.And[ PO.Or[ bytesAvail3, bytesAvail4 ], fiveByter ] ]; Set[out:[notInstReady: TRUE], s: notReady]; Set[out:[instFault0:TRUE], s:PO.And[notReady, BE[m:[iPFaulting:TRUE], d:[iPFaulting:TRUE]]]]; Set[out:[opLength: 5, opLengthb: 5], s: fiveByter ]; Set[out:[opLength: 1, opLengthb: 1], s: oneByter ]; Set[out:[opLength: 2, opLengthb: 2], s: twoByter ]; Set[out:[opLength: 3, opLengthb: 3], s: threeByter ]; SetJumpOffset[dJB, alpha]; SetJumpOffset[dJDB, alphaBeta]; SetJumpOffset[dLFC, alphaBeta]; SetJumpOffset[dJSR, xa]; FOR inst: DragOpsCross.Inst IN [dRJEB..dRJLEBJ] DO SetJumpOffset[inst, beta] ENDLOOP; FOR inst: DragOpsCross.Inst IN [dJEBB..dJNEBBJ] DO SetJumpOffset[inst, beta] ENDLOOP}; GenFetchRdDecodePLA: PROC = { -- decode 0=>xxx.0=TRUE, 1=>xxx.1=TRUE FOR fetchRd: CARDINAL IN [0..16) DO val: CARDINAL _ 1; THROUGH (fetchRd..16) DO val _ val*2 ENDLOOP; SetRd[m:[fetchRd: 15], d:[fetchRd: fetchRd], out:[fetchBufRdByte: val]]; ENDLOOP}; GenFetchWtDecodePLA: PROC = { -- decode 0=>xxx.0=TRUE, 1=>xxx.1=TRUE FOR fetchWt: CARDINAL IN [0..4) DO val: CARDINAL _ 1; THROUGH (fetchWt..4) DO val _ val*2 ENDLOOP; SetWt[ m: [fetching: TRUE, fetchWt: 3], d: [fetching: TRUE, fetchWt: fetchWt], out:[fetchBufWtWd: val]]; ENDLOOP}; BE: PROC [m, d: FetchControlIn] RETURNS[PO.BoolExpr] = { mRef: REF FetchControlIn _ NARROW[FetchControlPLA.mask]; dRef: REF FetchControlIn _ NARROW[FetchControlPLA.data]; mRef^ _ m; dRef^ _ d; RETURN[PO.GetBEForDataMask[FetchControlPLA]]}; 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]]}; Set: PROC [s: PO.BoolExpr _ NIL, m, d: FetchControlIn _ [ ], out: FetchControlOut] = { res: REF FetchControlOut _ NARROW[FetchControlPLA.out]; IF s=NIL THEN s _ BE[m,d] ELSE s _ PO.And[s, BE[m,d] ]; res^ _ out; PO.SetOutForBE[FetchControlPLA, s]}; 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]}; GenFetchControl: Commander.CommandProc = { rdInType: IO.ROPE _ "IFUPLAFetchControl.FetchRdDecodeIn"; wtInType: IO.ROPE _ "IFUPLAFetchControl.FetchWtDecodeIn"; ctlInType: IO.ROPE _ "IFUPLAFetchControl.FetchControlIn"; FetchRdDecodePLA _ PO.NewPLA[rdInType, "IFUPLAFetchControl.FetchRdDecodeOut"]; FetchWtDecodePLA _ PO.NewPLA[wtInType, "IFUPLAFetchControl.FetchWtDecodeOut"]; FetchControlPLA _ PO.NewPLA[ctlInType, "IFUPLAFetchControl.FetchControlOut"]; GenFetchRdDecodePLA []; GenFetchWtDecodePLA []; GenFetchControlPLA []; [] _PO.ConvertTermListToCompleteSum[FetchRdDecodePLA.termList, FALSE,FALSE,cmd.out]; [] _PO.ConvertTermListToCompleteSum[FetchWtDecodePLA.termList, FALSE,FALSE,cmd.out]; [] _PO.ConvertTermListToCompleteSum[FetchControlPLA.termList, FALSE,FALSE,cmd.out]; [] _PO.FindAMinimalCover[FetchRdDecodePLA.termList, 120, cmd.out]; [] _PO.FindAMinimalCover[FetchWtDecodePLA.termList, 120, cmd.out]; [] _PO.FindAMinimalCover[FetchControlPLA.termList, 120, cmd.out]; PO.WritePLAFile[ "IFUPLAFetchRdDecode.ttt", cmd.out, FetchRdDecodePLA]; PO.WritePLAFile[ "IFUPLAFetchWtDecode.ttt", cmd.out, FetchWtDecodePLA]; PO.WritePLAFile[ "IFUPLAFetchControl.ttt", cmd.out, FetchControlPLA] }; defaultFile: IO.ROPE = "IFUPLAFetchControl.ttt"; doc: IO.ROPE = "Expects the name of a ttt file"; Commander.Register[key:"GenFetchControl", proc: GenFetchControl, doc: doc]; END. <<>> <<>> <<>>