<?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>//Insert declarations of global clocks, variables, constants and channels.

const N 2;

const wireCount0 2;
int[0, wireCount0] bus0Wire;

const wireCount1 4;
int[0, wireCount1] bus1Wire;


chan begSig, endSig, begBuff, endBuff, begMem,endMem;
chan switch, tick, tack;

int space[N*2];
int reg[N];

int[0,1] ready[N];

int[0,N] openBus;

int[0,3] turn;

int starting:=0;
urgent chan start;


//clock systemtime;</declaration>
  
  <template><name x="88" y="128">Adder</name><parameter x="83" y="155">chan begA, endA;
chan begAp, endAp;
chan begS, endS;
chan begSp, endSp</parameter><declaration/><location id="id5" x="248" y="320"><name x="200" y="312">Start</name></location><location id="id12" x="368" y="224"><committed/><committed/><committed/><committed/></location><location id="id13" x="512" y="224"><committed/><committed/><committed/></location><location id="id14" x="648" y="224"><committed/></location><location id="id15" x="744" y="320"><name x="736" y="288">Wait</name></location><location id="id16" x="656" y="400"><committed/></location><location id="id17" x="520" y="400"><committed/></location><location id="id18" x="368" y="400"><committed/></location><init ref="id5"/><transition><source ref="id5"/><target ref="id12"/><label kind="synchronisation" x="264" y="240">begA?</label></transition><transition><source ref="id12"/><target ref="id13"/><label kind="synchronisation" x="400" y="200">begAp?</label></transition><transition><source ref="id13"/><target ref="id14"/><label kind="synchronisation" x="548" y="200">begS?</label></transition><transition><source ref="id14"/><target ref="id15"/><label kind="synchronisation" x="688" y="240">begSp?</label></transition><transition><source ref="id15"/><target ref="id16"/><label kind="synchronisation" x="704" y="376">endA?</label></transition><transition><source ref="id16"/><target ref="id17"/><label kind="synchronisation" x="572" y="420">endAp?</label></transition><transition><source ref="id17"/><target ref="id18"/><label kind="synchronisation" x="416" y="416">endS?</label></transition><transition><source ref="id18"/><target ref="id5"/><label kind="synchronisation" x="268" y="376">endSp?</label></transition></template><template><name x="328" y="224">Arbiter</name><parameter x="328" y="248">const period;
chan beg, end</parameter><declaration>const unsafe 15625;
const refreshTime 100;
const maxSafe unsafe-25;
clock memtimer, timer;</declaration><location id="id34" x="704" y="336"><name x="720" y="328">Start</name><committed/></location><location id="id35" x="704" y="512"><name x="736" y="520">Ready</name><label kind="invariant" x="736" y="536">timer&lt;=period</label></location><location id="id36" x="352" y="512"><name x="280" y="504">Transfer</name><label kind="invariant" x="280" y="528">timer&lt;=period</label></location><location id="id20" x="704" y="704"><name x="728" y="680">Refresh</name><label kind="invariant" x="728" y="696">memtimer&lt;=unsafe+refreshTime</label><urgent/></location><location id="id26" x="352" y="336"><name x="328" y="304">Finish</name><committed/></location><location id="id27" x="480" y="512"><name x="464" y="528">Setup</name><label kind="invariant" x="432" y="544">timer&lt;=period</label></location><init ref="id34"/><transition><source ref="id34"/><target ref="id35"/><label kind="assignment" x="712" y="360">timer:=0,
openBus:=0,
memtimer:=0</label></transition><transition><source ref="id26"/><target ref="id35"/><label kind="assignment" x="384" y="336">openBus:=(openBus==N-1?0:openBus+1)</label><label kind="guard" x="384" y="312">reg[openBus]==0</label><nail x="656" y="336"/></transition><transition><source ref="id35"/><target ref="id35"/><label kind="guard" x="872" y="432">memtimer&lt;=maxSafe,
timer==period,
ready[openBus]==0</label><label kind="assignment" x="872" y="480">openBus:=(openBus==N-1?0:openBus+1),
timer:=0</label><nail x="864" y="432"/><nail x="864" y="512"/></transition><transition><source ref="id20"/><target ref="id35"/><label kind="guard" x="744" y="600">memtimer==unsafe+refreshTime</label><label kind="assignment" x="744" y="624">memtimer:=0,
timer:=0</label><nail x="736" y="656"/><nail x="736" y="568"/></transition><transition><source ref="id35"/><target ref="id20"/><label kind="guard" x="560" y="592">memtimer&gt;maxSafe</label><nail x="672" y="568"/><nail x="672" y="656"/></transition><transition><source ref="id35"/><target ref="id27"/><label kind="guard" x="520" y="408">memtimer&lt;=maxSafe,
timer==0,
ready[openBus]==1,
reg[openBus]==512</label><nail x="672" y="480"/><nail x="512" y="480"/></transition><transition><source ref="id36"/><target ref="id26"/><label kind="guard" x="392" y="376">timer==period</label><label kind="synchronisation" x="392" y="392">end!</label><label kind="assignment" x="392" y="408">timer:=0</label><nail x="384" y="464"/><nail x="384" y="376"/></transition><transition><source ref="id26"/><target ref="id36"/><label kind="guard" x="208" y="384">reg[openBus]&gt;0</label><label kind="synchronisation" x="288" y="400">beg!</label><nail x="320" y="376"/><nail x="320" y="464"/></transition><transition><source ref="id27"/><target ref="id36"/><label kind="guard" x="384" y="488">timer==period</label><label kind="assignment" x="384" y="528">timer:=0</label><label kind="synchronisation" x="384" y="512">beg!</label></transition><transition><source ref="id35"/><target ref="id27"/><label kind="guard" x="544" y="496">memtimer&lt;=maxSafe,
timer==period,
ready[openBus]==1,
reg[openBus]==512</label><label kind="assignment" x="544" y="560">timer:=0</label><nail x="669" y="542"/><nail x="513" y="544"/></transition></template><template><name x="-320" y="88">Register</name><parameter x="-144" y="88">const startId, idMem, idBuff, spaceId, status; int bus;
chan begBuff, endBuff;
chan begMem, endMem</parameter><declaration/><location id="id80" x="-192" y="480"><name x="-240" y="496">Wait</name></location><location id="id82" x="64" y="288"><name x="72" y="232">Ready</name></location><location id="id83" x="-384" y="192"><name x="-400" y="160">Start</name></location><location id="id99" x="64" y="480"><name x="-8" y="448">TransferM</name></location><location id="id100" x="-192" y="288"><name x="-224" y="256">TransferB</name></location><location id="id101" x="258" y="478"><name x="256" y="448">Prepare</name></location><location id="id102" x="256" y="288"><name x="248" y="256">bufferBusy1</name></location><location id="id103" x="64" y="672"><name x="-16" y="680">bufferBusy2</name></location><location id="id104" x="256" y="672"><name x="272" y="680">Prepare2</name></location><location id="id105" x="-192" y="672"><name x="-280" y="680">bufferBusy3</name></location><init ref="id83"/><transition><source ref="id80"/><target ref="id100"/><label kind="guard" x="-208" y="336">space[spaceId]&gt;=32,
bus==idBuff</label><label kind="synchronisation" x="-208" y="384">begBuff?</label><label kind="assignment" x="-232" y="408">reg[idMem]:=reg[idMem]+32</label><nail x="-216" y="440"/><nail x="-216" y="328"/></transition><transition><source ref="id83"/><target ref="id80"/><label kind="assignment" x="-376" y="264">reg[idMem]:=status,
ready[idMem]:=0</label><label kind="guard" x="-376" y="216">status&lt;512,
starting==startId</label><label kind="synchronisation" x="-376" y="248">start?</label><nail x="-384" y="480"/></transition><transition><source ref="id82"/><target ref="id99"/><label kind="guard" x="72" y="344">openBus==idMem</label><label kind="synchronisation" x="72" y="368">begMem?</label><label kind="assignment" x="72" y="392">reg[idMem]:=reg[idMem]-128</label></transition><transition><source ref="id99"/><target ref="id80"/><label kind="guard" x="-128" y="456">reg[idMem]==0</label><label kind="synchronisation" x="-128" y="480">endMem?</label><label kind="assignment" x="-128" y="496">ready[idMem]:=0</label></transition><transition><source ref="id99"/><target ref="id101"/><label kind="guard" x="128" y="424">reg[idMem]&gt;0</label><label kind="synchronisation" x="128" y="448">endMem?</label><nail x="112" y="448"/><nail x="208" y="448"/></transition><transition><source ref="id100"/><target ref="id80"/><label kind="synchronisation" x="-40" y="392">endBuff?</label><label kind="guard" x="-40" y="352">reg[idMem]&lt;512,
bus==idBuff</label><nail x="-48" y="336"/><nail x="-48" y="432"/></transition><transition><source ref="id101"/><target ref="id99"/><label kind="synchronisation" x="128" y="480">begMem?</label><label kind="assignment" x="72" y="496">reg[idMem]:=reg[idMem]-128</label><nail x="208" y="496"/><nail x="112" y="496"/></transition><transition><source ref="id101"/><target ref="id104"/><label kind="synchronisation" x="200" y="584">begBuff?</label><label kind="guard" x="168" y="568">bus==idBuff</label></transition><transition><source ref="id104"/><target ref="id101"/><label kind="synchronisation" x="296" y="560">endBuff?</label><label kind="guard" x="296" y="544">bus==idBuff</label><nail x="288" y="624"/><nail x="288" y="528"/></transition><transition><source ref="id102"/><target ref="id82"/><label kind="synchronisation" x="128" y="320">endBuff?</label><label kind="guard" x="112" y="296">bus==idBuff</label><nail x="208" y="320"/><nail x="112" y="320"/></transition><transition><source ref="id82"/><target ref="id102"/><label kind="synchronisation" x="144" y="256">begBuff?</label><label kind="guard" x="128" y="232">bus==idBuff</label><nail x="112" y="256"/><nail x="208" y="256"/></transition><transition><source ref="id100"/><target ref="id82"/><label kind="guard" x="-144" y="232">reg[idMem]==512, bus==idBuff</label><label kind="assignment" x="-144" y="264">ready[idMem]:=1</label><label kind="synchronisation" x="-144" y="248">endBuff?</label></transition><transition><source ref="id83"/><target ref="id82"/><label kind="guard" x="-272" y="176">status==512, starting==startId</label><label kind="assignment" x="-272" y="192">reg[idMem]:=status, ready[idMem]:=1</label><label kind="synchronisation" x="-72" y="176">start?</label><nail x="64" y="192"/></transition><transition><source ref="id99"/><target ref="id103"/><label kind="synchronisation" x="-32" y="560">begBuff?</label><label kind="guard" x="-56" y="536">bus==idBuff</label><nail x="32" y="528"/><nail x="32" y="632"/></transition><transition><source ref="id103"/><target ref="id99"/><label kind="synchronisation" x="72" y="560">endBuff?</label><label kind="guard" x="72" y="544">bus==idBuff</label></transition><transition><source ref="id103"/><target ref="id104"/><label kind="guard" x="120" y="632">reg[idMem]&gt;0</label><label kind="synchronisation" x="128" y="656">endMem?</label><nail x="112" y="656"/><nail x="208" y="656"/></transition><transition><source ref="id104"/><target ref="id103"/><label kind="synchronisation" x="128" y="680">begMem?</label><label kind="assignment" x="96" y="704">reg[idMem]:=reg[idMem]-128</label><nail x="208" y="704"/><nail x="112" y="704"/></transition><transition><source ref="id103"/><target ref="id105"/><label kind="guard" x="-128" y="648">reg[idMem]==0</label><label kind="synchronisation" x="-128" y="672">endMem?</label></transition><transition><source ref="id105"/><target ref="id80"/><label kind="guard" x="-184" y="552">bus==idBuff</label><label kind="synchronisation" x="-184" y="576">endBuff?</label><label kind="assignment" x="-184" y="600">ready[idMem]:=0</label></transition><transition><source ref="id102"/><target ref="id103"/><label kind="guard" x="272" y="320">openBus==idMem</label><label kind="synchronisation" x="320" y="344">begMem?</label><label kind="assignment" x="200" y="368">reg[idMem]:=reg[idMem]-128</label><nail x="384" y="288"/><nail x="384" y="768"/><nail x="64" y="768"/></transition><transition><source ref="id80"/><target ref="id100"/><label kind="guard" x="-336" y="336">space[spaceId]&lt;32,
bus==idBuff</label><label kind="synchronisation" x="-344" y="384">begBuff?</label><nail x="-352" y="432"/><nail x="-352" y="336"/></transition></template><template><name x="5" y="5">inBuffer</name><parameter x="8" y="24">const startId, id, size, initial, regId, inWire, outWire; int inBus, outBus;
chan begPut; chan endPut; const putAmount; 
chan begGet; chan endGet; const getAmount</parameter><declaration/><location id="id106" x="136" y="80"><name x="105" y="86">Idle</name><label kind="invariant" x="230" y="367"/></location><location id="id107" x="136" y="-240"><name x="96" y="-272">Writing</name><label kind="invariant" x="470" y="143"/></location><location id="id108" x="568" y="104"><name x="576" y="120">Reading</name><label kind="invariant" x="470" y="591"/></location><location id="id109" x="568" y="-232"><name x="576" y="-264">ReadingWriting</name><label kind="invariant" x="710" y="367"/></location><location id="id110" x="136" y="208"><name x="88" y="200">Start</name></location><location id="id111" x="-272" y="-240"><name x="-328" y="-288">WritingIgnoreRead</name></location><location id="id112" x="-272" y="80"><name x="-304" y="96">IgnoreRead</name></location><init ref="id110"/><transition><source ref="id106"/><target ref="id107"/><label kind="guard" x="-24" y="-56">inWire==inBus,
space[id+N]&gt;=putAmount</label><label kind="synchronisation" x="-24" y="-24">begPut?</label><label kind="assignment" x="-24" y="-8">space[id+N]:=space[id+N]-putAmount</label><nail x="72" y="40"/><nail x="72" y="-152"/></transition><transition><source ref="id107"/><target ref="id106"/><label kind="synchronisation" x="144" y="-104">endPut?</label><label kind="assignment" x="144" y="-88">space[id]:=space[id]+putAmount</label><label kind="guard" x="144" y="-120">inWire==inBus</label></transition><transition><source ref="id106"/><target ref="id108"/><label kind="guard" x="232" y="96">outWire==outBus,
space[id]&gt;=getAmount,
ready[regId]==0</label><label kind="synchronisation" x="232" y="144">begGet?</label><label kind="assignment" x="232" y="160">space[id]:=space[id]-getAmount</label><nail x="232" y="144"/><nail x="488" y="144"/></transition><transition><source ref="id108"/><target ref="id106"/><label kind="synchronisation" x="216" y="48">endGet?</label><label kind="assignment" x="216" y="64">space[id+N]:=space[id+N]+getAmount</label><label kind="guard" x="216" y="16">outWire==outBus,
ready[regId]==0</label><nail x="480" y="48"/><nail x="224" y="48"/></transition><transition><source ref="id108"/><target ref="id109"/><label kind="guard" x="464" y="-104">inWire==inBus,
space[id+N]&gt;=putAmount</label><label kind="synchronisation" x="464" y="-56">begPut?</label><label kind="assignment" x="464" y="-72">space[id+N]:=space[id+N]-putAmount</label></transition><transition><source ref="id109"/><target ref="id107"/><label kind="synchronisation" x="424" y="-208">endGet?</label><label kind="assignment" x="256" y="-192">space[id+N]:=space[id+N]+getAmount</label><label kind="guard" x="424" y="-240">outWire==outBus,
ready[regId]==0</label><nail x="488" y="-192"/><nail x="224" y="-192"/></transition><transition><source ref="id109"/><target ref="id108"/><label kind="synchronisation" x="592" y="-136">endPut?</label><label kind="assignment" x="584" y="-120">space[id]:=space[id]+putAmount</label><label kind="guard" x="592" y="-152">inWire==inBus</label><nail x="630" y="-168"/><nail x="631" y="63"/></transition><transition><source ref="id107"/><target ref="id109"/><label kind="guard" x="224" y="-304">outWire==outBus,
space[id]&gt;=getAmount,
ready[regId]==0</label><label kind="synchronisation" x="224" y="-256">begGet?</label><label kind="assignment" x="224" y="-240">space[id]:=space[id]-getAmount</label><nail x="224" y="-272"/><nail x="488" y="-272"/></transition><transition><source ref="id110"/><target ref="id106"/><label kind="assignment" x="32" y="160">space[id]:=initial,
space[id+N]:=size-initial</label><label kind="guard" x="32" y="128">starting==startId</label><label kind="synchronisation" x="32" y="144">start?</label></transition><transition><source ref="id106"/><target ref="id108"/><label kind="guard" x="400" y="176">outWire==outBus,
ready[regId]==1</label><label kind="synchronisation" x="400" y="208">begGet?</label><nail x="232" y="208"/><nail x="488" y="208"/></transition><transition><source ref="id107"/><target ref="id109"/><label kind="guard" x="368" y="-352">outWire==outBus,
ready[regId]==1</label><label kind="synchronisation" x="368" y="-320">begGet?</label><nail x="232" y="-320"/><nail x="472" y="-320"/></transition><transition><source ref="id108"/><target ref="id106"/><label kind="guard" x="392" y="-32">outWire==outBus,
ready[regId]==1</label><label kind="synchronisation" x="392" y="0">endGet?</label><nail x="480" y="0"/><nail x="232" y="0"/></transition><transition><source ref="id109"/><target ref="id107"/><label kind="guard" x="232" y="-176">outWire==outBus,
ready[regId]==1</label><label kind="synchronisation" x="240" y="-136">endGet?</label><nail x="488" y="-136"/><nail x="232" y="-136"/></transition><transition><source ref="id107"/><target ref="id111"/><label kind="guard" x="-64" y="-232">outWire==outBus,
space[id]&lt;getAmount,
ready[regId]==0</label><label kind="synchronisation" x="-8" y="-184">begGet?</label><nail x="40" y="-184"/><nail x="-168" y="-184"/></transition><transition><source ref="id111"/><target ref="id112"/><label kind="guard" x="-256" y="-160">inWire==inBus</label><label kind="synchronisation" x="-256" y="-144">endPut?</label><label kind="assignment" x="-256" y="-176">space[id]:=space[id]+putAmount</label><nail x="-216" y="-184"/><nail x="-216" y="16"/></transition><transition><source ref="id112"/><target ref="id106"/><label kind="guard" x="-184" y="24">outWire==outBus</label><label kind="synchronisation" x="-184" y="40">endGet?</label><nail x="-183" y="43"/><nail x="38" y="45"/></transition><transition><source ref="id106"/><target ref="id112"/><label kind="guard" x="-80" y="48">outWire==outBus,
space[id]&lt;getAmount,
ready[regId]==0</label><label kind="synchronisation" x="-80" y="96">begGet?</label></transition><transition><source ref="id112"/><target ref="id111"/><label kind="guard" x="-320" y="-72">inWire==inBus,
space[id+N]&gt;=putAmount</label><label kind="synchronisation" x="-320" y="-40">begPut?</label><label kind="assignment" x="-320" y="-24">space[id+N]:=space[id+N]-putAmount</label></transition><transition><source ref="id111"/><target ref="id107"/><label kind="guard" x="-200" y="-280">outWire==outBus</label><label kind="synchronisation" x="-192" y="-264">endGet?</label><nail x="-176" y="-240"/></transition></template><template><name x="5" y="5">outBuffer</name><parameter x="8" y="24">const startId, id, size, initial, regId, inWire, outWire; int inBus, outBus;
chan begPut; chan endPut; const putAmount; 
chan begGet; chan endGet; const getAmount</parameter><declaration/><location id="id113" x="224" y="408"><name x="240" y="376">Idle</name><label kind="invariant" x="230" y="367"/></location><location id="id114" x="-160" y="400"><name x="-232" y="424">Writing</name><label kind="invariant" x="470" y="143"/></location><location id="id115" x="224" y="64"><name x="208" y="16">Reading</name><label kind="invariant" x="470" y="591"/></location><location id="id116" x="-160" y="64"><name x="-280" y="16">ReadingWriting</name><label kind="invariant" x="710" y="367"/></location><location id="id117" x="224" y="504"><name x="176" y="496">Start</name></location><location id="id118" x="512" y="64"><name x="528" y="48">ReadingIgnoreWrite</name></location><location id="id119" x="512" y="408"><name x="520" y="416">IgnoreWrite</name></location><init ref="id117"/><transition><source ref="id113"/><target ref="id114"/><label kind="guard" x="0" y="288">inWire==inBus,
ready[regId]==0,
space[id+N]&gt;=putAmount</label><label kind="synchronisation" x="0" y="328">begPut?</label><label kind="assignment" x="-8" y="344">space[id+N]:=space[id+N]-putAmount</label><nail x="168" y="320"/><nail x="-144" y="320"/></transition><transition><source ref="id114"/><target ref="id113"/><label kind="synchronisation" x="-16" y="416">endPut?</label><label kind="assignment" x="-24" y="440">space[id]:=space[id]+putAmount</label><label kind="guard" x="-16" y="384">inWire==inBus,
ready[regId]==0</label><nail x="-128" y="440"/><nail x="176" y="440"/></transition><transition><source ref="id113"/><target ref="id115"/><label kind="guard" x="256" y="240">outWire==outBus,
space[id]&gt;=getAmount</label><label kind="synchronisation" x="256" y="272">begGet?</label><label kind="assignment" x="256" y="296">space[id]:=space[id]-getAmount</label><nail x="256" y="360"/><nail x="256" y="128"/></transition><transition><source ref="id115"/><target ref="id113"/><label kind="synchronisation" x="104" y="192">endGet?</label><label kind="assignment" x="104" y="176">space[id+N]:=space[id+N]+getAmount</label><label kind="guard" x="104" y="208">outWire==outBus</label></transition><transition><source ref="id115"/><target ref="id116"/><label kind="guard" x="-112" y="-72">inWire==inBus,
ready[regId]==0,
space[id+N]&gt;=putAmount</label><label kind="synchronisation" x="-112" y="-24">begPut?</label><label kind="assignment" x="-112" y="-8">space[id+N]:=space[id+N]-putAmount</label><nail x="144" y="-24"/><nail x="-112" y="-24"/></transition><transition><source ref="id116"/><target ref="id114"/><label kind="synchronisation" x="-304" y="136">endGet?</label><label kind="assignment" x="-304" y="152">space[id+N]:=space[id+N]+getAmount</label><label kind="guard" x="-304" y="120">outWire==outBus</label><nail x="-192" y="112"/><nail x="-192" y="344"/></transition><transition><source ref="id116"/><target ref="id115"/><label kind="synchronisation" x="-136" y="80">endPut?</label><label kind="assignment" x="-136" y="96">space[id]:=space[id]+putAmount</label><label kind="guard" x="-136" y="48">inWire==inBus,
ready[regId]==0</label><nail x="-136" y="96"/><nail x="160" y="96"/></transition><transition><source ref="id114"/><target ref="id116"/><label kind="guard" x="-176" y="208">outWire==outBus,
space[id]&gt;=getAmount</label><label kind="synchronisation" x="-176" y="240">begGet?</label><label kind="assignment" x="-176" y="256">space[id]:=space[id]-getAmount</label></transition><transition><source ref="id117"/><target ref="id113"/><label kind="assignment" x="240" y="480">space[id]:=initial,
space[id+N]:=size-initial</label><label kind="guard" x="232" y="448">starting==startId</label><label kind="synchronisation" x="240" y="464">start?</label></transition><transition><source ref="id113"/><target ref="id114"/><label kind="guard" x="-136" y="328">inWire==inBus,
ready[regId]==1</label><label kind="synchronisation" x="-128" y="360">begPut?</label><nail x="168" y="360"/><nail x="-136" y="360"/></transition><transition><source ref="id114"/><target ref="id113"/><label kind="guard" x="-128" y="448">inWire==inBus,
ready[regId]==1</label><label kind="synchronisation" x="-128" y="488">endPut?</label><nail x="-128" y="480"/><nail x="176" y="480"/></transition><transition><source ref="id116"/><target ref="id115"/><label kind="guard" x="64" y="104">inWire==inBus,
ready[regId]==1</label><label kind="synchronisation" x="64" y="136">endPut?</label><nail x="-112" y="136"/><nail x="168" y="136"/></transition><transition><source ref="id115"/><target ref="id116"/><label kind="guard" x="40" y="16">inWire==inBus,
ready[regId]==1</label><label kind="synchronisation" x="40" y="48">begPut?</label><nail x="144" y="32"/><nail x="-120" y="32"/></transition><transition><source ref="id119"/><target ref="id113"/><label kind="guard" x="296" y="376">inWire==inBus</label><label kind="synchronisation" x="296" y="392">endPut?</label></transition><transition><source ref="id113"/><target ref="id119"/><label kind="guard" x="376" y="416">inWire==inBus,
ready[regId]==0,
space[id+N]&lt;putAmount</label><label kind="synchronisation" x="376" y="456">begPut?</label><nail x="256" y="448"/><nail x="480" y="448"/></transition><transition><source ref="id119"/><target ref="id118"/><label kind="guard" x="552" y="216">outWire==outBus,
space[id]&gt;=getAmount</label><label kind="synchronisation" x="552" y="248">begGet?</label><label kind="assignment" x="504" y="264">space[id]:=space[id]-getAmount</label><nail x="544" y="360"/><nail x="544" y="128"/></transition><transition><source ref="id118"/><target ref="id119"/><label kind="guard" x="440" y="136">outWire==outBus</label><label kind="synchronisation" x="440" y="152">endGet?</label><label kind="assignment" x="440" y="168">space[id+N]:=space[id+N]+getAmount</label></transition><transition><source ref="id118"/><target ref="id115"/><label kind="guard" x="344" y="-24">inWire==inBus</label><label kind="synchronisation" x="344" y="-8">endPut?</label><nail x="480" y="16"/><nail x="296" y="16"/></transition><transition><source ref="id115"/><target ref="id118"/><label kind="guard" x="336" y="48">inWire==inBus,
ready[regId]==0,
space[id+N]&lt;putAmount</label><label kind="synchronisation" x="336" y="96">begPut?</label></transition></template><template><name x="5" y="5">Timer</name><parameter x="5" y="20">const startId, period, count</parameter><declaration>clock time;</declaration><location id="id120" x="-176" y="-32"><name x="-216" y="-16">Prepare</name><committed/><committed/></location><location id="id121" x="-24" y="-32"><name x="-24" y="-64">Ticking</name></location><location id="id122" x="-368" y="-160"><name x="-392" y="-192">Pause</name><label kind="invariant" x="-416" y="-208">time&lt;=period</label></location><location id="id123" x="-176" y="-160"><name x="-184" y="-200">Start</name></location><location id="id124" x="-368" y="-32"><name x="-384" y="-16">Tacking</name></location><init ref="id123"/><transition><source ref="id120"/><target ref="id121"/><label kind="synchronisation" x="-128" y="-80">tick!</label><label kind="guard" x="-136" y="-64">turn&lt;count</label><nail x="-136" y="-64"/><nail x="-56" y="-64"/></transition><transition><source ref="id121"/><target ref="id120"/><label kind="synchronisation" x="-128" y="-16">tick?</label><label kind="assignment" x="-136" y="0">turn:=turn+1</label><nail x="-56" y="0"/><nail x="-136" y="0"/></transition><transition><source ref="id123"/><target ref="id120"/><label kind="assignment" x="-168" y="-120">turn:=0</label><label kind="guard" x="-168" y="-152">starting==startId</label><label kind="synchronisation" x="-168" y="-136">start?</label></transition><transition><source ref="id120"/><target ref="id122"/><label kind="guard" x="-296" y="-176">turn==count</label><label kind="assignment" x="-296" y="-160">time:=0,
turn:=turn-1</label><nail x="-208" y="-160"/></transition><transition><source ref="id122"/><target ref="id124"/><label kind="synchronisation" x="-328" y="-96">tack!</label><label kind="guard" x="-328" y="-112">time==period</label><nail x="-336" y="-128"/><nail x="-336" y="-64"/></transition><transition><source ref="id124"/><target ref="id122"/><label kind="synchronisation" x="-408" y="-112">tack?</label><label kind="assignment" x="-408" y="-96">turn:=turn-1</label><label kind="guard" x="-408" y="-128">turn&gt;0</label><nail x="-416" y="-64"/><nail x="-416" y="-128"/></transition><transition><source ref="id124"/><target ref="id120"/><label kind="guard" x="-264" y="-56">turn==0</label><label kind="synchronisation" x="-256" y="-32">tack?</label></transition></template><template><name x="32" y="72">Bus</name><parameter x="32" y="88">const startId, me, wireCount, skipCount;
int bus;
chan beg, end</parameter><declaration>int counter;</declaration><location id="id148" x="-352" y="-832"><name x="-328" y="-840">Begin</name><committed/></location><location id="id149" x="-640" y="-928"><name x="-656" y="-968">End</name><committed/><committed/></location><location id="id150" x="-640" y="-832"><name x="-672" y="-864">Wait</name></location><location id="id151" x="-352" y="-1024"><name x="-401" y="-1036">Start</name></location><location id="id152" x="-352" y="-928"><name x="-336" y="-936">Stop</name></location><location id="id153" x="-512" y="-832"><name x="-544" y="-872">FinishBegin</name><committed/><committed/></location><location id="id154" x="-512" y="-928"><name x="-536" y="-968">FinishEnd</name><committed/><committed/></location><location id="id155" x="-640" y="-704"><name x="-672" y="-688">SkipTack</name><committed/></location><location id="id156" x="-768" y="-704"><name x="-789" y="-689">WaitForTick</name></location><location id="id157" x="-768" y="-832"><name x="-795" y="-869">SkipTick</name><committed/></location><init ref="id151"/><transition><source ref="id148"/><target ref="id148"/><label kind="assignment" x="-432" y="-720">bus:=bus+1</label><label kind="guard" x="-432" y="-752">bus&lt;wireCount-1</label><label kind="synchronisation" x="-432" y="-736">beg!</label><nail x="-320" y="-736"/><nail x="-448" y="-736"/></transition><transition><source ref="id148"/><target ref="id153"/><label kind="guard" x="-480" y="-848">bus==wireCount-1</label><label kind="synchronisation" x="-480" y="-832">beg!</label></transition><transition><source ref="id149"/><target ref="id149"/><label kind="synchronisation" x="-762" y="-936">end!</label><label kind="assignment" x="-762" y="-921">bus:=bus-1</label><label kind="guard" x="-761" y="-952">bus&gt;0</label><nail x="-769" y="-878"/><nail x="-768" y="-968"/></transition><transition><source ref="id150"/><target ref="id149"/><label kind="guard" x="-632" y="-912">turn==me,
counter==skipCount</label><label kind="synchronisation" x="-632" y="-880">tack?</label></transition><transition><source ref="id149"/><target ref="id154"/><label kind="guard" x="-600" y="-952">bus==0</label><label kind="synchronisation" x="-592" y="-928">end!</label></transition><transition><source ref="id151"/><target ref="id152"/><label kind="assignment" x="-344" y="-976">bus:=0</label><label kind="guard" x="-344" y="-1008">starting==startId</label><label kind="synchronisation" x="-344" y="-992">start?</label></transition><transition><source ref="id152"/><target ref="id148"/><label kind="guard" x="-344" y="-896">turn==me</label><label kind="synchronisation" x="-344" y="-872">tick?</label></transition><transition><source ref="id153"/><target ref="id150"/><label kind="synchronisation" x="-584" y="-848">tick!</label><label kind="assignment" x="-608" y="-832">counter:=0</label></transition><transition><source ref="id154"/><target ref="id152"/><label kind="synchronisation" x="-472" y="-944">tack!</label></transition><transition><source ref="id150"/><target ref="id155"/><label kind="guard" x="-632" y="-784">turn==me,
counter&lt;skipCount</label><label kind="synchronisation" x="-632" y="-752">tack?</label><label kind="assignment" x="-632" y="-736">counter:=counter+1</label></transition><transition><source ref="id157"/><target ref="id150"/><label kind="synchronisation" x="-728" y="-856">tick!</label></transition><transition><source ref="id155"/><target ref="id156"/><label kind="synchronisation" x="-720" y="-720">tack!</label></transition><transition><source ref="id156"/><target ref="id157"/><label kind="synchronisation" x="-760" y="-785">tick?</label><label kind="guard" x="-761" y="-802">turn==me</label></transition></template><template><name x="5" y="5">Starter</name><parameter x="5" y="20"/><declaration/><location id="id158" x="-80" y="0"><name x="-96" y="-40">Start</name><committed/></location><location id="id159" x="88" y="0"><name x="80" y="-32">Stay</name></location><init ref="id158"/><transition><source ref="id158"/><target ref="id158"/><label kind="synchronisation" x="-96" y="40">start!</label><label kind="assignment" x="-128" y="64">starting:=starting+1</label><label kind="guard" x="-112" y="24">starting&lt;7</label><nail x="-160" y="64"/><nail x="8" y="64"/></transition><transition><source ref="id158"/><target ref="id159"/><label kind="guard" x="-32" y="-24">starting==7</label><label kind="synchronisation" x="-16" y="0">start!</label></transition></template><template><name x="328" y="224">ArbiterT</name><parameter x="328" y="248">const startId, me;
chan beg, end</parameter><declaration>const unsafe 3072; // 3125;
const refreshCycle 20;
int counter;
//3119 prepare for refresh
const maxSafe unsafe-6;
//3125+20=3139 end of full refresh
const maxUnsafe unsafe+refreshCycle;
</declaration><location id="id6" x="800" y="400"><name x="784" y="352">Start</name></location><location id="id7" x="800" y="512"><name x="744" y="480">Ready</name></location><location id="id10" x="448" y="384"><name x="424" y="344">Transfer</name></location><location id="id11" x="448" y="576"><name x="400" y="576">Wait</name></location><location id="id19" x="520" y="608"><name x="496" y="576">Setting</name></location><location id="id21" x="640" y="608"><name x="608" y="616">Setup</name><committed/><committed/></location><location id="id22" x="448" y="640"><name x="360" y="632">FinishSetup</name><committed/><committed/></location><location id="id23" x="480" y="448"><committed/></location><location id="id24" x="480" y="512"><committed/></location><location id="id25" x="416" y="448"><committed/></location><location id="id28" x="416" y="512"><committed/></location><location id="id29" x="960" y="416"><name x="936" y="432">Switch</name><committed/><committed/></location><location id="id30" x="1120" y="416"><name x="1088" y="384">SkipTack2</name><committed/><committed/></location><location id="id31" x="1024" y="416"><name x="992" y="376">Switching</name></location><location id="id32" x="520" y="704"><name x="536" y="696">SkipTack</name><committed/><committed/></location><location id="id33" x="520" y="768"><name x="536" y="768">WaitForTick</name></location><location id="id37" x="448" y="768"><name x="376" y="760">SkipTick</name><committed/><committed/></location><location id="id38" x="448" y="704"><name x="384" y="696">Setting2</name></location><location id="id39" x="1120" y="464"><name x="1136" y="456">WaitForTick2</name></location><location id="id40" x="1120" y="512"><name x="1136" y="512">SkipTick2</name><committed/><committed/></location><location id="id41" x="864" y="512"><name x="832" y="528">FinishSwitch</name><committed/><committed/></location><location id="id42" x="952" y="512"><name x="928" y="544">Switching2</name></location><location id="id43" x="960" y="624"><name x="984" y="600">SwithRefresh</name><committed/></location><location id="id44" x="960" y="736"><name x="984" y="728">Refresh</name></location><location id="id48" x="800" y="736"><name x="696" y="720">LeaveRefresh</name><committed/></location><init ref="id6"/><transition><source ref="id6"/><target ref="id7"/><label kind="assignment" x="704" y="440">openBus:=0,
counter:=0</label><label kind="guard" x="696" y="408">starting==startId</label><label kind="synchronisation" x="696" y="424">start?</label></transition><transition><source ref="id24"/><target ref="id7"/><label kind="assignment" x="504" y="512">openBus:=(openBus==N-1?0:openBus+1)</label><label kind="guard" x="568" y="472">reg[openBus]==0</label><label kind="synchronisation" x="568" y="488">tack!</label><nail x="760" y="512"/></transition><transition><source ref="id31"/><target ref="id30"/><label kind="guard" x="1040" y="416">turn==me</label><label kind="synchronisation" x="1048" y="432">tack?</label></transition><transition><source ref="id7"/><target ref="id21"/><label kind="guard" x="656" y="544">turn==me,
ready[openBus]==1,
reg[openBus]==512,
counter&lt;=maxSafe</label><label kind="synchronisation" x="664" y="608">tick?</label><label kind="assignment" x="656" y="624">counter:=counter+1</label><nail x="784" y="608"/></transition><transition><source ref="id23"/><target ref="id24"/><label kind="synchronisation" x="488" y="464">end!</label></transition><transition><source ref="id28"/><target ref="id25"/><label kind="synchronisation" x="384" y="472">beg!</label></transition><transition><source ref="id21"/><target ref="id19"/><label kind="synchronisation" x="560" y="584">tick!</label></transition><transition><source ref="id38"/><target ref="id22"/><label kind="guard" x="456" y="656">turn==me</label><label kind="synchronisation" x="456" y="672">tack?</label></transition><transition><source ref="id22"/><target ref="id11"/><label kind="synchronisation" x="456" y="600">tack!</label></transition><transition><source ref="id10"/><target ref="id23"/><label kind="guard" x="472" y="384">turn==me</label><label kind="synchronisation" x="488" y="400">tack?</label><nail x="480" y="416"/></transition><transition><source ref="id24"/><target ref="id11"/><label kind="synchronisation" x="472" y="560">tack!</label><label kind="guard" x="480" y="544">reg[openBus]&gt;0</label><nail x="480" y="544"/></transition><transition><source ref="id11"/><target ref="id28"/><label kind="guard" x="344" y="520">turn==me</label><label kind="synchronisation" x="344" y="536">tick?</label><label kind="assignment" x="344" y="552">counter:=counter+1</label><nail x="416" y="544"/></transition><transition><source ref="id25"/><target ref="id10"/><label kind="synchronisation" x="384" y="400">tick!</label><nail x="416" y="416"/></transition><transition><source ref="id7"/><target ref="id29"/><label kind="guard" x="832" y="368">turn==me,
counter&lt;=maxSafe+4,
ready[openBus]==0</label><label kind="synchronisation" x="856" y="416">tick?</label><label kind="assignment" x="808" y="432">counter:=counter+1</label><nail x="832" y="416"/></transition><transition><source ref="id29"/><target ref="id31"/><label kind="synchronisation" x="976" y="416">tick!</label></transition><transition><source ref="id41"/><target ref="id7"/><label kind="synchronisation" x="824" y="488">tack!</label></transition><transition><source ref="id19"/><target ref="id32"/><label kind="guard" x="536" y="616">turn==me</label><label kind="synchronisation" x="536" y="672">tack?</label></transition><transition><source ref="id32"/><target ref="id33"/><label kind="synchronisation" x="528" y="728">tack!</label></transition><transition><source ref="id33"/><target ref="id37"/><label kind="guard" x="448" y="744">turn==me</label><label kind="synchronisation" x="480" y="768">tick?</label><label kind="assignment" x="432" y="784">counter:=counter+1</label></transition><transition><source ref="id37"/><target ref="id38"/><label kind="synchronisation" x="456" y="720">tick!</label></transition><transition><source ref="id30"/><target ref="id39"/><label kind="synchronisation" x="1128" y="432">tack!</label></transition><transition><source ref="id39"/><target ref="id40"/><label kind="guard" x="1128" y="472">turn==me</label><label kind="synchronisation" x="1136" y="488">tick?</label><label kind="assignment" x="1136" y="496">counter:=counter+1</label></transition><transition><source ref="id40"/><target ref="id42"/><label kind="assignment" x="944" y="528">openBus:=(openBus==N-1?0:openBus+1)</label><label kind="synchronisation" x="1032" y="488">tick!</label></transition><transition><source ref="id42"/><target ref="id41"/><label kind="guard" x="880" y="472">turn==me</label><label kind="synchronisation" x="896" y="488">tack?</label></transition><transition><source ref="id7"/><target ref="id43"/><label kind="guard" x="832" y="552">turn==me,
counter&gt;maxSafe</label><label kind="synchronisation" x="832" y="584">tick?</label><label kind="assignment" x="832" y="600">counter:=counter+1</label><nail x="832" y="624"/></transition><transition><source ref="id43"/><target ref="id44"/><label kind="synchronisation" x="936" y="640">tick!</label></transition><transition><source ref="id44"/><target ref="id48"/><label kind="guard" x="824" y="672">turn==me, 
counter&lt;maxUnsafe</label><label kind="synchronisation" x="832" y="704">tack?</label><nail x="928" y="768"/><nail x="832" y="768"/></transition><transition><source ref="id44"/><target ref="id48"/><label kind="guard" x="816" y="768">turn==me,
counter==maxUnsafe</label><label kind="synchronisation" x="816" y="800">tack?</label><label kind="assignment" x="816" y="816">counter:=0</label><nail x="928" y="704"/><nail x="832" y="704"/></transition><transition><source ref="id48"/><target ref="id7"/><label kind="synchronisation" x="808" y="640">tack!</label></transition></template><template><name x="328" y="224">ArbiterNT</name><parameter x="328" y="248">const startId, me;
chan beg, end</parameter><declaration/><location id="id0" x="800" y="448"><name x="792" y="408">Start</name></location><location id="id1" x="800" y="640"><name x="808" y="584">Ready</name></location><location id="id2" x="448" y="384"><name x="424" y="344">Transfer</name></location><location id="id3" x="448" y="576"><name x="400" y="576">Wait</name></location><location id="id4" x="544" y="640"><name x="520" y="608">Setting</name></location><location id="id8" x="640" y="640"><name x="632" y="664">Setup</name><committed/><committed/></location><location id="id9" x="448" y="640"><name x="360" y="632">FinishSetup</name><committed/><committed/></location><location id="id45" x="480" y="448"><committed/></location><location id="id46" x="480" y="512"><committed/></location><location id="id47" x="416" y="448"><committed/></location><location id="id49" x="416" y="512"><committed/></location><location id="id50" x="960" y="640"><name x="968" y="592">Switch</name><committed/><committed/></location><location id="id51" x="1120" y="640"><name x="1136" y="632">SkipTack2</name><committed/><committed/></location><location id="id52" x="1024" y="640"><name x="1024" y="584">Switching</name></location><location id="id53" x="544" y="704"><name x="560" y="696">SkipTack</name><committed/><committed/></location><location id="id54" x="544" y="768"><name x="560" y="768">WaitForTick</name></location><location id="id55" x="448" y="768"><name x="376" y="760">SkipTick</name><committed/><committed/></location><location id="id56" x="448" y="704"><name x="384" y="696">Setting2</name></location><location id="id57" x="1120" y="704"><name x="1136" y="696">WaitForTick2</name></location><location id="id58" x="1120" y="768"><name x="1136" y="760">SkipTick2</name><committed/><committed/></location><location id="id59" x="800" y="704"><name x="824" y="696">FinishSwitch</name><committed/><committed/></location><location id="id60" x="800" y="768"><name x="712" y="752">Switching2</name></location><init ref="id0"/><transition><source ref="id0"/><target ref="id1"/><label kind="assignment" x="808" y="504">openBus:=0</label><label kind="guard" x="808" y="472">starting==startId</label><label kind="synchronisation" x="808" y="488">start?</label></transition><transition><source ref="id46"/><target ref="id1"/><label kind="assignment" x="504" y="512">openBus:=(openBus==N-1?0:openBus+1)</label><label kind="guard" x="568" y="472">reg[openBus]==0</label><label kind="synchronisation" x="568" y="488">tack!</label><nail x="768" y="512"/></transition><transition><source ref="id52"/><target ref="id51"/><label kind="guard" x="1040" y="624">turn==me</label><label kind="synchronisation" x="1048" y="640">tack?</label></transition><transition><source ref="id1"/><target ref="id8"/><label kind="guard" x="656" y="592">turn==me,
ready[openBus]==1,
reg[openBus]==512</label><label kind="synchronisation" x="664" y="648">tick?</label></transition><transition><source ref="id45"/><target ref="id46"/><label kind="synchronisation" x="488" y="464">end!</label></transition><transition><source ref="id49"/><target ref="id47"/><label kind="synchronisation" x="384" y="472">beg!</label></transition><transition><source ref="id8"/><target ref="id4"/><label kind="synchronisation" x="584" y="616">tick!</label></transition><transition><source ref="id56"/><target ref="id9"/><label kind="guard" x="456" y="656">turn==me</label><label kind="synchronisation" x="456" y="672">tack?</label></transition><transition><source ref="id9"/><target ref="id3"/><label kind="synchronisation" x="456" y="600">tack!</label></transition><transition><source ref="id2"/><target ref="id45"/><label kind="guard" x="472" y="384">turn==me</label><label kind="synchronisation" x="488" y="400">tack?</label><nail x="480" y="416"/></transition><transition><source ref="id46"/><target ref="id3"/><label kind="synchronisation" x="480" y="552">tack!</label><label kind="guard" x="488" y="536">reg[openBus]&gt;0</label><nail x="480" y="544"/></transition><transition><source ref="id3"/><target ref="id49"/><label kind="guard" x="352" y="536">turn==me</label><label kind="synchronisation" x="392" y="552">tick?</label><nail x="416" y="544"/></transition><transition><source ref="id47"/><target ref="id2"/><label kind="synchronisation" x="384" y="400">tick!</label><nail x="416" y="416"/></transition><transition><source ref="id1"/><target ref="id50"/><label kind="guard" x="824" y="608">turn==me,
ready[openBus]==0</label><label kind="synchronisation" x="848" y="640">tick?</label></transition><transition><source ref="id50"/><target ref="id52"/><label kind="synchronisation" x="976" y="640">tick!</label></transition><transition><source ref="id59"/><target ref="id1"/><label kind="synchronisation" x="808" y="664">tack!</label></transition><transition><source ref="id4"/><target ref="id53"/><label kind="guard" x="560" y="656">turn==me</label><label kind="synchronisation" x="560" y="672">tack?</label></transition><transition><source ref="id53"/><target ref="id54"/><label kind="synchronisation" x="552" y="728">tack!</label></transition><transition><source ref="id54"/><target ref="id55"/><label kind="guard" x="472" y="744">turn==me</label><label kind="synchronisation" x="480" y="768">tick?</label></transition><transition><source ref="id55"/><target ref="id56"/><label kind="synchronisation" x="456" y="720">tick!</label></transition><transition><source ref="id51"/><target ref="id57"/><label kind="synchronisation" x="1128" y="664">tack!</label></transition><transition><source ref="id57"/><target ref="id58"/><label kind="guard" x="1128" y="720">turn==me</label><label kind="synchronisation" x="1128" y="736">tick?</label></transition><transition><source ref="id58"/><target ref="id60"/><label kind="assignment" x="824" y="768">openBus:=(openBus==N-1?0:openBus+1)</label><label kind="synchronisation" x="888" y="744">tick!</label></transition><transition><source ref="id60"/><target ref="id59"/><label kind="guard" x="808" y="720">turn==me</label><label kind="synchronisation" x="808" y="736">tack?</label></transition></template><template><name x="328" y="224">ArbiterTO</name><parameter x="328" y="248">const startId, me;
chan beg, end</parameter><declaration>const unsafe 15625/5; //3125; 
const refreshCycle 20;
int counter;
//3119 prepare for refresh
const maxSafe unsafe-6;
//3125+20=3139 end of full refresh
const maxUnsafe unsafe+refreshCycle;

