From: khan Sim on
"Sean Little" <sanborne(a)fastmail.fm> wrote in message <hte53t$vn$1(a)fred.mathworks.com>...
> "khan Sim" <akhun85(a)yahoo.com> wrote in message <htd81s$b85$1(a)fred.mathworks.com>...
> > well , moving one step ahead... from previous steps.
> >
> > FFT has been successful as i found hdl coder block, but how about IFFT(Inverse fourier transform). as far as i have searched, i dont find any HDL compatible block in simulink.
> >
> > How can i perform ifft compatible with hdl???
> >
> > thanx
> > regards
> > khan
>
> There is no IFFT block in the HDL coder.
>
> You can compute the IFFT using the FFT block. To compute the IFFT, simply take the conjugate of the complex values before you pass them to the FFT block. Then take the conjugate of the outputs again, followed by a gain block with the value 1/N where N is the size of the FFT.


i have posted the problem i am facing, i think it will be easy for you to understand the problem, if you look at the actual model, so i have sent the model to you to your email address sanborne(a)fastmail.fm, i hope you will check it and advise me accordingly.

thanx
From: Sean Little on
"khan Sim" <akhun85(a)yahoo.com> wrote in message <htigau$81t$1(a)fred.mathworks.com>...
> "Sean Little" <sanborne(a)fastmail.fm> wrote in message <hte53t$vn$1(a)fred.mathworks.com>...
> > "khan Sim" <akhun85(a)yahoo.com> wrote in message <htd81s$b85$1(a)fred.mathworks.com>...
> > > well , moving one step ahead... from previous steps.
> > >
> > > FFT has been successful as i found hdl coder block, but how about IFFT(Inverse fourier transform). as far as i have searched, i dont find any HDL compatible block in simulink.
> > >
> > > How can i perform ifft compatible with hdl???
> > >
> > > thanx
> > > regards
> > > khan
> >
> > There is no IFFT block in the HDL coder.
> >
> > You can compute the IFFT using the FFT block. To compute the IFFT, simply take the conjugate of the complex values before you pass them to the FFT block. Then take the conjugate of the outputs again, followed by a gain block with the value 1/N where N is the size of the FFT.
>
>
> i have posted the problem i am facing, i think it will be easy for you to understand the problem, if you look at the actual model, so i have sent the model to you to your email address sanborne(a)fastmail.fm, i hope you will check it and advise me accordingly.
>
> thanx

It seems that you are having problems with the timing modes for the HDL Streaming FFT blocks. I do not have time to debug this for you. I would suggest that you start with a much simpler model and gradually add complexity as you get small things working.

I did notice that you are using a MATLAB function block to perform the conjugate operation. This is not compatible with the HDL Coder. It would be better if you used the "Math Function" block, and selected the conjugate operation.

I am still waiting to get my suite of approximation tools approved for publication. Because I work for the MathWorks, there are some steps that must be taken before any submission can find its way to the File Exchange.

Sean
From: Sean Little on
"Sean Little" <sanborne(a)fastmail.fm> wrote in message <htluho$rgd$1(a)fred.mathworks.com>...
> "khan Sim" <akhun85(a)yahoo.com> wrote in message <htigau$81t$1(a)fred.mathworks.com>...
> > "Sean Little" <sanborne(a)fastmail.fm> wrote in message <hte53t$vn$1(a)fred.mathworks.com>...
> > > "khan Sim" <akhun85(a)yahoo.com> wrote in message <htd81s$b85$1(a)fred.mathworks.com>...
> > > > well , moving one step ahead... from previous steps.
> > > >
> > > > FFT has been successful as i found hdl coder block, but how about IFFT(Inverse fourier transform). as far as i have searched, i dont find any HDL compatible block in simulink.
> > > >
> > > > How can i perform ifft compatible with hdl???
> > > >
> > > > thanx
> > > > regards
> > > > khan
> > >
> > > There is no IFFT block in the HDL coder.
> > >
> > > You can compute the IFFT using the FFT block. To compute the IFFT, simply take the conjugate of the complex values before you pass them to the FFT block. Then take the conjugate of the outputs again, followed by a gain block with the value 1/N where N is the size of the FFT.
> >
> >
> > i have posted the problem i am facing, i think it will be easy for you to understand the problem, if you look at the actual model, so i have sent the model to you to your email address sanborne(a)fastmail.fm, i hope you will check it and advise me accordingly.
> >
> > thanx
>
> It seems that you are having problems with the timing modes for the HDL Streaming FFT blocks. I do not have time to debug this for you. I would suggest that you start with a much simpler model and gradually add complexity as you get small things working.
>
> I did notice that you are using a MATLAB function block to perform the conjugate operation. This is not compatible with the HDL Coder. It would be better if you used the "Math Function" block, and selected the conjugate operation.
>
> I am still waiting to get my suite of approximation tools approved for publication. Because I work for the MathWorks, there are some steps that must be taken before any submission can find its way to the File Exchange.
>
> Sean

