Here i am creating array in class following:
logic store[0:FF][15:0];
Now I am storing value at 0th location in class.
logic store[0][15:0]=‘{’{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
then during VCS(J-2014.12-SP2) compilation i getting following error.
Error-[ZONVS] Zero or negative value for sized
Zero or negative value for size is not allowed.
Value: 0
first,you have to declare store as logic store[0:255][15:0] because you shouldnot write hexadecimal number as index.
second,here,store is a multidimension unpacked array and here you wanted to assign 0th array with all 1’s .it is
store[0]='{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
(or)
store[0][0:15] = '{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
In reply to p_patel:
A couple of problems with your code
You can’t declare
store twice, or any variable in sections. There can only be one declaration. So you either need to use an initial block assignment, or create an assignment pattern that covers all elements in your declaration.
If you are using an initial bock than you need to modify your assignment patter to cover only one element of the first dimension.
logic store[0:'hFF][15:0];
initial store[0]='{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; // or = '{default:1}
To do this as a single variable declaration initialization, the assignment pattern would look like this:
logic store[0:'hFF][15:0]={0:'{default:1},default:'{default:'x}};
In reply to p_patel:
Is that not exactly what I just wrote?
I got your point Dave,
Thanks
Priyank
Dave whatever you told is correct and its working(2nd option).But we can’t use “initial” statement in class (1st option):
initial store[0]='{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; // or = '{default:1}
In reply to p_patel:
Just put the assignment inside the constructor.