include "sequence_aux.csp"
include "function_aux.csp"
include "auxiliar.csp"
include "rules.csp"
datatype Direction = req | ack
Value = {1..3}
CellId = {0..3}
channel rd : Direction.Value
channel wrt : Direction.Value
channel write : CellId.Direction.Value
channel read : CellId.Direction.Value
channel input : Value
channel output : Value
channel wrt_i : CellId.Direction.Value
channel rd_i : CellId.Direction.Value
Cell = wrt.req?x -> wrt.ack.x -> rd.req?dumb -> rd.ack!x -> Cell
Cell1_Cell2 = INTER(Cell1, Cell2)
Inst_Cell1 = <(rd,rd_i.1),(wrt,wrt_i.1)>
Cell1 = rename(Cell, Inst_Cell1)
Inst_Cell2 = <(rd,rd_i.2),(wrt,wrt_i.2)>
Cell2 = rename(Cell, Inst_Cell2)
Inst_Cell1_Cell2_INTER = <(rd,rd_i.1),(wrt,wrt_i.1),(rd,rd_i.2),(wrt,wrt_i.2)>
Cell1_Cell2_INTER = rename(Cell1_Cell2, Inst_Cell1_Cell2_INTER)
Inst_Cell3 = <(rd,rd_i.3),(wrt,wrt_i.3)>
Cell3 = rename(Cell, Inst_Cell3)
GET_CHANNELS(P) =
let f =
<
(Cell1_Cell2_INTER, { rd_i.1,wrt_i.1,rd_i.2,wrt_i.2 }),
(Cell3, { rd_i.3,wrt_i.3 })
>
within apply(f,P )
inputs( P ) =
let f =
<
( Cell1_Cell2_INTER, {| rd_i.1.req,wrt_i.1.req,rd_i.2.req,wrt_i.2.req |}),
( Cell3, {| rd_i.3.req,wrt_i.3.req |})
>
within apply(f, P )
outputs( P ) =
let f =
<
( Cell1_Cell2_INTER, {| rd_i.1.ack,wrt_i.1.ack,rd_i.2.ack,wrt_i.2.ack |}),
( Cell3, {| rd_i.3.ack,wrt_i.3.ack |})
>
within apply(f, P )
--INTERLEAVING COMPOSITION
Cell1_Cell2_INTER_Cell3 = INTER(Cell1_Cell2_INTER,Cell3)
assert STOP [T= RUN(inter(events(Cell1_Cell2_INTER),events(Cell3)))
assert Cell1_Cell2_INTER_Cell3:[deadlock free[FD]]