-- File: [Indigo]<Sakura>Dragon>DragonArbiterImpl1.sak
-- 15-Mar-82 9:19:33
DIRECTORY
DragonArbiter1,
SakuraRT;
DragonArbiterImpl1: MONITOR
IMPORTS SakuraRT
EXPORTS DragonArbiter1 = {
Arbiter: PUBLIC DEVICE = {
IN ClockA, ClockB, Proc1Rq, Proc2Rq: BOOLEAN
OUT Proc1Gr, Proc2Gr: BOOLEAN
GUARDIAN {}
CONTROL {
granted: BOOLEAN ← FALSE;
last: CARDINAL ← 0;
Grant: ENTRY PROC = {
IF last=1 THEN {
IF Proc1Rq AND granted THEN RETURN
ELSE IF Proc2Rq THEN
{Proc1Gr ← FALSE; last ← 2; Proc2Gr ← TRUE; granted ← TRUE}
ELSE IF Proc1Rq THEN {Proc1Gr ← TRUE; granted ← TRUE}
ELSE {Proc1Gr ← FALSE; granted ← FALSE} }
ELSE IF last=2 THEN {
IF Proc2Rq AND granted THEN RETURN
ELSE IF Proc1Rq THEN
{Proc2Gr ← FALSE; last ← 1; Proc1Gr ← TRUE; granted ← TRUE}
ELSE IF Proc2Rq THEN {Proc2Gr ← TRUE; granted ← TRUE}
ELSE {Proc2Gr ← FALSE; granted ← FALSE} }
ELSE
IF Proc1Rq THEN {last ← 1; Proc1Gr ← TRUE; granted ← TRUE}
ELSE IF Proc2Rq THEN {last ← 2; Proc2Gr ← TRUE; granted ← TRUE}
}; -- Grant
DO
WHEN ClockB UP: Grant[];
ENDLOOP
}
};
}.