ebb_prim.hrl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. %% operation(A, B) = A |->| B
  2. %% task(B) = operation((), B) = () |->| B = |<B>|
  3. %% operation(A, B) ::= func_F(A, B)
  4. %% | value_X(A, B)
  5. %% | pipe_Op1,...,Op_I(A, B)
  6. %% | par_Op1,...,Op_I(A, B)
  7. %% | route_N,M,R(A, B)
  8. %% | sync_N(A, B)
  9. %% | split_N(A, B)
  10. %% | merge_N(A, B)
  11. %% | switch_I,N(A, B)
  12. %% func_F(A_1 * ... * A_n, B) ::= { in = arity(F) : number, code = F }
  13. %% where F : fun(A_1, ..., A_n) -> B
  14. -record(func, {in, code}).
  15. %% value_X((), B) ::= { value = X }
  16. %% where X : B
  17. -record(value, {value}).
  18. %% pipe_Op_1,Op_2,...,Op_I(A_1_1 * ... * A_1_N1, B_1 * ... * B_M) ::=
  19. %% { in = N1 : number, out = M : number,
  20. %% ops : [ Op_1, Op_2, ..., Op_i ] }
  21. %% where Op_1 : A_1_1 * ... * A_1_N1 |->| A_2_1 * ... * A_2_N2
  22. %% Op_2 : A_2_1 * ... * A_2_N2 |->| A_3_1 * ... * A_3_N3
  23. %% ...
  24. %% Op_I : A_I_1 * ... * A_I_NI |->| B_1 * ... * B_M
  25. -record(pipe, {in, out, ops}).
  26. %% par_Op_1,Op2_,...,Op_I(A, B) ::=
  27. %% { in = size(A) : number,
  28. %% out = size(B) : number,
  29. %% ops : [ Op_1, Op_2, ..., Op_I ] }
  30. %% where Op_1 : A_1 |->| B_1
  31. %% Op_2 : A_2 |->| B_2
  32. %% ...
  33. %% Op_I : A_I |->| B_I
  34. %% A = flatten([A_1, A_2, ..., A_I])
  35. %% B = flatten([B_1, B_2, ..., B_I])
  36. -record(par, {in, out, ops}).
  37. %% route_N,R(A, [ A_I || I <- R ]) ::=
  38. %% { in = N, out = length(R), map = R }
  39. %% where N : number
  40. %% R : [source]
  41. %% source : [1..N]
  42. -record(route, {in, out, map}).
  43. %% sync_N(A_1 * ... * A_N, A_1 * ... A_N) ::= { size = N : number }
  44. -record(sync, {size}).
  45. %% split_N(unit(A_1 * ... * A_N), A_1 * ... * A_N) ::= { size = N : number }
  46. -record(split, {size}).
  47. %% merge_N(A_1 * ... * A_N, unit(A_1 * ... * A_N)) ::= { size = N : number }
  48. -record(merge, {size}).
  49. %% switch_Op_1,...,Op_I((T_1 + ... + T_I) * A_1 * ... * A_N,
  50. %% (B_1_1 + ... + B_I_1) * ... * (B_1_M + ... + B_I_M)) ::=
  51. %% { in = 1+N : number, out = M : number,
  52. %% map : [ {T_J, Op_J} || J <- [1..I] ] }
  53. %% where Op_1 : A_1 * ... * A_N |->| B_1_1 * ... * B_1_M
  54. %% ...
  55. %% Op_I : A_1 * ... * A_N |->| B_I_1 * ... * B_I_M
  56. -record(switch, {in, out, map}).