ProMeLa implementation (excl. ltl) done
This commit is contained in:
parent
d207d42f77
commit
4f00be95f5
1 changed files with 23 additions and 14 deletions
|
@ -2,10 +2,18 @@
|
||||||
#define LENGTH 3
|
#define LENGTH 3
|
||||||
#define R 2
|
#define R 2
|
||||||
|
|
||||||
|
int to_reverse[LENGTH]; // array to reverse
|
||||||
|
int reversed[LENGTH]; // array where the reverse is stored
|
||||||
|
|
||||||
|
// ThreadedReverser implementation
|
||||||
|
proctype ThreadedReverser(int from; int to) {
|
||||||
|
int k;
|
||||||
|
for (k: from .. to) {
|
||||||
|
reversed[LENGTH - k - 1] = to_reverse[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
int to_reverse[LENGTH];
|
|
||||||
|
|
||||||
// array initialization
|
// array initialization
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -16,20 +24,21 @@ init {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int reversed[LENGTH];
|
// ParallelReverser implementation
|
||||||
|
int n;
|
||||||
// sequential reverser
|
int s = LENGTH / N;
|
||||||
{
|
for (n: 0 .. N) {
|
||||||
int from = 0;
|
int from = n * s;
|
||||||
int to = LENGTH ;
|
int to;
|
||||||
|
if
|
||||||
int k;
|
:: (n == N - 1) -> to = LENGTH;
|
||||||
for (k: from..to) {
|
:: else -> to = n * s + s;
|
||||||
reversed[LENGTH - k - 1] = to_reverse[k];
|
fi
|
||||||
}
|
run ThreadedReverser(from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ltl syntax: https://spinroot.com/spin/Man/ltl.html
|
||||||
ltl test {
|
ltl test {
|
||||||
eventually (false) implies true
|
eventually (false) implies true
|
||||||
// eventually (a > b) implies len(q) == 0
|
// eventually (a > b) implies len(q) == 0
|
||||||
|
|
Reference in a new issue