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 agoHi Dave,
Thanks .. The thing is that I have a random Integer input in the 0 - 579 range, without any fractions, simply integers :) ...(xmin-xmax) This need be scaled to the -1 to 1 range (ymin-ymax) following this rule y = (ymax-ymin)*(x-xmin)/(xmax-xmin) + ymin; In my application it is: y = (2*x)/579-1 So based on what you said, to implement the above formula, all I need to do is shift my integer 10 bits to the right?? and then subtract one? Note that the following Hardware stages are in signed fixed point format with <S, M, N> = <1 sign,5 integer,10 fraction>, is the result readily available for use in the following stages?? or scaling is further needed? Thanks