HDL simulinks coder about
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear friends, I have a problem MATLAB Function. How do I generate HDL Code for my MATLAB Function in Simulink HDL Coder (R2011b) My Matlab Functions :
1. y = mod(u,2*pi);
2. y = u(1)*sin(pi*u(3)/3-u(2));
How can i solve this Problems! Please help me!
Best regards!
댓글 수: 0
채택된 답변
Tim McBrayer
2012년 4월 18일
Neither the mod function call nor the sin function call are supported for HDL Code Generation inside the MATLAB Function block. Mod to a power of 2 can be done in hardware by choosing only the desired bits of the operand; a mod of 2*pi may be more difficult. You will need to carefully consider your data types and representation to achieve the desired functionality.
As for the sin function; it can be done in a MATLAB Function block, but not by calling the sin function. One of the product examples is entitled "CORDIC Algorithm Using the MATLAB® Function Block"; I suggest you investigate this to see what is involved. Perhaps a simpler alternative is to use the Trigonometric Function block, which can directly implement a CORDIC trig approximation in Simulink and in HDL Coder.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 HDL Coder에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!