Quantcast
Channel: UVM Forums RSS Feed
Viewing all articles
Browse latest Browse all 756

fixed-size arrays : Do they not 'support' size()?

$
0
0

Do fixed-size arrays not support .size()?

 
Or, am I doing smthg wrong below?
Running irun 13.1, I am told that .size() "is not a valid built in method name for this object".
 
 
If they do not, is this b/c 
 a. the expectation is that someone used a parameter/constant to specify the size of the array and that they can just use it everywhere else they might need it
 b. fixed sizes arrays were part of pre-SystemVerilog Verilog and as such missed this convenient feature.
?
 
Just before publishing, I discovered section "20.7 Array querying functions" in the 1800-2012.pdf, SystemVerilog spec:  $size()
 
module top;
   int farray[10];  //fixed array

   initial begin
//1    for (int jjj=0; jjj<10; jjj++) begin             //works
/*2*/  for (int jjj=0; jjj<farray.size(); jjj++) begin  //doesn't work
//3    for (int jjj=0; jjj<$size(farray); jjj++) begin  //works
          farray[jjj] = $urandom_range(121,0);
       end

      $display("******************************");
      for (int jjj=0; jjj<10; jjj++) begin
         $display("%0d: %0d",jjj,farray[jjj]);
      end
   end
endmodule : top

 


Viewing all articles
Browse latest Browse all 756

Trending Articles