06-08-2018 12:04 AM - edited 06-08-2018 12:18 AM
I have a Microblaze system, running an FFT application.
The FFT is generated by MATLAB. It accepts a vector of length, say 1024 of type float and performs a 1024-point FFT.
Using timers, I measured number of clock cycles. The FFT requires more than 20,000,000 clock cycles on a MicroBlaze which is too long. fpadd & fpmul require 4+4=8 clock cycles. For 1024 data elements 10,000 cycles would make sense, but not 20,000,000!
If I reduce my vector length to say 8, it makes no difference!!! Even if I reduce numer of FFT points, does not make difference.
It is obvious that something goes wrong, but I cannot figure out the problem.
I'm using an Artix-7-200T FPGA with Vivado 2017.4 and MATLAB R2017b, running the Microblaze at 100 MHz. Microblaze settings are High Performance, 32 kB of D&I Cache, and floating point support is enabled.
06-08-2018 12:24 AM
It seems weird to me that the change in the vector size doesn't change the required time.
How do you view the measurements? JTAG? UART?
Is there any access going on to a UART or similar in your system?
06-08-2018 12:34 AM
I have a timer in the system. Before entering FFT, I initialize it and after exiting FFT, I stop the timer. Value of timer is read and sent to UART. I view number of cycles in the Console.
Yes, there is a UART and as I said, I print value of timer using it.
06-08-2018 12:55 AM
I dived into FFT code of MATLAB.
It seems that MATLAB has fixed 1024 point, so number of FFT points does not change performance.
Also length of input vector is fixed, so changing input length changes nothing!
This means that running FFT on Microblaze really takes that long.
Am I right? So using Microblaze for FFT is really impractical. Is this correct?
06-08-2018 06:20 AM
FFT is computationaly intense,
floating point is computationally intense
multiplication without a dsp is computationally intense.
Switch to fixed point,
add a dsp / multiplier to the micro blaze,
increase the cache size, and make certain matlab knows about that.
Is the code matlab is producing efficient / optimised for the Micorblaze,
If you want speed, use a FFT cored in the FPGA.
06-09-2018 09:53 PM
Actually my idea was not using any custom logic in the FPGA. However it seems that it is a must.
How can I tell MATLAB to optimize code for MicroBlaza?
How can I make certain that MATLAB is aware of cache (Probably for managing matrix sizes to fit into cache properly)?