Forum Discussion
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- The attached jpeg file hopefully makes it clearer. The x-axis represents the random numbers and the y-axis is the "bins" (1-256). In a mathematical sense, there is a many-to-one relationship: many random numbers map to the same bin. The values stored in the array are the lower and upper limits for a particular bin. In the example in my first post, any random number generated between 19 & 54 corresponds to Bin 2. --- Quote End --- The plot is a nice smooth function, so you should be able to represent it using a polynomial. If you are lucky, it might be as simple as X^N. If it is that simple, then given Y = X^N, taking the log of both sides gives log(Y) = N*log(X) So if you plot log(Y) versus log(X), you'll have a straight line with slope N. Try it and see. (Actually, it might be Y = X^N/256, since X is 16-bit, but y is 8-bit). Your FPGA processing logic would then consist of; 1) Logic to calculate Y_full = X^N 2) Logic to quantize Y_full to 8-bits to give the output Y 3) Use Y as the 256-entry table address Cheers, Dave