You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
// prism model of pta version of zeroconf
|
|
// using digitial clocks
|
|
|
|
mdp
|
|
|
|
module sender
|
|
|
|
s : [0..2]; //local state
|
|
probes : [0..4]; // probes sent
|
|
ip : [0..2]; // ip address not chosen, fresh or in use
|
|
x : [0..21]; // local clock
|
|
|
|
// selct probe
|
|
// [] s=0 -> 0.99969242125984251969 : (s'=1) & (ip'=0) + 0.00030757874015748031 : (s'=1) & (ip'=1);
|
|
|
|
[] s=0 -> 0.5 : (s'=1) & (ip'=1) + 0.5 : (s'=1) & (ip'=2);
|
|
// send probes
|
|
[time] s=1 & x<20 -> (x'=x+1);
|
|
[send_used] s=1 & x=20 & ip=2 & probes<4 -> (probes'=probes+1) & (x'=0);
|
|
[send_fresh] s=1 & x=20 & ip=1 & probes<4 -> (probes'=probes+1) & (x'=0);
|
|
[] s=1 & x=20 & probes=4 -> (s'=2) & (x'=0);
|
|
[recv] s=1 -> (s'=0) & (x'=0) & (ip'=0) & (probes'=0);
|
|
|
|
[time] s=2 -> (x'=min(21,x+1));
|
|
|
|
endmodule
|
|
|
|
module environment
|
|
|
|
e : [0..2]; // ready, send reply
|
|
y : [0..6];
|
|
|
|
[time] e=0 -> (y'=min(y+1,6));
|
|
[send_fresh] e=0 -> true;
|
|
[send_used] e=0 -> 0.1 : (e'=0) + 0.9 : (e'=1);
|
|
|
|
[time] e>0 & y<5 -> (y'=y+1);
|
|
[] e=1 & y>=1 -> 0.1 : (e'=0) & (y'=0) + 0.9 : (e'=2) & (y'=0);
|
|
[recv] e=2 & y>=1 -> (e'=0) & (y'=0);
|
|
|
|
endmodule
|
|
|