So I am trying to declare a variable sized array based on a generate variable, but my linting tool SpyGlass complains about rule BitOrder-ML and gives the following error message:
Declare 'Vector Size' bit order '[((1 << level) -1):0]' as per convention
This is the code that generates the problem:
genvar level;
localparam integer LEVELS = 3;
generate
for (level=0; level<LEVELS; level=level+1) begin
wire result[(1 << level)-1:0];
end
endgenerate
Is SpyGlass sane here? Does it somehow think that the expression (1 << level)-1 would generate to a negative value?
The synthesize completes without a problem when the error is waived.
level == 0? you will get theresult[-1:0]i would not blame spyglass for that.