</declaration><location id="id61" x="608" y="384"><name x="584" y="344">Start</name></location><location id="id62" x="800" y="512"><name x="806" y="476">Ready</name></location><location id="id63" x="448" y="384"><name x="424" y="344">Transfer</name></location><location id="id64" x="448" y="576"><name x="400" y="576">Wait</name></location><location id="id65" x="520" y="608"><name x="496" y="576">Setting</name></location><location id="id66" x="640" y="608"><name x="608" y="616">Setup</name><committed/><committed/></location><location id="id67" x="448" y="640"><name x="360" y="632">FinishSetup</name><committed/><committed/></location><location id="id68" x="480" y="448"><committed/></location><location id="id69" x="480" y="512"><committed/></location><location id="id70" x="416" y="448"><committed/></location><location id="id71" x="416" y="512"><committed/></location><location id="id72" x="984" y="352"><name x="968" y="368">Switch</name><committed/><committed/></location><location id="id73" x="1152" y="352"><name x="1120" y="320">SkipTack2</name><committed/><committed/></location><location id="id74" x="1056" y="352"><name x="1024" y="312">Switching</name></location><location id="id75" x="520" y="704"><name x="536" y="696">SkipTack</name><committed/><committed/></location><location id="id76" x="520" y="768"><name x="536" y="768">WaitForTick</name></location><location id="id77" x="448" y="768"><name x="376" y="760">SkipTick</name><committed/><committed/></location><location id="id78" x="448" y="704"><name x="384" y="696">Setting2</name></location><location id="id79" x="1152" y="416"><name x="1176" y="400">WaitForTick2</name></location><location id="id81" x="1152" y="512"><name x="1176" y="512">SwitchRefresh</name><committed/></location><location id="id84" x="1056" y="512"><name x="1032" y="472">Refresh</name></location><location id="id85" x="928" y="512"><name x="896" y="472">SkipTack1</name><committed/><committed/></location><init ref="id61"/><transition><source ref="id61"/><target ref="id62"/><label kind="assignment" x="664" y="384">openBus:=0,
counter:=0</label><label kind="guard" x="640" y="352">starting==startId</label><label kind="synchronisation" x="648" y="368">start?</label></transition><transition><source ref="id69"/><target ref="id62"/><label kind="assignment" x="504" y="512">openBus:=(openBus==N-1?0:openBus+1)</label><label kind="guard" x="568" y="472">reg[openBus]==0</label><label kind="synchronisation" x="568" y="488">tack!</label></transition><transition><source ref="id74"/><target ref="id73"/><label kind="guard" x="1072" y="352">turn==me</label><label kind="synchronisation" x="1080" y="368">tack?</label></transition><transition><source ref="id62"/><target ref="id66"/><label kind="guard" x="664" y="544">turn==me,
ready[openBus]==1,
reg[openBus]==512,
counter&lt;=maxSafe</label><label kind="synchronisation" x="664" y="624">tick?</label><label kind="assignment" x="664" y="640">counter:=counter+1</label><nail x="800" y="608"/></transition><transition><source ref="id68"/><target ref="id69"/><label kind="synchronisation" x="488" y="464">end!</label></transition><transition><source ref="id71"/><target ref="id70"/><label kind="synchronisation" x="384" y="472">beg!</label></transition><transition><source ref="id66"/><target ref="id65"/><label kind="synchronisation" x="560" y="584">tick!</label></transition><transition><source ref="id78"/><target ref="id67"/><label kind="guard" x="456" y="656">turn==me</label><label kind="synchronisation" x="456" y="672">tack?</label></transition><transition><source ref="id67"/><target ref="id64"/><label kind="synchronisation" x="456" y="600">tack!</label></transition><transition><source ref="id63"/><target ref="id68"/><label kind="guard" x="472" y="384">turn==me</label><label kind="synchronisation" x="488" y="400">tack?</label><nail x="480" y="416"/></transition><transition><source ref="id69"/><target ref="id64"/><label kind="synchronisation" x="472" y="560">tack!</label><label kind="guard" x="480" y="544">reg[openBus]&gt;0</label><nail x="480" y="544"/></transition><transition><source ref="id64"/><target ref="id71"/><label kind="guard" x="344" y="520">turn==me</label><label kind="synchronisation" x="344" y="536">tick?</label><label kind="assignment" x="344" y="552">counter:=counter+1</label><nail x="416" y="544"/></transition><transition><source ref="id70"/><target ref="id63"/><label kind="synchronisation" x="384" y="400">tick!</label><nail x="416" y="416"/></transition><transition><source ref="id62"/><target ref="id72"/><label kind="guard" x="808" y="312">turn==me,
ready[openBus]==0</label><label kind="synchronisation" x="816" y="360">tick?</label><label kind="assignment" x="808" y="384">counter:=(counter==maxUnsafe-1?
0:counter+1)</label><nail x="800" y="352"/></transition><transition><source ref="id72"/><target ref="id74"/><label kind="synchronisation" x="1008" y="352">tick!</label></transition><transition><source ref="id65"/><target ref="id75"/><label kind="guard" x="536" y="616">turn==me</label><label kind="synchronisation" x="536" y="672">tack?</label></transition><transition><source ref="id75"/><target ref="id76"/><label kind="synchronisation" x="528" y="728">tack!</label></transition><transition><source ref="id76"/><target ref="id77"/><label kind="guard" x="448" y="744">turn==me</label><label kind="synchronisation" x="480" y="768">tick?</label><label kind="assignment" x="432" y="784">counter:=counter+1</label></transition><transition><source ref="id77"/><target ref="id78"/><label kind="synchronisation" x="456" y="720">tick!</label></transition><transition><source ref="id73"/><target ref="id79"/><label kind="synchronisation" x="1168" y="360">tack!</label></transition><transition><source ref="id79"/><target ref="id81"/><label kind="guard" x="1160" y="424">turn==me</label><label kind="synchronisation" x="1160" y="440">tick?</label><label kind="assignment" x="1160" y="456">counter:=(counter==maxUnsafe-1?0:counter+1),
openBus:=(openBus==N-1?0:openBus+1)</label></transition><transition><source ref="id81"/><target ref="id84"/><label kind="synchronisation" x="1096" y="488">tick!</label></transition><transition><source ref="id84"/><target ref="id85"/><label kind="guard" x="968" y="488">turn==me</label><label kind="synchronisation" x="976" y="512">tack?</label></transition><transition><source ref="id85"/><target ref="id62"/><label kind="synchronisation" x="856" y="488">tack!</label></transition><transition><source ref="id62"/><target ref="id81"/><label kind="guard" x="920" y="544">turn==me,
ready[openBus]==1,
counter&gt;maxSafe</label><label kind="synchronisation" x="920" y="592">tick?</label><label kind="assignment" x="840" y="616">counter:=(counter==maxUnsafe-1?0:counter+1)</label><nail x="864" y="608"/><nail x="1088" y="608"/></transition></template><instantiation>//Insert process assignments.

