<?xml version="1.0"?>
<!DOCTYPE nta PUBLIC "-//Uppaal Team//DTD Flat System 1.0//EN" "http://www.docs.uu.se/docs/rtmv/uppaal/xml/flat-1_0.dtd">
<nta><declaration>// Global Declarations

chan tick, tock, edge, get, put;

broadcast chan fuzz, settle, Sample;

int m, n;

bool in, out, v, w, s, new, old, buf;

clock x, y, z;

const cell 14;

const mark 7;

const sample 10;

const min 93;

const max 100;

const edgelength 100;</declaration><template><name x="5" y="5">Coder</name><parameter x="10" y="25"/><declaration/><location id="id4" x="320" y="240"><name x="344" y="240">C4</name><urgent/></location><location id="id2" x="320" y="128"><name x="345" y="112">C3</name></location><location id="id3" x="320" y="352"><name x="344" y="357">C2</name></location><location id="id1" x="96" y="352"><name x="58" y="360">C1</name><urgent/></location><location id="id0" x="96" y="128"><name x="86" y="98">C0</name><urgent/></location><init ref="id0"/><transition><source ref="id0"/><target ref="id1"/><label kind="synchronisation" x="56" y="232">get?</label></transition><transition><source ref="id1"/><target ref="id3"/><label kind="guard" x="184" y="376">in == 1</label><label kind="synchronisation" x="184" y="360">edge!</label></transition><transition><source ref="id3"/><target ref="id3"/><label kind="guard" x="360" y="416">n &lt; mark - 1</label><label kind="synchronisation" x="360" y="400">tick?</label><label kind="assignment" x="360" y="432">n := n+1</label><nail x="320" y="448"/><nail x="352" y="448"/></transition><transition><source ref="id1"/><target ref="id2"/><label kind="guard" x="192" y="280">in == 0</label><label kind="synchronisation" x="192" y="264">edge!</label></transition><transition><source ref="id2"/><target ref="id2"/><label kind="guard" x="368" y="48">n &lt; cell - 1</label><label kind="synchronisation" x="368" y="32">tick?</label><label kind="assignment" x="368" y="64">n := n+1</label><nail x="320" y="32"/><nail x="352" y="32"/></transition><transition><source ref="id2"/><target ref="id0"/><label kind="guard" x="136" y="152">n == cell - 1</label><label kind="synchronisation" x="136" y="136">tick?</label><label kind="assignment" x="136" y="168">n := 0</label></transition><transition><source ref="id4"/><target ref="id2"/><label kind="synchronisation" x="328" y="168">edge!</label></transition><transition><source ref="id3"/><target ref="id4"/><label kind="guard" x="328" y="288">n == mark - 1</label><label kind="synchronisation" x="328" y="272">tick?</label><label kind="assignment" x="328" y="304">n := n+1</label></transition></template><template><name x="5" y="5">Clock</name><parameter x="10" y="25"/><declaration/><location id="id5" x="128" y="96"><name x="90" y="90">X0</name><label kind="invariant" x="56" y="112">x &lt;= max</label></location><init ref="id5"/><transition><source ref="id5"/><target ref="id5"/><label kind="guard" x="240" y="80">x &gt;= min</label><label kind="synchronisation" x="240" y="96">tick!</label><label kind="assignment" x="240" y="112">x := 0</label><nail x="224" y="128"/><nail x="224" y="96"/></transition></template><template><name x="8" y="0">Wire</name><parameter x="13" y="20"/><declaration/><location id="id8" x="544" y="128"><name x="534" y="98">W2</name></location><location id="id7" x="352" y="128"><name x="384" y="136">W1</name><label kind="invariant" x="384" y="152">z &lt;= edgelength</label></location><location id="id6" x="160" y="128"><name x="112" y="120">W0</name></location><init ref="id6"/><transition><source ref="id7"/><target ref="id7"/><label kind="assignment" x="392" y="216">w := 1 - w</label><label kind="synchronisation" x="392" y="200">fuzz!</label><nail x="352" y="224"/><nail x="384" y="224"/></transition><transition><source ref="id6"/><target ref="id7"/><label kind="synchronisation" x="192" y="72">edge?</label><label kind="assignment" x="192" y="88">z := 0,
v := 1 - v</label></transition><transition><source ref="id7"/><target ref="id6"/><label kind="guard" x="176" y="208">z == edgelength</label><label kind="assignment" x="176" y="224">w := v</label><label kind="synchronisation" x="176" y="192">settle!</label><nail x="220" y="192"/></transition><transition><source ref="id7"/><target ref="id8"/><label kind="synchronisation" x="456" y="104">edge?</label></transition></template><template><name x="5" y="5">Sampler</name><parameter x="10" y="25"/><declaration/><location id="id9" x="96" y="128"/><init ref="id9"/><transition><source ref="id9"/><target ref="id9"/><label kind="guard" x="208" y="112">s == 0</label><label kind="assignment" x="208" y="144">new := w,
s := 1</label><label kind="synchronisation" x="208" y="128">Sample!</label><nail x="192" y="128"/><nail x="192" y="160"/></transition></template><template><name x="5" y="5">Decoder</name><parameter x="10" y="25"/><declaration/><location id="id13" x="320" y="384"><name x="344" y="376">D2</name><urgent/></location><location id="id12" x="320" y="160"><name x="336" y="168">D1</name></location><location id="id11" x="96" y="160"><name x="72" y="176">D0</name></location><init ref="id11"/><transition><source ref="id11"/><target ref="id12"/><label kind="guard" x="184" y="184">new != old</label><label kind="synchronisation" x="184" y="168">tock?</label><label kind="assignment" x="184" y="200">old := new</label></transition><transition><source ref="id13"/><target ref="id11"/><label kind="synchronisation" x="152" y="272">put!</label><label kind="assignment" x="152" y="288">m := 0</label></transition><transition><source ref="id12"/><target ref="id13"/><label kind="guard" x="328" y="256">m == sample - 1</label><label kind="synchronisation" x="328" y="240">tock?</label><label kind="assignment" x="328" y="272">out := (new != old),
m := m + 1,
old := new</label></transition><transition><source ref="id12"/><target ref="id12"/><label kind="guard" x="360" y="80">m &lt; sample - 1</label><label kind="synchronisation" x="360" y="64">tock?</label><label kind="assignment" x="360" y="96">m := m+1</label><nail x="320" y="64"/><nail x="352" y="64"/></transition><transition><source ref="id11"/><target ref="id11"/><label kind="guard" x="136" y="80">new == old</label><label kind="synchronisation" x="136" y="64">tock?</label><nail x="96" y="64"/><nail x="128" y="64"/></transition></template><template><name x="8" y="0">Tester</name><parameter x="13" y="20"/><declaration/><location id="id18" x="576" y="224"><name x="576" y="240">T3</name></location><location id="id16" x="416" y="224"><name x="424" y="240">T2</name></location><location id="id15" x="256" y="224"><name x="264" y="240">T1</name></location><location id="id17" x="256" y="384"><name x="232" y="400">Error</name></location><location id="id14" x="96" y="224"><name x="104" y="240">T0</name></location><init ref="id14"/><transition><source ref="id14"/><target ref="id15"/><label kind="synchronisation" x="152" y="232">get!</label><label kind="assignment" x="152" y="248">in := 1</label></transition><transition><source ref="id15"/><target ref="id16"/><label kind="synchronisation" x="312" y="232">get!</label><label kind="assignment" x="312" y="248">buf := in,
in := 1</label></transition><transition><source ref="id15"/><target ref="id17"/><label kind="guard" x="264" y="336">out != in</label><label kind="synchronisation" x="264" y="320">put?</label></transition><transition><source ref="id14"/><target ref="id17"/><label kind="synchronisation" x="104" y="320">put?</label><nail x="96" y="384"/></transition><transition><source ref="id14"/><target ref="id15"/><label kind="synchronisation" x="152" y="160">get!</label><label kind="assignment" x="152" y="176">in := 0</label><nail x="160" y="192"/></transition><transition><source ref="id15"/><target ref="id14"/><label kind="guard" x="120" y="80">out == in</label><label kind="synchronisation" x="120" y="64">put?</label><nail x="224" y="96"/><nail x="96" y="96"/></transition><transition><source ref="id15"/><target ref="id16"/><label kind="synchronisation" x="312" y="144">get!</label><label kind="assignment" x="312" y="160">buf := in,
in := 0</label><nail x="320" y="192"/></transition><transition><source ref="id16"/><target ref="id15"/><label kind="guard" x="312" y="80">out == buf</label><label kind="synchronisation" x="312" y="64">put?</label><nail x="416" y="96"/><nail x="288" y="96"/></transition><transition><source ref="id16"/><target ref="id17"/><label kind="guard" x="424" y="336">out != buf</label><label kind="synchronisation" x="424" y="320">put?</label><nail x="416" y="384"/></transition><transition><source ref="id16"/><target ref="id18"/><label kind="synchronisation" x="472" y="232">get!</label></transition></template><template><name x="5" y="5">Clock2</name><parameter x="5" y="20"/><declaration/><location id="id19" x="128" y="128"><label kind="invariant" x="56" y="144">y &lt;= max</label></location><init ref="id19"/><transition><source ref="id19"/><target ref="id19"/><label kind="guard" x="232" y="112">y &gt;=min &amp;&amp; s==1</label><label kind="synchronisation" x="232" y="128">tock!</label><label kind="assignment" x="232" y="144">y := 0,
s := 0</label><nail x="224" y="128"/><nail x="224" y="160"/></transition></template><instantiation/><system>system Coder, Clock, Wire, Sampler, Clock2, Decoder, Tester;</system></nta>