- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello everyone,
I am working on speech recognition projet using nios 2. I need simple fft code in c to run on the nios. did anyone know where can i found one?Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you haven't found one yet, one way is to use matlab to generate C.
write your fft in matlab (one statement). then use mcc tool in Matlab to get C or C++ or exe. mcc = Matlab c compiler but may need its own licence- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a radix 2 FFT: http://www.altera.com/literature/tt/c2h_tutorial.zip
Look at the software only version as the hardware (C2H) version has been optimized and may be difficult to understand if you are not familiar with the hardware accelerator. Note: Most people use dedicated hardware for FFT as it will not run very fast on Nios II. There is a lot of multiplications and additions which makes it much more suitable to offload into hardware.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a question regarding the software fft funtion.
Can someone explain what exactly are they doing here:
InputData = InData >> FFT_SIZE;
It looks like they are shifting the input to the right by 8 bits, but won't that simply discard the lower 2 digits of the number? Or are they trying to divide each input number by 256? Another thing, if I have only the real values as input data, then do I have to add a 0 after each number to account for the missing imaginary data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Took me a while to figure out what that scaling of the input data is for. In the hardware accelerator version only 16-bit temp value are stored so by prescaling the input by >> 8 it makes sure the temp results between the FFT stages fit in a 16-bit variable. In reality that's more scaling than is necessary, so if you use the software version of the FFT then you shouldn't have to worry about prescaling the input data since the software FFT uses 32-bit temporary storage of the results of each FFT stage.
>> 8 will discard the lowest 8 bits of the value which is identical to dividing by 256. If you use just the software version it should be safe to use this line of code instead: InputData[point_counter] = InData[point_counter];
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page