module ARCH_2B (FUNCTIONS, CHANNELS, VARIABLE_ARRAY, MESI_CACHE, VIRTUAL) is ------------------------------------------------------------------------------- -- Architecture of the system communicating by means of N shared variables, -- represented as the N cells a[0], ..., a[N-1] of an N-variable array. ------------------------------------------------------------------------------- process Arch_2b [NCS: Pid, CS: Access, A: Operation, MU: Latency] is par NCS, CS, A in Protocol [NCS, CS, A] || L [NCS, CS, A, MU] end par end process ------------------------------------------------------------------------------- -- Auxiliary process for compositional generation: protocol without latencies ------------------------------------------------------------------------------- process Protocol [NCS: Pid, CS: Access, A: Operation] is par A in par P [NCS, CS, A] (0 of Pid) || P [NCS, CS, A] (1 of Pid) end par || Variable_Array [A] (0 of Nat) end par end process ------------------------------------------------------------------------------- -- Auxiliary process for inserting latencies ------------------------------------------------------------------------------- process L [NCS: Pid, CS: Access, A: Operation, MU: Latency] is var a: Cache_Array, a_i: Cache, index, pid: Pid, acc: Access, op: Operation, cop: Cached_Operation in a := cache_array (cache (Invalid)); loop alt A (?op, ?index, ?any Nat, ?pid); a_i := a[Nat (index)]; cop := update_caches (pid, op, !?a_i); a[Nat (index)] := a_i; MU (cop, pid) [] CS (?acc, ?pid); if acc == Enter then MU (acc, pid) end if [] NCS (?pid); MU (Work, pid) end alt end loop end var end process end module