I would like to be able to assign an array of localparams with some kind of static function. For example I don't want to have to do this:
Because, while this works, it isn't fully parametric. I'd like to be able to do something like:
Unfortunately, size inside of makeFoo isn't static (or at least Modelsim says it isn't).
Anyway, I'm wondering if anyone has a way to do this. I use static functions all the time to define simple localparam types, but this is proving more difficult.
Thanks,
Todd
Code:
localparam SIZE = 3;
typedef logic [31:0] bar_t;
localparam bar_t [SIZE-1:0] FOO = {32'd1, 32'd2, 32'd3};
Code:
localparam SIZE = 3;
typedef logic [31:0] bar_t;
function makeFoo (input integer size);
bar_t [size-1:0] bar;
integer i;
for (i = 0; i < size; i++) begin
bar[i] = i;
end
return bar;
endfunction
localparam bar_t [SIZE-1:0] FOO = makeFoo(SIZE);
Anyway, I'm wondering if anyone has a way to do this. I use static functions all the time to define simple localparam types, but this is proving more difficult.
Thanks,
Todd