Forum Discussion
26 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- Just use my above code. The max_val updates and stores din by itself until it is updated (if at all). I am sorry I have not done verilog for years so can't help directly at code level. Yourlast code and waveforms looks ok to me --- Quote End --- Ya the last code is ok i think... but is it posibble to output only the max_value "256" and location "6" throughout the waveforms? - Altera_Forum
Honored Contributor
once value 256 comes in it will displace any lower value at max_val and will stay so until a higher value comes in and kicks it out
- Altera_Forum
Honored Contributor
okok... i understood this... but i need the waveform show only the largest value without showing the previous smaller values... never mind, i try to find solution myself... thanks so much anyway :)
- Altera_Forum
Honored Contributor
--- Quote Start --- okok... i understood this... but i need the waveform show only the largest value without showing the previous smaller values... never mind, i try to find solution myself... thanks so much anyway :) --- Quote End --- The waveform displays values of the node(max_val) so you will always see its values from time zero. you can add further node saying if val = 255 then max_final = 255 but I haven't got a clue what use this is going to be. - Altera_Forum
Honored Contributor
- Altera_Forum
Honored Contributor
haven't you already done that as evident from your sim waveforms.
You will need a time machine to do that (internal delays) - Altera_Forum
Honored Contributor
--- Quote Start --- haven't you already done that as evident from your sim waveforms. You will need a time machine to do that (internal delays) --- Quote End --- No i didn't simulate it... that one i drew... i know how to do delay(move the d_in backwards), but don't know how to move it forward... cos now if the input is shown as the previous attachment.... i want to start counting the peak from '15'... not from '0'... mem_array[Q] <= d_in; d_out <= mem_array[Q-3]; //these codes are for delay... - Altera_Forum
Honored Contributor
If I can move data forward I wouldn't be here as I will just win lotteries
- Altera_Forum
Honored Contributor
ok... cos now after passing through the FFT core, the output of FFT is like the d_in i showed... i want to find the peak value and its location... yes the peak value can be found but the location shown is not correct as it's not counted from the first valid output of the FFT core... and also i want to find several peaks to find what frequencies have been inputted... if you don't know how to do it, then never mind... thanks for your replies...
- Altera_Forum
Honored Contributor
--- Quote Start --- ok... cos now after passing through the FFT core, the output of FFT is like the d_in i showed... i want to find the peak value and its location... yes the peak value can be found but the location shown is not correct as it's not counted from the first valid output of the FFT core... and also i want to find several peaks to find what frequencies have been inputted... if you don't know how to do it, then never mind... thanks for your replies... --- Quote End --- you don't need to push fft output forward. All you need is check the fft frame when ready for peaks. The location of peak need to be adjusted for latency issues so you need to check that in simulation. For multiple peaks you shouldn't use max value, instead you need to define an absolute threshold to define your peaks then check fft output against that threshold, save peaks accordingly.