Forum Discussion
Altera_Forum
Honored Contributor
15 years agoNumber Scaling
Hi, What is the most efficient way to scale numbers into the range of -1, 1 in Verilog using Cyclone II? That is the fastest code with least resources? are there any free IP cores from Altera o...
Altera_Forum
Honored Contributor
15 years ago --- Quote Start --- Well, the data represents the number of black pixels in certain zones in a binary image .. The data is an input to a neural network for classification which requires a normalized input in the range of -1 to 1! --- Quote End --- Ok, thanks. --- Quote Start --- Well, i tried Kaz's method in C, the fixed point representation as displayed in hex format doesn't match the value!! What I did is multiply the floating point number by 1024 (10 bit fraction accuracy) and cast to integer .. it didn't match --- Quote End --- Why don't you post a couple of examples of the number of black pixels, the corresponding value in floating-point normalized to between -1.0 and 1.0, and then the corresponding 10-bit Q0.9 format number. I suspect by the time you repeat this, you will realize your mistake. Cheers, Dave