source: CIVL/examples/arithmetic/quadratic2.cvl@ bb03188

main test-branch
Last change on this file since bb03188 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 849 bytes
Line 
1#include <civlc.cvh>
2#include <stdio.h>
3
4$input int x, y, z, w;
5$input int N, M, L, K;
6$input int offset;
7
8$assume(0< N && N <= 2);
9$assume(0< M && M <= 2);
10$assume(0< L && L <= 2);
11$assume(0< K && K <= 2);
12$assume(0 <= x && x < N);
13$assume(0 <= y && y < M);
14$assume(0 <= z && z < L);
15$assume(0 <= w && w < K);
16$assume(0 <= offset );
17$assume((offset + x*M*L*K + y*L*K + z*K + w) < M*N*L*K);
18
19void main(){
20
21 int realIndex, finalIndex, X, Y, Z, W;
22
23 realIndex = x * M * L * K + y * L * K + z * K + w;
24 finalIndex = realIndex + offset;
25 X = finalIndex / (M * L * K);
26 finalIndex = finalIndex - X * M * L * K;
27 Y = finalIndex / (L * K);
28 finalIndex = finalIndex - Y * L * K;
29 Z = finalIndex / K;
30 W = finalIndex - Z * K;
31
32 printf("X=%d, Y=%d, Z=%d, W=%d\n", X,Y,Z,W);
33 $assert(X < N);
34 $assert(Y < M);
35 $assert(Z < L);
36 $assert(W < K);
37}
Note: See TracBrowser for help on using the repository browser.