3
\$\begingroup\$

I've got a question about coding an algorithm for a Texas Instruments TMS320C64xx DSP in MATLAB:

I've got a working sloppy implementation of my filter in MATLAB. My goal is to use MATLAB Embedded Coder to convert this algorithm to C which I can then import to Code Composer Studio and load onto the DSP.

To do this, I know there are certain things I need to do to my MATLAB code. For example, I need to pre-allocate space for matrices so it knows what size to make them (unless I want to fuss around with variable sized data). All that massaging of MATLAB code into C'ish code so that MATLAB coder can convert it I more or less understand. However, I have no idea how to make sure that my data types (for example the coefficients of my filter) are fixed point rather than floating point so that MATLAB Embedded Coder will convert my code to C which only involves fixed point data types.

So I guess my overall questions are:

  1. Is there a way to ensure that MATLAB Embedded Coder does not create float data types?

  2. Do I need to use the MATLAB Fixed Point Toolbox?

\$\endgroup\$
3
  • \$\begingroup\$ It might be simpler to compile a fixed-point Simulink model, but I don't have extensive experience with MATLAB's C translator. The one time I used it with Simulink (back when Coder was called Real-Time Workshop) and CCS, it 'just worked'. \$\endgroup\$
    – Eryk Sun
    Jun 13 '11 at 17:16
  • \$\begingroup\$ CCS being Code Composer Studio? So you just translated to C and then used the C source files as the source for your CCS project? If you don't mind my asking, what kind of interface did you have to your DSP for programming? I think I might be stuck using this XDS USB JTAG Emulator. \$\endgroup\$
    – NickHalden
    Jun 13 '11 at 19:33
  • \$\begingroup\$ You also asked "If the C64xx is specified as a 32-bit Fixed Point DSP, that means a compiler for it will throw an error if I try to use the float data type?" My quick answer is probably not, it will revert to slow-as-molasses software floating point (assuming the compiler has floating point enabled, based on my experience with other TI chips). If you want a more thorough answer, please ask that as a separate question. \$\endgroup\$ Jun 20 '11 at 21:08
1
\$\begingroup\$

Having a look at the matlab website I think you need the fixed point tool box http://www.mathworks.co.uk/products/fixed/description6.html this can then be translated into integer c code later on using simulink coder.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.