summaryrefslogtreecommitdiff
path: root/tests/source/counters.scade
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ansys.com>2014-07-04 16:21:45 +0200
committerAlex Auvolat <alex.auvolat@ansys.com>2014-07-04 16:21:45 +0200
commitb1cdf90995c8f70e4a450b3319a136f0d50515d0 (patch)
tree9074c54967f384fac8d41359a503774158081ac9 /tests/source/counters.scade
parent1445a2be1e1bd81efa552230a0f11672aa20a92c (diff)
downloadscade-analyzer-b1cdf90995c8f70e4a450b3319a136f0d50515d0.tar.gz
scade-analyzer-b1cdf90995c8f70e4a450b3319a136f0d50515d0.zip
New example ; minor fixes.
Diffstat (limited to 'tests/source/counters.scade')
-rw-r--r--tests/source/counters.scade38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/source/counters.scade b/tests/source/counters.scade
new file mode 100644
index 0000000..334bca1
--- /dev/null
+++ b/tests/source/counters.scade
@@ -0,0 +1,38 @@
+/*
+ x = 10 | 9 | 8 | 7 | 6 | 5 | ... | 0 | 1 | 2 | ... | 10 | ...
+ y = 0 | 1 | 2 | 3 | 4 | 5 | ... | 10 | 9 | 8 | ... | 0 | ...
+
+ b1 = t | f | f | f | f | f | ... | f | f | f | ... | t | ...
+ b2 = t | f | f | f | f | f | ... | f | f | f | ... | t | ...
+
+ eq* = t | t | t | t | t | t | ... | t | t | t | ... | t | ...
+*/
+
+
+-- type t2 = subrange [0,10] of int;
+
+const bound: int = 1000;
+
+node counters(z: bool) returns (eq_nind : bool ; probe x, probe y : int)
+var
+ b1, b2 : bool;
+ a, b : bool;
+let
+
+ a = false -> (if pre a then pre x < bound else pre x <= 0);
+ --a = false -> pre(if a then x < bound else x <= 0);
+ x = bound -> (if a then pre x + 1 else pre x - 1);
+
+ b = true -> (if pre b then pre y < bound else pre y <= 0);
+ --b = true -> pre(if b then y < bound else y <= 0);
+ y = 0 -> (if b then pre y + 1 else pre y - 1);
+
+ b1 = x=bound;
+ b2 = y=0;
+
+
+ guarantee xy : x+y = bound;
+ guarantee bb : b1 = b2;
+ guarantee rp : -bound <= (x-y) and (x-y) <= bound;
+
+tel