305 lines
9.4 KiB
XML
305 lines
9.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
|
|
<nta>
|
|
<declaration>// Place global declarations here.
|
|
clock time;
|
|
bool next=0;
|
|
bool ack=0;
|
|
bool frame=0;
|
|
|
|
|
|
urgent chan ML;
|
|
urgent chan LM;
|
|
urgent chan LR;
|
|
urgent chan RL;</declaration>
|
|
<template>
|
|
<name x="5" y="5">Sender</name>
|
|
<declaration>clock sc;
|
|
clock fc;
|
|
clock x0; //timer
|
|
clock x1; //timer
|
|
bool next = 0;</declaration>
|
|
<location id="id0" x="93" y="34">
|
|
<name x="33" y="0">canSend1</name>
|
|
</location>
|
|
<location id="id1" x="467" y="42">
|
|
<name x="484" y="34">canSend0</name>
|
|
</location>
|
|
<location id="id2" x="93" y="170">
|
|
<name x="16" y="161">waitACK1</name>
|
|
<label kind="invariant" x="50" y="187">x1 <= 50</label>
|
|
</location>
|
|
<location id="id3" x="467" y="170">
|
|
<name x="484" y="162">waitACK0</name>
|
|
<label kind="invariant" x="484" y="179">x0 <= 50</label>
|
|
</location>
|
|
<location id="id4" x="331" y="272">
|
|
<name x="306" y="289">lostPacket0</name>
|
|
<label kind="invariant" x="314" y="306">sc <= 2</label>
|
|
</location>
|
|
<location id="id5" x="246" y="272">
|
|
<name x="212" y="289">lostPacket1</name>
|
|
<label kind="invariant" x="221" y="306">sc <= 2</label>
|
|
</location>
|
|
<location id="id6" x="348" y="153">
|
|
<name x="297" y="119">receivedACK0</name>
|
|
<label kind="invariant" x="297" y="162">sc <= 4</label>
|
|
</location>
|
|
<location id="id7" x="221" y="153">
|
|
<name x="179" y="119">receivedACK1</name>
|
|
<label kind="invariant" x="229" y="161">sc <= 4</label>
|
|
</location>
|
|
<location id="id8" x="280" y="-8">
|
|
<name x="246" y="-59">waitPacket</name>
|
|
<label kind="invariant" x="263" y="-42">sc<=5</label>
|
|
</location>
|
|
<init ref="id8"/>
|
|
<transition>
|
|
<source ref="id3"/>
|
|
<target ref="id4"/>
|
|
<label kind="guard" x="408" y="212">x0 == 50</label>
|
|
<label kind="assignment" x="382" y="229">sc := 0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id1"/>
|
|
<target ref="id3"/>
|
|
<label kind="synchronisation" x="442" y="76">ML!</label>
|
|
<label kind="assignment" x="416" y="93">x0 := 0,
|
|
fc := 0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id2"/>
|
|
<target ref="id5"/>
|
|
<label kind="guard" x="93" y="204">x1 == 50</label>
|
|
<label kind="assignment" x="119" y="221">sc := 0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id0"/>
|
|
<target ref="id2"/>
|
|
<label kind="synchronisation" x="102" y="85">ML!</label>
|
|
<label kind="assignment" x="102" y="102">x1 :=0,
|
|
fc := 0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id7"/>
|
|
<target ref="id5"/>
|
|
<label kind="guard" x="238" y="204">ack != next</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id6"/>
|
|
<target ref="id4"/>
|
|
<label kind="guard" x="340" y="187">ack != next</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id3"/>
|
|
<target ref="id6"/>
|
|
<label kind="synchronisation" x="382" y="136">LM!</label>
|
|
<label kind="assignment" x="374" y="161">sc :=0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id2"/>
|
|
<target ref="id7"/>
|
|
<label kind="synchronisation" x="144" y="144">LM!</label>
|
|
<label kind="assignment" x="144" y="161">sc := 0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id8"/>
|
|
<target ref="id1"/>
|
|
<label kind="guard" x="314" y="8">sc >= 2 && next == 0</label>
|
|
<label kind="assignment" x="331" y="-8">frame := next</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id8"/>
|
|
<target ref="id0"/>
|
|
<label kind="guard" x="119" y="8">sc >= 2 && next == 1</label>
|
|
<label kind="assignment" x="136" y="-8">frame := next</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id5"/>
|
|
<target ref="id0"/>
|
|
<label kind="guard" x="68" y="255">sc >= 1</label>
|
|
<nail x="8" y="272"/>
|
|
<nail x="8" y="127"/>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id4"/>
|
|
<target ref="id1"/>
|
|
<label kind="guard" x="442" y="255">sc >= 1</label>
|
|
<nail x="552" y="272"/>
|
|
<nail x="552" y="119"/>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id6"/>
|
|
<target ref="id8"/>
|
|
<label kind="guard" x="280" y="76">sc >= 2 && ack == next</label>
|
|
<label kind="assignment" x="306" y="42">sc :=0,
|
|
next := !next</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id7"/>
|
|
<target ref="id8"/>
|
|
<label kind="guard" x="127" y="68">sc >= 2 && ack == next</label>
|
|
<label kind="assignment" x="178" y="34">sc :=0,
|
|
next := !next</label>
|
|
</transition>
|
|
</template>
|
|
<template>
|
|
<name>Receiver</name>
|
|
<declaration>clock rc;
|
|
bool correctFrame=0;</declaration>
|
|
<location id="id9" x="-32869" y="-5049">
|
|
<name x="-32879" y="-5083">dupPacket</name>
|
|
<label kind="invariant" x="-32852" y="-5058">rc < 5</label>
|
|
</location>
|
|
<location id="id10" x="-32997" y="-5177">
|
|
<name x="-33065" y="-5185">canACK</name>
|
|
</location>
|
|
<location id="id11" x="-32997" y="-4914">
|
|
<name x="-33091" y="-4922">donePacket</name>
|
|
<label kind="invariant" x="-33014" y="-4897">rc<=3</label>
|
|
</location>
|
|
<location id="id12" x="-32717" y="-4914">
|
|
<name x="-32700" y="-4922">receivedPacket</name>
|
|
<label kind="invariant" x="-32734" y="-4897">rc<=4</label>
|
|
</location>
|
|
<location id="id13" x="-32716" y="-5176">
|
|
<name x="-32699" y="-5184">waitPacket</name>
|
|
</location>
|
|
<init ref="id13"/>
|
|
<transition>
|
|
<source ref="id9"/>
|
|
<target ref="id10"/>
|
|
<label kind="guard" x="-32946" y="-5142">rc >= 2</label>
|
|
<label kind="assignment" x="-32929" y="-5126">ack := !correctFrame</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id12"/>
|
|
<target ref="id9"/>
|
|
<label kind="guard" x="-32971" y="-5006">frame != correctFrame && rc >= 2</label>
|
|
<label kind="assignment" x="-32852" y="-4990">rc := 0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id10"/>
|
|
<target ref="id13"/>
|
|
<label kind="synchronisation" x="-32869" y="-5194">RL!</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id11"/>
|
|
<target ref="id10"/>
|
|
<label kind="guard" x="-33048" y="-5049">rc>=2</label>
|
|
<label kind="assignment" x="-33133" y="-5083">ack := correctFrame,
|
|
correctFrame := !correctFrame</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id13"/>
|
|
<target ref="id12"/>
|
|
<label kind="synchronisation" x="-32708" y="-5066">LR!</label>
|
|
<label kind="assignment" x="-32708" y="-5049">rc:=0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id12"/>
|
|
<target ref="id11"/>
|
|
<label kind="guard" x="-32946" y="-4913">rc>=2 && frame == correctFrame</label>
|
|
<label kind="assignment" x="-32869" y="-4931">rc:=0</label>
|
|
</transition>
|
|
</template>
|
|
<template>
|
|
<name>Link</name>
|
|
<declaration>clock lc;</declaration>
|
|
<location id="id14" x="-34" y="-238">
|
|
<name x="-44" y="-272">lostPacket</name>
|
|
</location>
|
|
<location id="id15" x="-161" y="-8">
|
|
<name x="-238" y="-17">canSend</name>
|
|
</location>
|
|
<location id="id16" x="-161" y="-178">
|
|
<name x="-280" y="-187">receivedPacket</name>
|
|
<label kind="invariant" x="-178" y="-212">lc<8</label>
|
|
</location>
|
|
<location id="id17" x="93" y="-8">
|
|
<name x="110" y="-17">canACK</name>
|
|
</location>
|
|
<location id="id18" x="93" y="-178">
|
|
<name x="110" y="-187">receivedACK</name>
|
|
<label kind="invariant" x="76" y="-212">lc<8</label>
|
|
</location>
|
|
<location id="id19" x="-34" y="-93">
|
|
</location>
|
|
<init ref="id19"/>
|
|
<transition>
|
|
<source ref="id14"/>
|
|
<target ref="id19"/>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id18"/>
|
|
<target ref="id14"/>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id16"/>
|
|
<target ref="id14"/>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id15"/>
|
|
<target ref="id19"/>
|
|
<label kind="synchronisation" x="-102" y="-51">LR?</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id16"/>
|
|
<target ref="id15"/>
|
|
<label kind="guard" x="-204" y="-110">lc>=6</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id19"/>
|
|
<target ref="id16"/>
|
|
<label kind="synchronisation" x="-102" y="-153">ML?</label>
|
|
<label kind="assignment" x="-110" y="-119">lc:=0</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id17"/>
|
|
<target ref="id19"/>
|
|
<label kind="synchronisation" x="0" y="-51">LM?</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id18"/>
|
|
<target ref="id17"/>
|
|
<label kind="guard" x="102" y="-102">lc>=6</label>
|
|
</transition>
|
|
<transition>
|
|
<source ref="id19"/>
|
|
<target ref="id18"/>
|
|
<label kind="synchronisation" x="8" y="-153">RL?</label>
|
|
<label kind="assignment" x="8" y="-119">lc:=0</label>
|
|
</transition>
|
|
</template>
|
|
<system>sender = Sender();
|
|
receiver = Receiver();
|
|
link = Link();
|
|
|
|
system sender, receiver, link;</system>
|
|
<queries>
|
|
<query>
|
|
<formula>A[] (not deadlock)
|
|
</formula>
|
|
<comment>
|
|
</comment>
|
|
</query>
|
|
<query>
|
|
<formula>sender.waitACK0 || sender.waitACK1 --> (sender.receivedACK0 || sender.receivedACK1)
|
|
</formula>
|
|
<comment>
|
|
</comment>
|
|
</query>
|
|
<query>
|
|
<formula>E<> (sender.receivedACK0 && ack == next )
|
|
</formula>
|
|
<comment>
|
|
</comment>
|
|
</query>
|
|
<query>
|
|
<formula>link.lostPacket --> (sender.canSend0 || sender.canSend1 || receiver.canACK)
|
|
</formula>
|
|
<comment>
|
|
</comment>
|
|
</query>
|
|
</queries>
|
|
</nta>
|