quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif 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.

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : Increment and Decrement Operators
   

space.gif


  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
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : Increment and Decrement Operators
   

space.gif

 value of i 100
 value of b 44
 value of i 101
 value of b 43
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com