source: CIVL/examples/focus/nestedFor.cvl@ a7752a9

main test-branch
Last change on this file since a7752a9 was a7752a9, checked in by Alex Wilton <awilton@…>, 8 months ago

Added ability to loop focus with an offset or over a contiguous window of values.

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

  • Property mode set to 100644
File size: 496 bytes
Line 
1#include<assert.h>
2
3#pragma CIVL ACSL
4$input int M;
5$assume(0 < M);
6$input int N;
7$assume(0 < N);
8$input float A[M][N], B[M][N];
9
10int main() {
11 double C[M][N];
12 //@ loop assigns C[0..M-1][0..N-1];
13 //@ focus I | C[I][0..N-1];
14 for (int i = 0; i < M; i++) {
15 //@ loop assigns C[i][0..N-1];
16 //@ focus J | C[i][J];
17 for (int j = 0; j < N; j++) {
18 C[i][j] = A[i][j]+B[i][j];
19 }
20 }
21
22 //@ focus I J;
23 $assert($forall(int i:0..M-1;int j:0..N-1) C[i][j] == A[i][j]+B[i][j]);
24}
Note: See TracBrowser for help on using the repository browser.