博文

目前显示的是标签为“sine wave”的博文

How to generate sine wave in FPGA?

图片
 Here are the most practical ways to generate a sine wave on an FPGA —from “quick & clean” to “resource-lean.” I’ll give you design rules, formulas, and drop-in HDL. The main approaches (pick one) Method When to use Notes DDS/NCO + LUT Easiest, precise frequency control Phase accumulator → lookup table. Best with an external DAC or 1-bit ΣΔ + RC. CORDIC You want to save BRAM / make sin/cos on the fly Uses add/shift stages; needs scaling factor compensation. PWM or ΣΔ DAC No external DAC available Filter the pin with RC/active LPF. ΣΔ generally cleaner than plain PWM. 1) DDS / NCO + LUT (golden path) How it works Phase accumulator : phase <= phase + phase_inc; Top M bits of phase index a sine LUT (ROM/BRAM). Frequency : f out = phase_inc 2 N   f clk f_\text{out} = \frac{\text{phase\_inc}}{2^N}\,f_\text{clk} f out ​ = 2 N phase_inc ​ f clk ​ Resolution example (N=32, fclk=100 MHz): ~ 0.0233 Hz steps. Compute phase_inc : round(f_out * 2^N / f_clk) – ...