RequestControlFSM.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last Edited by: Gasbarro June 25, 1987 2:34:33 pm PDT
DIRECTORY Core, Boole, CoreCreate, CoreOps, FiniteStateAutomata;
RequestControlFSM: CEDAR PROGRAM
IMPORTS Boole, CoreCreate, CoreOps, FiniteStateAutomata =
BEGIN OPEN Boole, CoreCreate, FiniteStateAutomata;
Create: PROC RETURNS [ct: CellType] = {
fsa: StateMachine;
PostReq: Wire ← CoreOps.CreateWire[name: "PostReq"];
PostNeedO: Wire ← CoreOps.CreateWire[name: "PostNeedO"];
PostNeedS: Wire ← CoreOps.CreateWire[name: "PostNeedS"];
Post2Cycle: Wire ← CoreOps.CreateWire[name: "Post2Cycle"];
PostCWS: Wire ← CoreOps.CreateWire[name: "PostCWS"];
OSAvail: Wire ← CoreOps.CreateWire[name: "OSAvail"];
Owner: Wire ← CoreOps.CreateWire[name: "Owner"];
Shared: Wire ← CoreOps.CreateWire[name: "Shared"];
Priority: Wire ← CoreOps.CreateWire[name: "Priority"];
Done: Wire ← CoreOps.CreateWire[name: "Done"];
CWSReq: Wire ← CoreOps.CreateWire[name: "CWSReq"];
SetShared: Wire ← CoreOps.CreateWire[name: "SetShared"];
OwnerAbort: Wire ← CoreOps.CreateWire[name: "OwnerAbort"];
FiveCycReq: Wire ← CoreOps.CreateWire[name: "FiveCycReq"];
TwoCycReq: Wire ← CoreOps.CreateWire[name: "TwoCycReq"];
NeedOS : Wire ← CoreOps.CreateWire[name: "NeedOS"];
PopReq : Wire ← CoreOps.CreateWire[name: "PopReq"];
nReqPend: Wire ← CoreOps.CreateWire[name: "nReqPend"];
public: Wire ← WireList[LIST["Vdd", "Gnd", "Clock", "Reset",
PostReq, PostNeedO, PostNeedS, Post2Cycle, PostCWS,
OSAvail, Owner, Shared, Priority, Done, CWSReq, SetShared, OwnerAbort, FiveCycReq, TwoCycReq, NeedOS, PopReq, nReqPend]];
states: LIST OF ATOMLIST[$Idle];
states ← StateSeq[states, "RD", 4];
states ← StateSeq[states, "WR", 2];
states ← StateSeq[states, "WS", 3];
states ← StateSeq[states, "CWS", 3];
fsa ← NewMachine[states];
Mealy[fsa, $Idle,
LIST[nReqPend],
LIST [
[$Idle, Not[PostReq]],
[$RD0, And[PostReq, PostNeedO, PostNeedS]],
[$WR0, And[PostReq, Post2Cycle, Not[PostNeedS]]],
[$WS0, And[PostReq, Post2Cycle, PostNeedS]],
[$CWS0, And[PostReq, PostCWS, PostNeedS]]
]];
Mealy[fsa, $RD0,
LIST[NeedOS],
LIST [
[$RD0, Or[Not[Priority], Not[OSAvail]]],
[$RD1, And[Priority, OSAvail, Owner]],
[$RD2, And[Priority, OSAvail, Not[Owner], Shared]],
[$RD3, And[Priority, OSAvail, Not[Owner], Not[Shared]]]
]];
Mealy[fsa, $RD1, LIST[OwnerAbort], LIST [[$RD1, Not[Done]]]];
Mealy[fsa, $RD1, LIST[OwnerAbort], LIST [[$Idle, Done]]];
Mealy[fsa, $RD2, LIST[SetShared, FiveCycReq], LIST [[$RD2, Not[Done]]]];
Mealy[fsa, $RD2, LIST[SetShared, FiveCycReq], LIST [[$Idle, Done]]];
Mealy[fsa, $RD3, LIST[FiveCycReq], LIST [[$RD3, Not[Done]]]];
Mealy[fsa, $RD3, LIST[FiveCycReq], LIST [[$Idle, Done]]];
Mealy[fsa, $WR0, LIST[PopReq], LIST[[$WR0, Not[Priority]]]];
Mealy[fsa, $WR0, LIST[PopReq], LIST[[$WR1, Priority]]];
Mealy[fsa, $WR1, LIST[TwoCycReq], LIST [[$WR1, Not[Done]]]];
Mealy[fsa, $WR1, LIST[TwoCycReq], LIST [[$Idle, Done]]];
Mealy[fsa, $WS0,
LIST[NeedOS],
LIST [
[$WS0, Or[Not[Priority], Not[OSAvail]]],
[$WS1, And[Priority, OSAvail, Shared]],
[$WS2, And[Priority, OSAvail, Not[Shared]]]
]];
Mealy[fsa, $WS1, LIST[SetShared, TwoCycReq], LIST [[$WS1, Not[Done]]]];
Mealy[fsa, $WS1, LIST[SetShared, TwoCycReq], LIST [[$Idle, Done]]];
Mealy[fsa, $WS2, LIST[TwoCycReq], LIST [[$WS2, Not[Done]]]];
Mealy[fsa, $WS2, LIST[TwoCycReq], LIST [[$Idle, Done]]];
Mealy[fsa, $CWS0,
LIST[NeedOS],
LIST [
[$CWS0, Or[Not[Priority], Not[OSAvail]]],
[$CWS1, And[Priority, OSAvail, Shared]],
[$CWS2, And[Priority, OSAvail, Not[Shared]]]
]];
Mealy[fsa, $CWS1, LIST[CWSReq, SetShared, FiveCycReq], LIST [[$CWS1, Not[Done]]]];
Mealy[fsa, $CWS1, LIST[CWSReq, SetShared, FiveCycReq], LIST [[$Idle, Done]]];
Mealy[fsa, $CWS2, LIST[CWSReq, FiveCycReq], LIST [[$CWS2, Not[Done]]]];
Mealy[fsa, $CWS2, LIST[CWSReq, FiveCycReq], LIST [[$Idle, Done]]];
fsa.initialState ← FindState[fsa, $Idle];
ct ← StateMachineCell[public, fsa];
};
END.