starter:=Starter();

//Timer: const startId, period, count
timer:=Timer(7, 5, 3);

//Bus: const startId, me, wireCount, skipCount;int bus; chan beg, end
bus0:=Bus(1, 0, wireCount0, 1, bus0Wire, begSig, endSig);

bus1:=Bus(4, 1, wireCount1, 1, bus1Wire, begBuff, endBuff);

//InBuff: const startId, id, size, initial, regId, inWire, outWire; int inBus, outBus;
//chan begPut; chan endPut; const putAmount; 
//chan begGet; chan endGet; const getAmount

buf0:=inBuffer(2, 0, 8*512, 0, 0, 0, 1, bus0Wire, bus1Wire, begSig, endSig, 8, begBuff, endBuff, 32);

//OutBuff: const startId, id, size, initial, regId, inWire, outWire; int inBus, outBus;
//chan begPut; chan endPut; const putAmount; 
//chan begGet; chan endGet; const getAmount

buf1:=outBuffer(3, 1, 8*512, 8*512, 1, 3, 1, bus1Wire, bus0Wire, begBuff, endBuff, 32, begSig, endSig, 16);

//Register: const startId, idMem, idBuff, spaceId, status; int bus;
//chan begBuff, endBuff, begMem, endMem
reg0:=Register(5, 0, 0, 0, 0, bus1Wire, begBuff, endBuff, begMem, endMem);

reg1:=Register(6, 1, 2, 1+N, 512, bus1Wire, begBuff, endBuff, begMem, endMem);

//ArbiterNT: const startId, me; chan beg, end
//arbiter:=ArbiterNT(0, 2, begMem, endMem);
arbiter:=ArbiterTO(0, 2, begMem, endMem);

</instantiation>
  <system>//Edit system definition.
system starter, timer, bus0, bus1, buf0, buf1, reg0, reg1, arbiter;</system>
</nta>
