Suppose I have the following module definition,
module foo(b)
input b;
parameter length = 8;
reg [length-1:0] dummy ;
Now, I want to assign values to this dummy array. For instance I want to make it all 1s. If the length was not parameterized, I could do this,
always @(posedge b)
dummy <= 8'hFF;
But when the length is parameterized, I would hope to do this,
always @(posedge b)
dummy <= length'hFFFF //won't even compile. even if it did, how many F's should there be?
How can I assign ones (or zeroes) to an entire array whose length is parameterized? Or more generally, how can I assign values while specifing the length of a parameterized array?
reg [length-1:0] dummy;Your declaration was unpacked, and you cannot have those kind of assignments to unpacked array, parameterized or not.