quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Default Argument

To handle common cases or allow for unused arguments, Vera allows you to define default values for each scalar argument.

   

space.gif

When the subroutine is called, you can omit an argument that has a default defined for it. Use an asterisk (*) as a placeholder in the subroutine call. If an asterisk is used for a variable that does not have a default value, a compilation error occurs.

   

space.gif

   

space.gif

  ../images/main/4blue_dots_bullets.gif Example : Default Argument
   

space.gif


  1 program default_value {
  2   bit [7:0]  no = 100;
  3   print(*,no,*);
  4   print(21,no,10);
  5 }
  6 
  7 task print (integer m = 0, var bit [7:0] port_no, 
  8   integer flow_no = 0) {
  9   
 10   printf("Inside m           %0d\n",m);
 11   printf("Inside Port Number %0d\n",port_no);
 12   printf("Inside Flow Number %0d\n",flow_no);
 13 }
You could download file default_value.vr here
   

space.gif

  ../images/main/4blue_dots_bullets.gif Simulation : Default Argument
   

space.gif

 Inside m           0
 Inside Port Number 100
 Inside Flow Number 0
 Inside m           21
 Inside Port Number 100
 Inside Flow Number 10
   

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