Community
cancel
Showing results for
Did you mean:
Highlighted
Valued Contributor III
706 Views

## sine wave: how to set amplitude?

Hi. If i generate a sine wave signal(Full Scale - 24bit - 5Vpp) using the altera NCO, how to generate a 0.8902 Vpp sine wave?

Regards

Woei Chee
3 Replies
Highlighted
Valued Contributor III
5 Views

Thr NCO core doesn't provide amplitude modulation or scaling, you can use a multiplier block.

Highlighted
Valued Contributor III
5 Views

Regarding the multiplier(mult) block, there are few types of mult block which are LPM_mult and fp_mult(floating point).

Is LPM_mult a fixed point mult?

should i use floating point or fixed point for my case(aim for accuracy) in audio testing application?

i am confused because there are different opinion in this issue.

someone stated that in audio application, should use fixed point while

in general article, for accuracy, use floating point..

In my opinion, i should use floating point. What do u think?

Since one of the input is 24bit of mult block, is there any disadvantage of using 18 x 18 mult block? will it cascade by itself? losing accuracy or speed?

In verilog, if use multiplication(*), will it use the embedded mult block? How can I control to choose whether i want to use embedded mult block?

Thanks
Highlighted
Valued Contributor III
5 Views

I would avoid using floating-point in your situation, converting to FP, performing one scaling operation, and converting back to fixed-point does not make sense, just use fixed-point. If you are scaling from 5V to 0.8902V multiply your full signal by (0.8902V/5V) = 0.17804. Depending on how accurate the scaling must be, I would recommend using 24x18 mult with the scale factor in Q1.17 format (or unsigned 18 bit fraction) and the result is taken to be the upper 24 bits (excluding the duplicate sign bit). With respect to hardware used, Quartus has been improving its ability to infer multipliers (in the form of megafunctions) from HDL * operators, but if you want good control over the hardware generated including pipeline stages and clk enables then use the megafunctions. The megafunctions allow for control between using "hard" or "soft" multipliers. Additionally, altmult_add allows more control over the embedded multiplier block than the lpm_mult. Also, the Altera megafunctions will automatically add the partial products.