|
|
|
|
|
|
|
|
|
|
|
|
repeat
|
|
|
The repeat loop executes < statement > a fixed < number > of times. |
|
|
|
|
|
Syntax: |
|
|
|
|
|
repeat (expression) statement
|
|
|
|
|
|
|
|
|
|
|
|
Example : repeat
|
|
|
|
|
|
1 program case_statement {
2 integer i = 2;
3 repeat (3) {
4 do_case(i);
5 i --;
6 }
7 }
8
9 task do_case(bit [1:0] sel) {
10 case(sel) {
11 0 : printf("Nothing is selected\n");
12 1 : {
13 printf("something is selected\n");
14 printf("This is multi statment example\n");
15 }
16 default : {
17 printf("Default is selected\n");
18 }
19 } // case (sel)
20 }
You could download file repeat_statement.vr here
|
|
|
|
|
|
Simulation : repeat
|
|
|
|
|
|
Default is selected
something is selected
This is multi statment example
Nothing is selected
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|