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.

76 lines
2.8 KiB

8 years ago
  1. // nand multiplex system
  2. // gxn/dxp 20/03/03
  3. // U (correctly) performs a random permutation of the outputs of the previous stage
  4. dtmc
  5. const int N = 5; // number of inputs in each bundle
  6. const int K = 2; // number of restorative stages
  7. const int M = 2*K+1; // total number of multiplexing units
  8. // parameters taken from the following paper
  9. // A system architecture solution for unreliable nanoelectric devices
  10. // J. Han & P. Jonker
  11. // IEEEE trans. on nanotechnology vol 1(4) 2002
  12. const double perr = 0.02; // probability nand works correctly
  13. const double prob1 = 0.9; // probability initial inputs are stimulated
  14. // model whole system as a single module by resuing variables
  15. // to decrease the state space
  16. module multiplex
  17. u : [1..M]; // number of stages
  18. c : [0..N]; // counter (number of copies of the nand done)
  19. s : [0..4]; // local state
  20. // 0 - initial state
  21. // 1 - set x inputs
  22. // 2 - set y inputs
  23. // 3 - set outputs
  24. // 4 - done
  25. z : [0..N]; // number of new outputs equal to 1
  26. zx : [0..N]; // number of old outputs equal to 1
  27. zy : [0..N]; // need second copy for y
  28. // initially 9 since initially probability of stimulated state is 0.9
  29. x : [0..1]; // value of first input
  30. y : [0..1]; // value of second input
  31. [] s=0 & (c<N) -> (s'=1); // do next nand if have not done N yet
  32. [] s=0 & (c=N) & (u<M) -> (s'=1) & (zx'=z) & (zy'=z) & (z'=0) & (u'=u+1) & (c'=0); // move on to next u if not finished
  33. [] s=0 & (c=N) & (u=M) -> (s'=4) & (zx'=0) & (zy'=0) & (x'=0) & (y'=0); // finished (so reset variables not needed to reduce state space)
  34. // choose x permute selection (have zx stimulated inputs)
  35. // note only need y to be random
  36. [] s=1 & u=1 -> prob1 : (x'=1) & (s'=2) + (1-prob1) : (x'=0) & (s'=2); // initially random
  37. [] s=1 & u>1 & zx>0 -> (x'=1) & (s'=2) & (zx'=zx-1);
  38. [] s=1 & u>1 & zx=0 -> (x'=0) & (s'=2);
  39. // choose x randomly from selection (have zy stimulated inputs)
  40. [] s=2 & u=1 -> prob1 : (y'=1) & (s'=3) + (1-prob1) : (y'=0) & (s'=3); // initially random
  41. [] s=2 & u>1 & zy<(N-c) & zy>0 -> zy/(N-c) : (y'=1) & (s'=3) & (zy'=zy-1) + 1-(zy/(N-c)) : (y'=0) & (s'=3);
  42. [] s=2 & u>1 & zy=(N-c) & c<N -> 1 : (y'=1) & (s'=3) & (zy'=zy-1);
  43. [] s=2 & u>1 & zy=0 -> 1 : (y'=0) & (s'=3);
  44. // use nand gate
  45. [] s=3 & z<N & c<N -> (1-perr) : (z'=z+(1-x*y)) & (s'=0) & (c'=c+1) & (x'=0) & (y'=0) // not faulty
  46. + perr : (z'=z+(x*y)) & (s'=0) & (c'=c+1) & (x'=0) & (y'=0); // von neumann fault
  47. // [] s=3 & z<N -> (1-perr) : (z'=z+(1-x*y)) & (s'=0) & (c'=c+1) & (x'=0) & (y'=0) // not faulty
  48. // + perr : (z'=z+(x*y)) & (s'=0) & (c'=c+1) & (x'=0) & (y'=0); // von neumann fault
  49. [] s=4 -> (s'=s);
  50. endmodule
  51. // rewards: final value of gate
  52. rewards
  53. // [] s=0 & (c=N) & (u=M) : z/N;
  54. s=0 & (c=N) & (u=M) : z/N;
  55. endrewards
  56. label "target" = s=4 & z/N<0.1;
  57. label "end" = s=4;