Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Diskussionen

How to find magnitude of source_real and source_imag after FFT in VERILOG code?

Altera_Forum
Geehrter Beitragender II
2.070Aufrufe

Hi, i want to find the peaks after FFT, and i need to find the magnitudes of source_real and source_imag in order to find the peaks... how to achieve this?

0 Kudos
4 Antworten
Altera_Forum
Geehrter Beitragender II
1.350Aufrufe

 

--- Quote Start ---  

Hi, i want to find the peaks after FFT, and i need to find the magnitudes of source_real and source_imag in order to find the peaks... how to achieve this? 

--- Quote End ---  

 

 

mag = square root(re^2+im^2). 

 

if too much resource is needed then use cordic algorithm.
Altera_Forum
Geehrter Beitragender II
1.350Aufrufe

 

--- Quote Start ---  

mag = square root(re^2+im^2). 

 

if too much resource is needed then use cordic algorithm. 

--- Quote End ---  

 

 

 

of course i know the equation for the magnitude... but it's impossible to write like that in Verilog code right?
Altera_Forum
Geehrter Beitragender II
1.350Aufrufe

You certainly can get re^2 (re*re) and im^2(im*im) then you add both results. What is left is square root and that is the hard bit. You can use altera's square root ip or use a lookup table for that.  

 

Verilog should allow you to infer mults and adder but I am not sure if you can infer sqrt so I will go for ip instantiation. 

 

The cordic amp is far more popular as it requires very little resource but output is ready after some few iterations (6 or so depending on required accuracy)
Altera_Forum
Geehrter Beitragender II
1.350Aufrufe

 

--- Quote Start ---  

You certainly can get re^2 (re*re) and im^2(im*im) then you add both results. What is left is square root and that is the hard bit. You can use altera's square root ip or use a lookup table for that.  

 

Verilog should allow you to infer mults and adder but I am not sure if you can infer sqrt so I will go for ip instantiation. 

 

The cordic amp is far more popular as it requires very little resource but output is ready after some few iterations (6 or so depending on required accuracy) 

--- Quote End ---  

 

 

 

i don't have much time to complete it... however i'll try, hope that it won't be too complicated... thank you!
Antworten