#include /// Convert between Level and Transition style modelling Event clk // D-Type clk // The models Process Arbiter(Bool to, oi, go, ao, gi, oo, ti, ri, bool start) { Bool i2, i3, i4, i5, i6, ri' return DFF(ti, clk, to, start)* AND2(to, i2, i3)* OR2(i3, oi, oo)* OR2(i3, gi, i6)* AND2(ri, i6, ao)* INV(ri, ri')* AND2(ri', gi, go)* DFF(i4, clk, i2, false)* OR2(to, i2, i5)* AND2(ri, i5, i4)-(i2 i3 i4 i5 i6 ri') } Process GND(Bool a) { Process v(a) v <- a.0 v return v } Process Level2Sync(Bool l, Event e, clk) { Process S S <- (l.1 e) (l.1 clk) S + (l.0) (l.0 clk) S return S } /* Single arbiter test --------------------------------------- Process Arb, ArbAndSync, ArbAndSyncOnly Process HE1,HE2,HE3,HE4 Bool to, oi, go, ao, gi, oo, ti, ri; Event R, A, T Arb <- Arbiter(to, oi, go, ao, gi, oo, ti, ri, false) ArbAndSync <- Arb * Level2Sync(to,T,clk) * Level2Sync(ao,A,clk) ArbAndSyncOnly <- ArbAndSync - (to oi go ao gi oo ti ri) */ /* Equivalent to arbiter and "T" sync HE1 <- clk HE2 HE2 <- clk HE2 + T HE3 HE3 <- clk HE4 HE4 <- clk HE4 + T HE3 print may_eq(~ArbAndSyncOnly,HE1) HE1 <- clk HE3 + A HE2 HE2 <- clk HE3 HE3 <- clk HE3 + A HE2 + T HE2 + (A T) HE2 print may_eq(~ArbAndSyncOnly,HE1) */ /* Arbiter Loop Test ------------------------------------------ */ n=5 // Number of Arbiters (>1) tokp=0 // where to start token Process As[n] Bool t[n], oi[n], oo[n], a[n], r[n], invo, invi Event R[n], A[n], T[n] As[0] <- Arbiter(t[0], oi[0], oo[0], a[0], invo, invi, t[n-1], r[0], (tokp==0))* Level2Sync(t[0], T[0], clk)* Level2Sync(a[0], A[0], clk)* Level2Sync(r[0], R[0], clk) for (i=1;i TokCirc : " print (~Arb > TokCirc[0]) print "\n" /* Requests high test ------------------------------------------ Arb <- ~((*As)*GND(oi[n-1])*INV(invi, invo)- ((*oi) (*oo) invo invi (*t) (*a) (*r) clk)) Process Test, Cons, tmp Event sync Test <- ((*R) sync) Test tmp = NullP for (i=0;i AckCirc : " print (~RequestsHigh > AckCirc[0]) print "\n" */