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 Array literals

Array literals are syntactically similar to C initializers, but with the replicate operator ( {{}} ) allowed. The nesting of braces must follow the number of dimensions, unlike in C.

   

space.gif

   

space.gif

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

space.gif


  1 `timescale 1ns/100ps
  2 module array_literals ();
  3 
  4 byte a [0:1][0:2] = '{'{0,1,2},'{3{8'h9}}};
  5 
  6 initial begin
  7   $display ("a [0][0] = %d", a[0][0]);
  8   $display ("a [0][1] = %d", a[0][1]);
  9   $display ("a [0][2] = %d", a[0][2]);
 10   $display ("a [1][0] = %d", a[1][0]);
 11   $display ("a [1][1] = %d", a[1][1]);
 12   $display ("a [1][2] = %d", a[1][2]);
 13    #1  $finish;
 14 end
 15 
 16 endmodule
You could download file array_literals.sv here
   

space.gif

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

space.gif

 a [0][0] = 0
 a [0][1] = 1
 a [0][2] = 2
 a [1][0] = 9
 a [1][1] = 9
 a [1][2] = 9
   

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