source: CIVL/examples/languageFeatures/bundleTest3_NTPack.cvl

main
Last change on this file 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: 1.3 KB
Line 
1#include <bundle.cvh>
2
3$input int M, N, L, I;
4$assume( 10 < M && 10 < N && 10 < L && 0 <= I && I < 10);
5
6$input int X[M][N];
7$input int Y[N][M];
8$input int Z[L][M][N];
9
10int x[M][N];
11int y[N][M];
12int z[L][M][N];
13int zz[L][N][M];
14int w[M][L][N];
15
16int main() {
17 /* $bundle bun = $bundle_pack(Z[I][M-I-1], sizeof(int) * N * I);
18 $bundle_unpack(bun, z[I]);
19 $assert($forall (int i : 0 .. (I-1))
20 ($forall (int j : 0 .. (N-1))
21 z[I][i][j] == Z[I][M-I-1+i][j]));*/
22
23 $bundle bun = $bundle_pack(&X[0][I], sizeof(int) * N);
24
25 // slice (&X[0][I], N * sizeof_int) -> x[0][0]
26 $bundle_unpack(bun, x);
27 $assert($forall (int i : 0 .. (N-I-1)) x[0][i] == X[0][I+i]);
28 $assert($forall (int i : N-I .. N-1) x[0][i] == X[1][i-(N-I)]);
29
30 bun = $bundle_pack(Z[I][I], sizeof(int) * N);
31
32 // slice (&Z[I][I][0], N * sizeof_int) -> x[0][0]
33 $bundle_unpack(bun, x);
34 $assert($forall (int i : 0 .. (N-1)) x[0][i] == Z[I][I][i]);
35
36 // slice (&Z[I][M-I-1][0], I* N * sizeof_int) -> x[0][0]
37 bun = $bundle_pack(Z[I][M-I-1], sizeof(int) * N * I);
38 $bundle_unpack(bun, x);
39 $assert($forall (int i : 0 .. (I-1))
40 ($forall (int j : 0 .. (N-1))
41 x[i][j] == Z[I][M-I-1+i][j]));
42
43 // slice (&Z[I][M-I-1][0], I * N * sizeof_int) -> z[I][0][0]
44 $bundle_unpack(bun, z[I]);
45 $assert($forall (int i : 0 .. (I-1))
46 ($forall (int j : 0 .. (N-1))
47 z[I][i][j] == Z[I][M-I-1+i][j]));
48
49}
Note: See TracBrowser for help on using the repository browser.