Forum Discussion
Altera_Forum
Honored Contributor
12 years agoSo, to answer my own question, this appears to work, while not entirely elegant:
`define MAX_BAR 128
typedef logic bar_t;
function bar_t makeFoo (input integer x);
bar_t bar;
integer i;
for (i = 0; i < x; i++) begin
bar = i + 1;
end
return bar;
endfunction
. . .
localparam bar_t FOO = makeFoo(SIZE);
I'd like to be able to size everything only as large as I need it. But for static analysis, it's probably sufficient for most uses to set an upper bound like this. Again, if anyone has a cleaner way to do this, I'd be interested to see it.