carleethian
Newbie level 4
I want to create a lookup table inside an array. The code below won't compile, can someone please let me know what I'm doing wrong? Does the for loop need to be in the always block? What I really want is for the compiler to do all the math and load the values into memory...
Does anyone know how to do this or maybe know of a better way?
Code:
localparam BIT_WIDTH = 8;
localparam NUM_STATES = 255;
reg [BIT_WIDTH-1:0] State_Array [0:NUM_STATES-1];
for (i=0; i < NUM_STATES; i = i + 1)
begin
State_Array[i] = 1000000 * i / (i+1);
end
always @ (....)
Does anyone know how to do this or maybe know of a better way?