carleethian
Newbie level 4
Hi guys, I want to create something like the following, essentially creating a lookup table based on the number of states and max/min that I set outside the generate loop. Can I do this without any problems?
I basically want to create a lookup table that I'm going to need to iterate on and don't want to have to type it in each time. Therefore I'd prefer to have my lookup table be generated pre-processor each time. Only inputs would be essentially be lookup table size and slope of "r_TICKS".
Thanks.
Code:
parameter STATES = 4;
parameter MAX = 5;
parameter MIN = 1;
case(r_STATE)
genvar N;
generate
for (N=0; N<STATES; N=N+1)
begin
N:
begin
r_TICKS <= (MAX - MIN) * 2 / N;
r_STATE <= r_STATE + 1;
end
end
endgenerate
default:
begin
r_TICKS <= 0;
r_ACCL_STATE <= 0;
end
endcase
I basically want to create a lookup table that I'm going to need to iterate on and don't want to have to type it in each time. Therefore I'd prefer to have my lookup table be generated pre-processor each time. Only inputs would be essentially be lookup table size and slope of "r_TICKS".
Thanks.