ljepson74 Posted April 17, 2014 Report Share Posted April 17, 2014 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; //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 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.