Forum Discussion
Altera_Forum
Honored Contributor
13 years agoQ (number format) Multiply
I'm working on a project that uses a 32-bit accumulator, which it's input is a 32-bit step size (unsigned Q30.2) value. The accumulator can rollover when preforming a large number of iterations or w...
Altera_Forum
Honored Contributor
13 years agoThanks for your help.
I'll consider using the package, but I'll need to convert all the code over. If I continue down the same path using std_logic_vector, I understand that the product will be a Q62.2 value. How would I scale that value to be 32 bits? Would I use the upper 32-bits? temp = CONV_STD_LOGIC_VECTOR(CONV_INTEGER(CONV_INTEGER(in tra_clk_offset) * CONV_INTEGER(step_size)), 64); amplitude = temp(64 downto 32); I know "CONV_STD_LOGIC_VECTOR" will not work with a 64 bit value, just using this as an example.