I was finally able to get the promised approximation utilities published on the File Exchange. It is pretty rough, and still a work in progress. But I have found it useful. Take it for what it is worth.

http://www.mathworks.com/matlabcentral/fileexchange/27738-spline-based-function-approximation-for-hdl-synthesis
From: khan Sim on
well, i have been able to do the ifft as well and it was working, there was problem with the timing between the two hdl fft blocks. Now its solved, thanks.
more over your files in the files exchange are really helpful to me, i hope to use them in the future as i go on.
i have a question,

after the input signal is passed through HDL Minimum resource FFT block, the output data is again in serial form, that is the data is coming out of fft block sample by sample.

the sample time is 1/N where N is the FFT length.

Now i want to apply the following function on the sampled output.

1. taking absolute of the fftout from hdl coder
2. find maximum value of the output samples after taking absolute, for a sample time of 1.

i have the following querries.

1. the "abs" function block requires the input to be of type "double" if the input is complex. Now i am working with fixed point numbers for HDL code generation, what should i do to take absolute of the fixed point value which is a complex fixed point number.???

2. how can i take the maximum of the input values of length N???. i am getting each value at a sample time of 1/N. should i use a counter, ? or convert the data from serial to parallel? how can i convert data from serial to parallel?? if i use "buffer", it is not synthesized by the HDL coder and error is given. what should be my approach to execute the max of input samples for time interval of 1. that is from the start of one sample to the end of last sample of the fft.

waiting for your reply

thank you very much.
From: khan Sim on
hi,
Kindly try to read the whole problem, i apologize for typing much. :)
i am facing a problem , i am trying for the last 2 weeks but the problem is still there. urgent help is required.Kindly understand the problem and reply . the problem is given below.

Input 'A' can have any value. For simplicity i have given signal as A=[1,2,3,4].

1. A signal 'A=[1,2,3,4]' is coming into a simulink model . The signal is sample based with sample time of 1/4. it means the 4 samples of 'A' comes in 1 second. i have made an HDL compatible simulink block which finds the max of signal 'A' i.e Amax =max(A). The max is calculated as the last input of signal 'A' enters into the block (here the last input is '4') .

2. it means the first max is caculated and given as output at time t= 3*1/4 the second max is caluclated at time t=1+(3*1/4 ) The third max is calculated at t=2+(3*1/4) and so on.

3. In the next step the max is divided by 2, that is Amax2= Amax/2. Amax2 is a scalar number.

4. Now Amax2 is compared with EACH sample of 'A'.
if Amax2>A
ouput=Amax2
else
output=A

5. It may be noted that Amax2 is generated at t=n+(3*1/4) where n=0,1,2,3,4.....

(AFTER THIS YOUR GUIDANCE IS REQUIRED, KINDLY RECTIFY ME IF I AM WRONG )

6. i have used Delays to shift the signal 'A' with delays 0,1,2,3 in parallel, that is 4 wires are connected to A and wire0 is delayed with 0, wire1 with 1, wire2 with 2 and wire3 with delay of 3.
now the signals of wire0,wire1,wire2,wire3 are compared separately with 'Amax2' and the output is given. in this way i have compared every sample of A with 'Amax2'.

7. Now i have four outputs as a result of wire0, wire1, wire2, wire3. the outputs are output0, output1, output2, output3. EXCEPT THE the sample at t=n+(3*1/4), rest every sample is equal to the corresponding original samples of 'A'.

The problem is

8. How can i extract the samples at t=n+(3*1/4) from the output1, output2, output3 and output4???

"it may be noted that i am making this model for HDL code genration."

kind regards
Khan