|
|
|
|
|
|
|
|
|
|
|
|
Increment and Decrement Operators
|
|
|
The increment (++) and decrement (--) operators increment and decrement the operand by 1, respectively. These two unary operators can be placed before or after an operand. The result of the operation is assigned back to the operand, and assigned to a variable optionally. Valid operands are variables of an integral type. |
|
|
|
|
|
|
|
|
|
|
|
Example : Increment and Decrement Operators
|
|
|
|
|
|
1 program inc_dec {
2 integer i = 100;
3 bit [7:0] b = 44;
4
5 printf("value of i %0d\n",i);
6 printf("value of b %0d\n",b);
7 i ++;
8 b --;
9 printf("value of i %0d\n",i);
10 printf("value of b %0d\n",b);
11 }
You could download file inc_dec.vr here
|
|
|
|
|
|
Simulation : Increment and Decrement Operators
|
|
|
|
|
|
value of i 100
value of b 44
value of i 101
value of b 43
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|