Ansen1
New Contributor
1 year agoFPGA extracting wrong value form array
I'm doing a project where I'm making a Rayleigh-distributed random number generator. I do not understand, but for some reason, my FPGA is incorrectly interpreting a value from an array.
The array is very long but here is a snippet.
type lut_type is array (0 to 991) of integer;
--Gradient
constant C1 : lut_type := (18199);
This is how I assign a value from the array.
UNR <=std_logic_vector(to_unsigned(C1(counter), 16));
Somehow when I send the value of UNR over serial coms it reads some of the values wrong like 18199 as 18198. I know my python script is reading the values correctly. According to Modelsim the value assigned to UNR is 18199. But when I upload it to the FPGA It read/sends the wrong value.
What could cause this?