2020-05-21 13:57:43 +02:00
|
|
|
<?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 ack = 0;
|
|
|
|
bool frame = 0;
|
|
|
|
bool expected=0;
|
|
|
|
|
|
|
|
|
|
|
|
urgent chan ML;
|
|
|
|
urgent chan LM;
|
|
|
|
urgent chan LR;
|
|
|
|
urgent chan RL;
|
|
|
|
|
|
|
|
int TOUT = 160; // timeout</declaration>
|
|
|
|
<template>
|
|
|
|
<name x="5" y="5">Sender_2t</name>
|
|
|
|
<declaration>clock sc;
|
|
|
|
clock fc;
|
|
|
|
|
|
|
|
clock timer0;
|
|
|
|
clock timer1;
|
|
|
|
|
|
|
|
bool next = 0;</declaration>
|
|
|
|
<location id="id0" x="-153" y="0">
|
|
|
|
<name x="-213" y="-34">send_pkg1</name>
|
|
|
|
</location>
|
|
|
|
<location id="id1" x="654" y="-8">
|
|
|
|
<name x="671" y="-16">send_pkg</name>
|
|
|
|
</location>
|
|
|
|
<location id="id2" x="-153" y="187">
|
|
|
|
<name x="-163" y="153">wait_ack1</name>
|
|
|
|
<label kind="invariant" x="-196" y="204">timer1 <= TOUT</label>
|
|
|
|
</location>
|
|
|
|
<location id="id3" x="646" y="178">
|
|
|
|
<name x="663" y="170">wait_ack</name>
|
|
|
|
<label kind="invariant" x="663" y="187">timer0 <= TOUT</label>
|
|
|
|
</location>
|
|
|
|
<location id="id4" x="476" y="323">
|
|
|
|
<name x="451" y="340">recover_loss</name>
|
|
|
|
<label kind="invariant" x="459" y="357">sc <= 2</label>
|
|
|
|
</location>
|
|
|
|
<location id="id5" x="51" y="323">
|
|
|
|
<label kind="invariant" x="34" y="340">sc <= 2</label>
|
|
|
|
</location>
|
|
|
|
<location id="id6" x="399" y="178">
|
|
|
|
<name x="348" y="144">received_ack</name>
|
|
|
|
<label kind="invariant" x="348" y="187">sc <= 4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id7" x="170" y="178">
|
|
|
|
<name x="160" y="144">received_ack1</name>
|
|
|
|
<label kind="invariant" x="178" y="186">sc <= 4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id8" x="280" y="-8">
|
|
|
|
<name x="246" y="-59">wait</name>
|
|
|
|
<label kind="invariant" x="263" y="-42">sc<=2</label>
|
|
|
|
</location>
|
|
|
|
<init ref="id8"/>
|
|
|
|
<transition>
|
|
|
|
<source ref="id3"/>
|
|
|
|
<target ref="id4"/>
|
|
|
|
<label kind="guard" x="578" y="238">timer0 == TOUT</label>
|
|
|
|
<label kind="assignment" x="552" y="255">sc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id1"/>
|
|
|
|
<target ref="id3"/>
|
|
|
|
<label kind="synchronisation" x="612" y="68">ML!</label>
|
|
|
|
<label kind="assignment" x="586" y="85">timer0 := 0,
|
|
|
|
fc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id2"/>
|
|
|
|
<target ref="id5"/>
|
|
|
|
<label kind="guard" x="-76" y="221">timer1 == TOUT</label>
|
|
|
|
<label kind="assignment" x="-42" y="238">sc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id0"/>
|
|
|
|
<target ref="id2"/>
|
|
|
|
<label kind="synchronisation" x="-136" y="76">ML!</label>
|
|
|
|
<label kind="assignment" x="-136" y="93">timer1 :=0,
|
|
|
|
fc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id7"/>
|
|
|
|
<target ref="id5"/>
|
|
|
|
<label kind="guard" x="119" y="238">ack != next</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id6"/>
|
|
|
|
<target ref="id4"/>
|
|
|
|
<label kind="guard" x="399" y="255">ack != next</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id3"/>
|
|
|
|
<target ref="id6"/>
|
|
|
|
<label kind="synchronisation" x="510" y="161">LM!</label>
|
|
|
|
<label kind="assignment" x="502" y="186">sc :=0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id2"/>
|
|
|
|
<target ref="id7"/>
|
|
|
|
<label kind="synchronisation" x="-17" y="153">LM!</label>
|
|
|
|
<label kind="assignment" x="-17" y="170">sc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id8"/>
|
|
|
|
<target ref="id1"/>
|
2020-06-04 23:48:32 +02:00
|
|
|
<label kind="guard" x="408" y="-25">sc >= 2 && next == 0</label>
|
2020-05-21 13:57:43 +02:00
|
|
|
<label kind="assignment" x="425" y="-41">frame := next</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id8"/>
|
|
|
|
<target ref="id0"/>
|
|
|
|
<label kind="guard" x="-34" y="-26">sc >= 2 && next == 1</label>
|
|
|
|
<label kind="assignment" x="-17" y="-42">frame := next</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id5"/>
|
|
|
|
<target ref="id0"/>
|
|
|
|
<label kind="guard" x="-221" y="314">sc >= 1</label>
|
|
|
|
<nail x="-281" y="331"/>
|
|
|
|
<nail x="-281" y="186"/>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id4"/>
|
|
|
|
<target ref="id1"/>
|
|
|
|
<label kind="guard" x="680" y="289">sc >= 1</label>
|
|
|
|
<nail x="790" y="306"/>
|
|
|
|
<nail x="790" y="153"/>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id6"/>
|
|
|
|
<target ref="id8"/>
|
|
|
|
<label kind="guard" x="365" y="93">sc >= 2 && ack == next</label>
|
|
|
|
<label kind="assignment" x="348" y="34">sc :=0,
|
|
|
|
next := !next,
|
|
|
|
expected := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id7"/>
|
|
|
|
<target ref="id8"/>
|
|
|
|
<label kind="guard" x="0" y="110">sc >= 2 && ack == next</label>
|
|
|
|
<label kind="assignment" x="51" y="51">sc :=0,
|
|
|
|
next := !next,
|
|
|
|
expected := 1</label>
|
|
|
|
</transition>
|
|
|
|
</template>
|
|
|
|
<template>
|
|
|
|
<name>Receiver</name>
|
|
|
|
<declaration>clock rc;
|
|
|
|
bool r_frame = 0;</declaration>
|
|
|
|
<location id="id9" x="-32955" y="-5108">
|
|
|
|
<name x="-32929" y="-5125">is_dup</name>
|
|
|
|
<label kind="invariant" x="-32920" y="-5100">rc <= 4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id10" x="-33150" y="-4947">
|
|
|
|
<name x="-33201" y="-4930">send_ack</name>
|
|
|
|
</location>
|
|
|
|
<location id="id11" x="-32751" y="-4956">
|
|
|
|
<name x="-32725" y="-4964">done_pkg</name>
|
|
|
|
<label kind="invariant" x="-32768" y="-4939">rc<=4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id12" x="-32742" y="-5278">
|
|
|
|
<name x="-32725" y="-5287">recv_pkg</name>
|
|
|
|
<label kind="invariant" x="-32759" y="-5261">rc<=4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id13" x="-33150" y="-5278">
|
|
|
|
<name x="-33184" y="-5321">wait</name>
|
|
|
|
</location>
|
|
|
|
<init ref="id13"/>
|
|
|
|
<transition>
|
|
|
|
<source ref="id9"/>
|
|
|
|
<target ref="id10"/>
|
|
|
|
<label kind="guard" x="-33065" y="-5066">rc >= 2</label>
|
|
|
|
<label kind="assignment" x="-33073" y="-5015">ack := !r_frame</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id12"/>
|
|
|
|
<target ref="id9"/>
|
|
|
|
<label kind="guard" x="-33090" y="-5219">frame != r_frame && rc >= 2</label>
|
|
|
|
<label kind="assignment" x="-32861" y="-5185">rc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id10"/>
|
|
|
|
<target ref="id13"/>
|
|
|
|
<label kind="synchronisation" x="-33192" y="-5074">RL!</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id11"/>
|
|
|
|
<target ref="id10"/>
|
|
|
|
<label kind="guard" x="-32963" y="-4981">rc>=2</label>
|
|
|
|
<label kind="assignment" x="-33048" y="-4938">ack := r_frame,
|
|
|
|
r_frame := !r_frame</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id13"/>
|
|
|
|
<target ref="id12"/>
|
|
|
|
<label kind="synchronisation" x="-32903" y="-5338">LR!</label>
|
|
|
|
<label kind="assignment" x="-32903" y="-5321">rc:=0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id12"/>
|
|
|
|
<target ref="id11"/>
|
|
|
|
<label kind="guard" x="-32750" y="-5049">rc>=2 && frame == r_frame</label>
|
|
|
|
<label kind="assignment" x="-32674" y="-5066">rc:=0</label>
|
|
|
|
</transition>
|
|
|
|
</template>
|
|
|
|
<template>
|
|
|
|
<name>Link</name>
|
|
|
|
<declaration>clock lc;</declaration>
|
|
|
|
<location id="id14" x="-34" y="-297">
|
|
|
|
<name x="-44" y="-331">loss</name>
|
|
|
|
</location>
|
|
|
|
<location id="id15" x="-263" y="60">
|
|
|
|
<name x="-340" y="51">resend_pkg</name>
|
|
|
|
</location>
|
|
|
|
<location id="id16" x="-255" y="-187">
|
|
|
|
<name x="-417" y="-196">received_pkg</name>
|
|
|
|
<label kind="invariant" x="-272" y="-221">lc<4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id17" x="179" y="60">
|
|
|
|
<name x="196" y="51">resend_ack</name>
|
|
|
|
</location>
|
|
|
|
<location id="id18" x="187" y="-187">
|
|
|
|
<name x="204" y="-196">received_ack</name>
|
|
|
|
<label kind="invariant" x="170" y="-221">lc<4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id19" x="-34" y="-93">
|
|
|
|
<name x="-25" y="-136">idle</name>
|
|
|
|
</location>
|
|
|
|
<init ref="id19"/>
|
|
|
|
<transition>
|
|
|
|
<source ref="id18"/>
|
|
|
|
<target ref="id14"/>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id16"/>
|
|
|
|
<target ref="id14"/>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id14"/>
|
|
|
|
<target ref="id19"/>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id15"/>
|
|
|
|
<target ref="id19"/>
|
|
|
|
<label kind="synchronisation" x="-110" y="26">LR?</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id16"/>
|
|
|
|
<target ref="id15"/>
|
|
|
|
<label kind="guard" x="-298" y="-119">lc>=2</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id19"/>
|
|
|
|
<target ref="id16"/>
|
|
|
|
<label kind="synchronisation" x="-178" y="-170">ML?</label>
|
|
|
|
<label kind="assignment" x="-178" y="-127">lc:=0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id17"/>
|
|
|
|
<target ref="id19"/>
|
|
|
|
<label kind="synchronisation" x="86" y="17">LM?</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id18"/>
|
|
|
|
<target ref="id17"/>
|
|
|
|
<label kind="guard" x="196" y="-111">lc>=2</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id19"/>
|
|
|
|
<target ref="id18"/>
|
|
|
|
<label kind="synchronisation" x="102" y="-162">RL?</label>
|
|
|
|
<label kind="assignment" x="102" y="-128">lc:=0</label>
|
|
|
|
</transition>
|
|
|
|
</template>
|
|
|
|
<template>
|
|
|
|
<name>Sender_1t</name>
|
|
|
|
<declaration>clock sc;
|
|
|
|
clock fc;
|
|
|
|
|
|
|
|
clock timer0;
|
|
|
|
clock timer1;
|
2020-05-21 19:27:27 +02:00
|
|
|
clock attesa;
|
2020-05-21 13:57:43 +02:00
|
|
|
|
|
|
|
bool next = 0;
|
|
|
|
</declaration>
|
|
|
|
<location id="id20" x="-1598" y="-221">
|
|
|
|
<name x="-1581" y="-229">send_pkg</name>
|
|
|
|
</location>
|
2020-06-04 23:48:32 +02:00
|
|
|
<location id="id21" x="-1598" y="-34">
|
|
|
|
<name x="-1581" y="-42">wait_ack</name>
|
|
|
|
<label kind="invariant" x="-1581" y="-25">timer0 <= TOUT</label>
|
2020-05-21 13:57:43 +02:00
|
|
|
</location>
|
|
|
|
<location id="id22" x="-1904" y="111">
|
|
|
|
<name x="-1929" y="128">recover_loss</name>
|
|
|
|
<label kind="invariant" x="-1921" y="145">sc <= 2</label>
|
|
|
|
</location>
|
|
|
|
<location id="id23" x="-1972" y="-25">
|
|
|
|
<name x="-2023" y="-59">received_ack</name>
|
|
|
|
<label kind="invariant" x="-2023" y="-16">sc <= 4</label>
|
|
|
|
</location>
|
|
|
|
<location id="id24" x="-1972" y="-221">
|
|
|
|
<name x="-2006" y="-272">wait</name>
|
|
|
|
<label kind="invariant" x="-1989" y="-255">sc<=2</label>
|
|
|
|
</location>
|
|
|
|
<init ref="id24"/>
|
|
|
|
<transition>
|
|
|
|
<source ref="id21"/>
|
|
|
|
<target ref="id22"/>
|
|
|
|
<label kind="guard" x="-1674" y="25">timer0 == TOUT</label>
|
|
|
|
<label kind="assignment" x="-1700" y="42">sc := 0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id20"/>
|
|
|
|
<target ref="id21"/>
|
|
|
|
<label kind="synchronisation" x="-1640" y="-145">ML!</label>
|
|
|
|
<label kind="assignment" x="-1666" y="-128">timer0 := 0,
|
2020-05-21 19:27:27 +02:00
|
|
|
fc := 0,
|
|
|
|
attesa := 0</label>
|
2020-05-21 13:57:43 +02:00
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id23"/>
|
|
|
|
<target ref="id22"/>
|
|
|
|
<label kind="guard" x="-1981" y="43">ack != next</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id21"/>
|
|
|
|
<target ref="id23"/>
|
|
|
|
<label kind="synchronisation" x="-1742" y="-52">LM!</label>
|
|
|
|
<label kind="assignment" x="-1750" y="-27">sc :=0</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id24"/>
|
|
|
|
<target ref="id20"/>
|
|
|
|
<label kind="guard" x="-1844" y="-238">sc >= 1</label>
|
|
|
|
<label kind="assignment" x="-1827" y="-254">frame := next</label>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id22"/>
|
|
|
|
<target ref="id20"/>
|
|
|
|
<label kind="guard" x="-1572" y="76">sc >= 1</label>
|
|
|
|
<nail x="-1462" y="93"/>
|
|
|
|
<nail x="-1462" y="-60"/>
|
|
|
|
</transition>
|
|
|
|
<transition>
|
|
|
|
<source ref="id23"/>
|
|
|
|
<target ref="id24"/>
|
2020-06-04 23:48:32 +02:00
|
|
|
<label kind="guard" x="-1972" y="-144">sc >= 2 && ack == next</label>
|
|
|
|
<label kind="assignment" x="-1972" y="-178">sc :=0,
|
2020-05-21 13:57:43 +02:00
|
|
|
next := !next</label>
|
|
|
|
</transition>
|
|
|
|
</template>
|
2020-05-21 19:27:27 +02:00
|
|
|
<system>sender = Sender_1t();
|
2020-05-21 13:57:43 +02:00
|
|
|
receiver = Receiver();
|
|
|
|
link = Link();
|
|
|
|
|
|
|
|
system sender, receiver, link;</system>
|
|
|
|
<queries>
|
|
|
|
<query>
|
|
|
|
<formula>A[] (not deadlock)
|
|
|
|
</formula>
|
|
|
|
<comment>
|
|
|
|
</comment>
|
|
|
|
</query>
|
|
|
|
<query>
|
|
|
|
<formula>sender.wait_ack || sender.wait_ack1 --> (sender.received_ack || sender.received_ack1)
|
|
|
|
</formula>
|
|
|
|
<comment>
|
|
|
|
</comment>
|
|
|
|
</query>
|
|
|
|
<query>
|
|
|
|
<formula>link.loss --> (sender.send_pkg || receiver.send_ack)
|
|
|
|
</formula>
|
|
|
|
<comment>
|
|
|
|
</comment>
|
|
|
|
</query>
|
|
|
|
<query>
|
|
|
|
<formula>E<> (ack == expected)
|
|
|
|
</formula>
|
|
|
|
<comment>
|
|
|
|
</comment>
|
|
|
|
</query>
|
|
|
|
<query>
|
|
|
|
<formula>link.loss --> (sender.send_pkg || sender.send_pkg1 || receiver.send_ack)
|
|
|
|
</formula>
|
|
|
|
<comment>
|
|
|
|
</comment>
|
|
|
|
</query>
|
|
|
|
</queries>
|
|
|
|
</nta>
|