1.23
2.0
main
test-branch
|
Last change
on this file since 38b7d06 was 2c448829, checked in by Manchun Zheng <zmanchun@…>, 12 years ago |
|
Improve the implementation for $atomic and $atom statements, taking into account non-determinism, blocking, loop, etc in $atomic blocks.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@379 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
322 bytes
|
| Line | |
|---|
| 1 | $input int B;
|
|---|
| 2 | $input int N;
|
|---|
| 3 | $assume 0<N && N<B;
|
|---|
| 4 | int n = 3;
|
|---|
| 5 |
|
|---|
| 6 | void main(){
|
|---|
| 7 | int x;
|
|---|
| 8 |
|
|---|
| 9 | $atomic{
|
|---|
| 10 | x = N;
|
|---|
| 11 | x = x * 2;
|
|---|
| 12 | }
|
|---|
| 13 | $assert x == 2*N;
|
|---|
| 14 | // non-determinism allowed in $atomic block
|
|---|
| 15 | $atomic{
|
|---|
| 16 | x = 3;
|
|---|
| 17 | $choose {
|
|---|
| 18 | $when (n>2) { x=2; }
|
|---|
| 19 | $when (n>1) { x=1; }
|
|---|
| 20 | default: {x=0; }
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 | $assert (x == 2 || x == 1);
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.