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 Real Literals

The default type is real for fixed point format and exponent format. We can do type casting to covert from real values to shortreal type. Following are real literals examples.

   

space.gif

  • 3.14
  • 2.0e16
   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example - Real Literals
   

space.gif


  1 `timescale 1ns/100ps
  2 module real_literals ();
  3 
  4 real  a;
  5 shortreal  b;
  6 
  7 initial begin
  8   $monitor ("@ %gns a = %e b = %e ", $time, a, b);
  9   a = '0;
 10   b = 1.0e2;
 11    #1  a = 2e5;
 12   // Type casting
 13    #1  b = shortreal'(a);
 14    #1  a = 2.1E-2;
 15   // Type casting
 16    #1  b = shortreal'(a);
 17    #1  $finish;
 18 end
 19 
 20 endmodule
You could download file real_literals.sv here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulator Output
   

space.gif

 @ 0ns a = 0.000000e+00 b = 1.000000e+02
 @ 1ns a = 2.000000e+05 b = 1.000000e+02
 @ 2ns a = 2.000000e+05 b = 2.000000e+05
 @ 3ns a = 2.100000e-02 b = 2.000000e+05
 @ 4ns a = 2.100000e-02 b = 2.100000e-02
   

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