From: Steven Lord on

"khan Sim" <akhun85(a)yahoo.com> wrote in message
news:hs0nq7$nes$1(a)fred.mathworks.com...
> sir,
> Walter Roberso !
>
> thank you very much for your reply, i ve posted many problems before
> aswell but i got no reply. Ur awakening was of great use to me.. :) thanx.
>
>
> actually, i want to embedd matlab code on fpga, for that i have to make a
> simulink model and then use HDL coder to convert that model to verilog. i
> am new to matlab, specially simulink. i ve got a code in matlab and want
> to model that code to simulink.

I'm not a Simulink expert, but I have the same concern Walter did -- I think
the fact that you don't know how long the output of FIND is going to be may
be fatal to any chances you have of generating code for an FPGA using your
code. Suppose that at one time step FIND generates a signal of length 1,
and at the next it generates a signal of length 1000. Could the FPGA handle
that situation? I'm guessing the answer to that is probably not. Depending
on what you're actually doing with that output, you might be able to find an
alternate approach that avoids that behavior.

I would use Embedded MATLAB to try to run your code -- it should tell you
what aspects of your code _it_ has concerns about and why.

http://www.mathworks.com/products/featured/embeddedmatlab/index.html?BB=1

http://www.mathworks.com/access/helpdesk/help/toolbox/eml/

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: khan Sim on
first of all lots of thanks to Walter Roberson and Steven Lord for your time and replies

i am working on the matlab embedded function, i am facing a problem in converting the code given below to matlab embedded code,

I=find(afsb0 > amp_max*P_max);
nI=length(I);
fsb0(I)=((amp_max*(P_max^2)*ones(1,nI))./afsb0(I)).* ...
exp(cj*angle(fsb0(I)));
The variable I is not defined/initialized before, afsb0 is a complex double matrix of order 1x512,
amp_max and P_max are two scalars.

How can make the above code compatible with matlab embedded code, have the same effect.

thanx
From: Steven Lord on

"khan Sim" <akhun85(a)yahoo.com> wrote in message
news:hs8fp9$clr$1(a)fred.mathworks.com...
> first of all lots of thanks to Walter Roberson and Steven Lord for your
> time and replies
>
> i am working on the matlab embedded function, i am facing a problem in
> converting the code given below to matlab embedded code,
> I=find(afsb0 > amp_max*P_max);
> nI=length(I);
> fsb0(I)=((amp_max*(P_max^2)*ones(1,nI))./afsb0(I)).* ...
> exp(cj*angle(fsb0(I)));
> The variable I is not defined/initialized before, afsb0 is a complex
> double matrix of order 1x512, amp_max and P_max are two scalars.
> How can make the above code compatible with matlab embedded code, have the
> same effect.

If you expect the length of fsb0 to change based on the last element of
afsb0 that is greater than your threshold, I'm pretty sure you cannot.

Why don't you try putting that code in the Embedded MATLAB block and seeing
what it says when you try to compile it? If it can't compile that code, it
should tell you why it can't and perhaps even offer suggestions as to how to
modify the code so it can.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: khan Sim on
i have made a simulink model and simulated it and it was giving the same results as from matlab code.

thank you very much for your help and support,

Now i want to convert this model to verilog, What steps should i follow?

regards