|
|
|
|
|
|
|
|
|
|
|
|
randcase
|
|
|
The randcase statement specifies a block of statements, one of which is executed randomly. Personally I never used this feature of Vera. |
|
|
|
|
|
Syntax : randcase |
|
|
|
|
|
randcase {
weight1 : statement1
weight2 : statement2
...
weightN : statementN
}
|
|
|
|
|
|
|
|
|
|
|
|
Example : randcase
|
|
|
|
|
|
1 program randcase_statement {
2 // You need to run for more iteration to
3 // get proper distribution
4 repeat(10) {
5 do_randcase();
6 }
7 }
8
9 task do_randcase() {
10 randcase {
11 20 : {
12 printf ("What should I do ? \n");
13 }
14 20 : {
15 printf ("Should I work\n");
16 }
17 20 : {
18 printf ("Should I watch Movie\n");
19 }
20 40 : {
21 printf ("Should I complete tutorial\n");
22 }
23
24 }
25 }
You could download file randcase_statement.vr here
|
|
|
|
|
|
Simulation : randcase
|
|
|
|
|
|
What should I do
What should I do
Should I work
Should I complete tutorial
Should I complete tutorial
What should I do
What should I do
Should I work
Should I work
Should I work
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|