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 Conditional Operators
   

space.gif

  • The conditional operator has the following C-like format:
    • cond_expr ? true_expr : false_expr
  • The true_expr or the false_expr is evaluated and used as a result depending on what cond_expr evaluates to (true or false).
   

space.gif

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : Conditional Operators
   

space.gif


  1 program conditional {
  2   bit out;
  3   reg enable,data ;
  4   
  5   enable = 0;
  6   data  = 1; 
  7   out = (enable) ? data : 1'bz;
  8   printf(" Enable %b  Data %b    Out %b\n",enable,data,out);
  9 
 10   enable = 1;
 11   out = (enable) ? data : 1'bz;
 12   printf(" Enable %b  Data %b    Out %b\n",enable,data,out);
 13 }
You could download file conditional.vr here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : Conditional Operators
   

space.gif

  Enable 0  Data 1    Out z
  Enable 1  Data 1    Out 1
   

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