GenerateMemoryRequest:
PROC []
RETURNS [Request] = {
hisId: DeviceId ← myState.requestBeingServed.deviceId;
data: INT ← myState.requestBeingServed.data;
rbRplyCycle: Cycle ← DynaSeer.MakeCycle[RBRply, hisId, myId, data];
wbRplyCycle: Cycle ← DynaSeer.MakeCycle[WBRply, hisId, myId, data];
wsRplyCycle: Cycle ← DynaSeer.MakeCycle[WSRply, hisId, myId, data];
SELECT myState.requestBeingServed.cmd
FROM
RBRqst => RETURN [DynaSeer.MakeRequest[Five, rbRplyCycle]];
WBRqst => RETURN [DynaSeer.MakeRequest[Two, wbRplyCycle]];
WSRqst => RETURN [DynaSeer.MakeRequest[Two, wsRplyCycle]]
ENDCASE => ERROR
};
IF myState.requestStatus=requesting
THEN {
request: Request ← handle.memRequests[myId];
IF request#
NIL
THEN {request.cycles.first.grantLatency ← request.cycles.first.grantLatency+1; RETURN}
ELSE myState.requestStatus ← notRequesting
};
IF myState.memCounter=(myState.memLatency-handle.arbLatency)
THEN {
handle.memRequests[myId] ← GenerateMemoryRequest[];
myState.requestStatus ← requesting;
myState.memCounter ← myState.memCounter+1}
ELSE
IF myState.memCounter=myState.memLatency
THEN {
myState.requestBeingServed ← NARROW[FIFO.Get[myState.inputFIFO]];
IF myState.requestBeingServed#
NIL
THEN myState.memCounter ← 1
ELSE myState.memCounter ← 0}
ELSE myState.memCounter ← myState.memCounter+1;