Advertisement
Guest User

producer-consumer.xml

a guest
May 28th, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
  3. <nta>
  4. <declaration>const int MAX = 6;
  5. typedef int[0, MAX] Data;
  6.  
  7. chan comm[Data];
  8. </declaration>
  9. <template>
  10. <name x="40" y="16">Producer</name>
  11. <declaration>Data n;
  12.  
  13. Data getN()
  14. {
  15. return n;
  16. }
  17.  
  18. void incN()
  19. {
  20. if (n == MAX) {
  21. n = 0;
  22. } else {
  23. n++;
  24. }
  25. }</declaration>
  26. <location id="id0" x="-8" y="42">
  27. <name x="-51" y="8">Producer</name>
  28. </location>
  29. <init ref="id0"/>
  30. <transition>
  31. <source ref="id0"/>
  32. <target ref="id0"/>
  33. <label kind="synchronisation" x="102" y="25">comm[getN()]!</label>
  34. <label kind="assignment" x="102" y="42">incN()</label>
  35. <nail x="85" y="85"/>
  36. <nail x="93" y="0"/>
  37. </transition>
  38. </template>
  39. <template>
  40. <name x="40" y="16">Consumer</name>
  41. <declaration>Data myN;
  42.  
  43. void rec(Data x)
  44. {
  45. myN = x;
  46. }</declaration>
  47. <location id="id1" x="192" y="128">
  48. <name x="208" y="96">Consumer</name>
  49. </location>
  50. <init ref="id1"/>
  51. <transition>
  52. <source ref="id1"/>
  53. <target ref="id1"/>
  54. <label kind="select" x="306" y="187">n : Data</label>
  55. <label kind="synchronisation" x="306" y="204">comm[n]?</label>
  56. <label kind="assignment" x="306" y="221">rec(n)</label>
  57. <nail x="255" y="212"/>
  58. <nail x="331" y="161"/>
  59. </transition>
  60. </template>
  61. <system>system Producer, Consumer;
  62. </system>
  63. <queries>
  64. </queries>
  65. </nta>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement