Prev: Projection Profile Segmentation in Simulink for DM6437 EVM
Next: SPECT Projection Reconstruction & Sinograms
From: khan Sim on 14 May 2010 05:33 Hi, i have made a model in simulink and want to generate the verilog code for the model. i have used an embedded matlab block named as Embedded MATLAB Function3 when i run the compatibilty checker i get no errors but when i run the generate code, i get the following errors .. Code generation failed Call to unsupported function (cos) detected. Function 'eml_scalar_cos' (#43.138.148), line 8, column 9 Function 'cos' (#42.298.318), line 10, column 12 Function 'eml_fft' (#39.4114.4124), line 122, column 28 Function 'eml_fft' (#39.1969.2000), line 52, column 5 Function 'eml_fft' (#39.1840.1869), line 47, column 10 Function 'fft' (#49.278.306), line 9, column 5 Function 'Embedded MATLAB Function3' (#19.46.65), line 3, column 14 i hope there is no imbiguity in code understanding , kindly help me out , how can i remove these errors??? and generate HDL succesfully??? urgent help required, kind regards
From: Sean Little on 14 May 2010 11:31 You have work to do. The problem you are experiencing happens because you are using functions in EML that are not supported for HDL code generation. Neither the COS or FFT functions can be converted directly to Verilog in the HDL Coder. Instead, you will need to break up your EML design and use the HDL FFT block from the HDLDEMOLIB library. You will also need to use an approximation for the COS function. The cordic algorithm might work for you. See the following doc link: http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/trigonometricfunction.html I do hope you are using fixed point, right? Sean Little
From: khan Sim on 15 May 2010 12:45 thank you very much Mr Sean for your time, well i am not using fixed point tool box, i have made a simulink model and used the embedded function block. Kindly guide me what is the role of fixed point tool box in the HDL code generation process??? and i can send you the code via your email, for your future guidance. cuz i see very little people having expertise in HDL and simulink. waiting for your reply thanx.
From: khan Sim on 15 May 2010 15:02 the the embedded function block has the following code, i hope you may guide me after looking at this code function smb = fcn(sb,sb0) %#eml fsb=fft(sb); fsb0=fft(sb0); % Power equalization% amp_max=1/sqrt(2); % Maximum amplitude for equalization afsb0=abs(fsb0); P_max=max(afsb0); for k = 1:length(fsb0) if afsb0(k) > amp_max*P_max fsb0(k) = (amp_max*(P_max^2)./afsb0(k)).*exp(1j*angle(fsb0(k))); end end fsmb=fsb.*conj(fsb0);% % Inverse Fourier Transform% smb=fftshift(ifft(fftshift(fsmb.'))).'; i am not using cos function anywhere in the code. waiting for reply regards khan
From: Sean Little on 17 May 2010 10:36 For HDL code to be synthesizable, you must use fixed point. The code you posted is using double precision data. The HDL Coder *might* produce Verilog from this EML (assuming you either write your own FFT, EXP, SQRT, IFFT, FFTSHIFT functions or find compatible implementations), but the result would not be useful in ANY practical sense. The reason is that you are developing hardware here, not software. An FPGA has no way to handle floating point data like a normal software program would. You must therefore use fixed point if you intend to synthesize this design. You must do the following: 1) Find/write an HDL compatible implementation for FFT, EXP, 1/SQRT, IFFT, FFTSHIFT. I have some approximation utilities that might be useful. I have been planning on posting those to the file exchange for a while, and I will try to do that this week. That would help with EXP and 1/SQRT. For your FFT implementation, I would point you to the "eml_hdl_design_patterns.mdl" demo that ships with the HDL Coder. Note that once you have an FFT, the IFFT is just an FFT with a conjugate scale factor. 2) Convert your code to use fixed point. This is a very interesting project, but both those steps will require significant time and effort. I recommend lots of careful unit testing. If you have access to the EDA simulator link, your task will be easier. If you have specific questions, please post here. Sean Little
|
Next
|
Last
Pages: 1 2 3 4 5 6 Prev: Projection Profile Segmentation in Simulink for DM6437 EVM Next: SPECT Projection Reconstruction & Sinograms |