You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
7.6 KiB

2 months ago
  1. mdp
  2. const int COL = 2;
  3. const int ASLOTTIME = 1;
  4. const int DIFS = 3;
  5. const int VULN = 1;
  6. const int TRANS_TIME_MAX = 4;
  7. const int TRANS_TIME_MIN = 4;
  8. const int ACK_TO = 6;
  9. const int ACK = 4;
  10. const int SIFS = 1;
  11. const int TIME_MAX = ((max(6, 4)) + 1);
  12. const int MAX_BACKOFF = 0;
  13. formula busy = ((c1 > 0) | (c2 > 0));
  14. formula free = ((c1 = 0) & (c2 = 0));
  15. module medium
  16. col: [0..2] init 0;
  17. c1: [0..2] init 0;
  18. c2: [0..2] init 0;
  19. [send1] ((c1 = 0) & (c2 = 0)) -> 1 : (c1' = 1);
  20. [send2] ((c2 = 0) & (c1 = 0)) -> 1 : (c2' = 1);
  21. [send1] ((c1 = 0) & (c2 > 0)) -> 1 : (col' = (min((col + 1), 2))) & (c1' = 2) & (c2' = 2);
  22. [send2] ((c2 = 0) & (c1 > 0)) -> 1 : (col' = (min((col + 1), 2))) & (c1' = 2) & (c2' = 2);
  23. [finish1] (c1 > 0) -> 1 : (c1' = 0);
  24. [finish2] (c2 > 0) -> 1 : (c2' = 0);
  25. endmodule
  26. module station1
  27. x1: [0..((max(6, 4)) + 1)] init 0;
  28. s1: [1..12] init 1;
  29. slot1: [0..1] init 0;
  30. backoff1: [0..15] init 0;
  31. bc1: [0..1] init 0;
  32. [time] (((s1 = 1) & (x1 < 3)) & ((c1 = 0) & (c2 = 0))) -> 1 : (x1' = (min((x1 + 1), 7)));
  33. [] ((s1 = 1) & ((x1 = 3) | (x1 = 2))) -> 1 : (x1' = 0) & (s1' = 8);
  34. [] ((s1 = 1) & ((c1 > 0) | (c2 > 0))) -> 1 : (x1' = 0) & (s1' = 2);
  35. [time] ((s1 = 2) & ((c1 > 0) | (c2 > 0))) -> 1 : (s1' = 2);
  36. [] ((s1 = 2) & ((c1 = 0) & (c2 = 0))) -> 1 : (s1' = 3);
  37. [time] (((s1 = 3) & (x1 < 3)) & ((c1 = 0) & (c2 = 0))) -> 1 : (x1' = (min((x1 + 1), 7)));
  38. [] ((s1 = 3) & ((c1 > 0) | (c2 > 0))) -> 1 : (x1' = 0) & (s1' = 2);
  39. [] (((s1 = 3) & ((x1 = 3) | (x1 = 2))) & (bc1 = 0)) -> 1 : (x1' = 0) & (s1' = 4) & (slot1' = 0) & (bc1' = (min((bc1 + 1), 0)));
  40. [] (s1 = 4) -> (1 / 16) : (s1' = 5) & (backoff1' = 0) + (1 / 16) : (s1' = 5) & (backoff1' = 1) + (1 / 16) : (s1' = 5) & (backoff1' = 2) + (1 / 16) : (s1' = 5) & (backoff1' = 3) + (1 / 16) : (s1' = 5) & (backoff1' = 4) + (1 / 16) : (s1' = 5) & (backoff1' = 5) + (1 / 16) : (s1' = 5) & (backoff1' = 6) + (1 / 16) : (s1' = 5) & (backoff1' = 7) + (1 / 16) : (s1' = 5) & (backoff1' = 8) + (1 / 16) : (s1' = 5) & (backoff1' = 9) + (1 / 16) : (s1' = 5) & (backoff1' = 10) + (1 / 16) : (s1' = 5) & (backoff1' = 11) + (1 / 16) : (s1' = 5) & (backoff1' = 12) + (1 / 16) : (s1' = 5) & (backoff1' = 13) + (1 / 16) : (s1' = 5) & (backoff1' = 14) + (1 / 16) : (s1' = 5) & (backoff1' = 15);
  41. [time] (((s1 = 5) & (x1 < 1)) & ((c1 = 0) & (c2 = 0))) -> 1 : (x1' = (min((x1 + 1), 7)));
  42. [] (((s1 = 5) & (x1 = 1)) & (backoff1 > 0)) -> 1 : (x1' = 0) & (s1' = 5) & (backoff1' = (backoff1 - 1));
  43. [] ((((s1 = 5) & (x1 = 1)) & (backoff1 = 0)) & (slot1 > 0)) -> 1 : (x1' = 0) & (s1' = 5) & (slot1' = (slot1 - 1)) & (backoff1' = 15);
  44. [] ((((s1 = 5) & (x1 = 1)) & (backoff1 = 0)) & (slot1 = 0)) -> 1 : (x1' = 0) & (s1' = 8);
  45. [] ((s1 = 5) & ((c1 > 0) | (c2 > 0))) -> 1 : (x1' = 0) & (s1' = 6);
  46. [time] ((s1 = 6) & ((c1 > 0) | (c2 > 0))) -> 1 : (s1' = 6);
  47. [] ((s1 = 6) & ((c1 = 0) & (c2 = 0))) -> 1 : (s1' = 7);
  48. [time] (((s1 = 7) & (x1 < 3)) & ((c1 = 0) & (c2 = 0))) -> 1 : (x1' = (min((x1 + 1), 7)));
  49. [] ((s1 = 7) & ((x1 = 3) | (x1 = 2))) -> 1 : (x1' = 0) & (s1' = 5);
  50. [] ((s1 = 7) & ((c1 > 0) | (c2 > 0))) -> 1 : (x1' = 0) & (s1' = 6);
  51. [time] ((s1 = 8) & (x1 < 1)) -> 1 : (x1' = (min((x1 + 1), 7)));
  52. [send1] ((s1 = 8) & ((x1 = 1) | (x1 = 0))) -> 1 : (x1' = 0) & (s1' = 9);
  53. [time] ((s1 = 9) & (x1 < 4)) -> 1 : (x1' = (min((x1 + 1), 7)));
  54. [finish1] (((s1 = 9) & (x1 >= 4)) & (c1 = 1)) -> 1 : (x1' = 0) & (s1' = 10);
  55. [finish1] (((s1 = 9) & (x1 >= 4)) & (c1 = 2)) -> 1 : (x1' = 0) & (s1' = 11);
  56. [] ((((s1 = 10) & (c1 = 0)) & (x1 = 0)) & ((c1 > 0) | (c2 > 0))) -> 1 : (s1' = 2);
  57. [time] ((((s1 = 10) & (c1 = 0)) & (x1 = 0)) & ((c1 = 0) & (c2 = 0))) -> 1 : (x1' = (min((x1 + 1), 7)));
  58. [send1] (((s1 = 10) & (c1 = 0)) & ((x1 = 1) | ((x1 = 0) & ((c1 = 0) & (c2 = 0))))) -> 1 : (x1' = 0) & (s1' = 10);
  59. [time] (((s1 = 10) & (c1 = 1)) & (x1 < 4)) -> 1 : (x1' = (min((x1 + 1), 7)));
  60. [finish1] (((s1 = 10) & (c1 = 1)) & ((x1 = 4) | (x1 = 3))) -> 1 : (x1' = 0) & (s1' = 12) & (bc1' = 0);
  61. [] (((s1 = 11) & (x1 = 0)) & ((c1 > 0) | (c2 > 0))) -> 1 : (s1' = 2);
  62. [time] (((s1 = 11) & (x1 = 0)) & ((c1 = 0) & (c2 = 0))) -> 1 : (x1' = (min((x1 + 1), 7)));
  63. [time] (((s1 = 11) & (x1 > 0)) & (x1 < 6)) -> 1 : (x1' = (min((x1 + 1), 7)));
  64. [] ((s1 = 11) & (x1 = 6)) -> 1 : (x1' = 0) & (s1' = 3);
  65. [time] (s1 = 12) -> 1 : (s1' = 12);
  66. endmodule
  67. module station2
  68. x2: [0..((max(6, 4)) + 1)] init 0;
  69. s2: [1..12] init 1;
  70. slot2: [0..1] init 0;
  71. backoff2: [0..15] init 0;
  72. bc2: [0..1] init 0;
  73. [time] (((s2 = 1) & (x2 < 3)) & ((c2 = 0) & (c1 = 0))) -> 1 : (x2' = (min((x2 + 1), 7)));
  74. [] ((s2 = 1) & ((x2 = 3) | (x2 = 2))) -> 1 : (x2' = 0) & (s2' = 8);
  75. [] ((s2 = 1) & ((c2 > 0) | (c1 > 0))) -> 1 : (x2' = 0) & (s2' = 2);
  76. [time] ((s2 = 2) & ((c2 > 0) | (c1 > 0))) -> 1 : (s2' = 2);
  77. [] ((s2 = 2) & ((c2 = 0) & (c1 = 0))) -> 1 : (s2' = 3);
  78. [time] (((s2 = 3) & (x2 < 3)) & ((c2 = 0) & (c1 = 0))) -> 1 : (x2' = (min((x2 + 1), 7)));
  79. [] ((s2 = 3) & ((c2 > 0) | (c1 > 0))) -> 1 : (x2' = 0) & (s2' = 2);
  80. [] (((s2 = 3) & ((x2 = 3) | (x2 = 2))) & (bc2 = 0)) -> 1 : (x2' = 0) & (s2' = 4) & (slot2' = 0) & (bc2' = (min((bc2 + 1), 0)));
  81. [] (s2 = 4) -> (1 / 16) : (s2' = 5) & (backoff2' = 0) + (1 / 16) : (s2' = 5) & (backoff2' = 1) + (1 / 16) : (s2' = 5) & (backoff2' = 2) + (1 / 16) : (s2' = 5) & (backoff2' = 3) + (1 / 16) : (s2' = 5) & (backoff2' = 4) + (1 / 16) : (s2' = 5) & (backoff2' = 5) + (1 / 16) : (s2' = 5) & (backoff2' = 6) + (1 / 16) : (s2' = 5) & (backoff2' = 7) + (1 / 16) : (s2' = 5) & (backoff2' = 8) + (1 / 16) : (s2' = 5) & (backoff2' = 9) + (1 / 16) : (s2' = 5) & (backoff2' = 10) + (1 / 16) : (s2' = 5) & (backoff2' = 11) + (1 / 16) : (s2' = 5) & (backoff2' = 12) + (1 / 16) : (s2' = 5) & (backoff2' = 13) + (1 / 16) : (s2' = 5) & (backoff2' = 14) + (1 / 16) : (s2' = 5) & (backoff2' = 15);
  82. [time] (((s2 = 5) & (x2 < 1)) & ((c2 = 0) & (c1 = 0))) -> 1 : (x2' = (min((x2 + 1), 7)));
  83. [] (((s2 = 5) & (x2 = 1)) & (backoff2 > 0)) -> 1 : (x2' = 0) & (s2' = 5) & (backoff2' = (backoff2 - 1));
  84. [] ((((s2 = 5) & (x2 = 1)) & (backoff2 = 0)) & (slot2 > 0)) -> 1 : (x2' = 0) & (s2' = 5) & (slot2' = (slot2 - 1)) & (backoff2' = 15);
  85. [] ((((s2 = 5) & (x2 = 1)) & (backoff2 = 0)) & (slot2 = 0)) -> 1 : (x2' = 0) & (s2' = 8);
  86. [] ((s2 = 5) & ((c2 > 0) | (c1 > 0))) -> 1 : (x2' = 0) & (s2' = 6);
  87. [time] ((s2 = 6) & ((c2 > 0) | (c1 > 0))) -> 1 : (s2' = 6);
  88. [] ((s2 = 6) & ((c2 = 0) & (c1 = 0))) -> 1 : (s2' = 7);
  89. [time] (((s2 = 7) & (x2 < 3)) & ((c2 = 0) & (c1 = 0))) -> 1 : (x2' = (min((x2 + 1), 7)));
  90. [] ((s2 = 7) & ((x2 = 3) | (x2 = 2))) -> 1 : (x2' = 0) & (s2' = 5);
  91. [] ((s2 = 7) & ((c2 > 0) | (c1 > 0))) -> 1 : (x2' = 0) & (s2' = 6);
  92. [time] ((s2 = 8) & (x2 < 1)) -> 1 : (x2' = (min((x2 + 1), 7)));
  93. [send2] ((s2 = 8) & ((x2 = 1) | (x2 = 0))) -> 1 : (x2' = 0) & (s2' = 9);
  94. [time] ((s2 = 9) & (x2 < 4)) -> 1 : (x2' = (min((x2 + 1), 7)));
  95. [finish2] (((s2 = 9) & (x2 >= 4)) & (c2 = 1)) -> 1 : (x2' = 0) & (s2' = 10);
  96. [finish2] (((s2 = 9) & (x2 >= 4)) & (c2 = 2)) -> 1 : (x2' = 0) & (s2' = 11);
  97. [] ((((s2 = 10) & (c2 = 0)) & (x2 = 0)) & ((c2 > 0) | (c1 > 0))) -> 1 : (s2' = 2);
  98. [time] ((((s2 = 10) & (c2 = 0)) & (x2 = 0)) & ((c2 = 0) & (c1 = 0))) -> 1 : (x2' = (min((x2 + 1), 7)));
  99. [send2] (((s2 = 10) & (c2 = 0)) & ((x2 = 1) | ((x2 = 0) & ((c2 = 0) & (c1 = 0))))) -> 1 : (x2' = 0) & (s2' = 10);
  100. [time] (((s2 = 10) & (c2 = 1)) & (x2 < 4)) -> 1 : (x2' = (min((x2 + 1), 7)));
  101. [finish2] (((s2 = 10) & (c2 = 1)) & ((x2 = 4) | (x2 = 3))) -> 1 : (x2' = 0) & (s2' = 12) & (bc2' = 0);
  102. [] (((s2 = 11) & (x2 = 0)) & ((c2 > 0) | (c1 > 0))) -> 1 : (s2' = 2);
  103. [time] (((s2 = 11) & (x2 = 0)) & ((c2 = 0) & (c1 = 0))) -> 1 : (x2' = (min((x2 + 1), 7)));
  104. [time] (((s2 = 11) & (x2 > 0)) & (x2 < 6)) -> 1 : (x2' = (min((x2 + 1), 7)));
  105. [] ((s2 = 11) & (x2 = 6)) -> 1 : (x2' = 0) & (s2' = 3);
  106. [time] (s2 = 12) -> 1 : (s2' = 12);
  107. endmodule
  108. label "twoCollisions" = (col = 2);