Motorola DSP Developer's Kit |
 |
Creating Motorola DSP MEX-Files
Overview of DSP MEX-File Development
Creation Steps
The steps for creating MEX-files for MATLAB and Simulink are the same:
- Create objects for all possible inputs and outputs to your function
- Instantiate an object representing the DSP simulator by using the macro
INSTANCE_SIMS(...)
or the C++ style sim = new MOTDSP_...(...)
- Import input data from the MATLAB/Simulink environment and write to DSP registers and/or memory within the simulator
- Run the DSP simulator by using the macro
SIM_RUN
or sim->Run()
- Write DSP data from the simulation to the function outputs and export to the MATLAB/Simulink environment
- Terminate the DSP simulator by using the macro
SIM_TERMINATE
or sim->Terminate()
The majority of the code added to the supplied templates (see MEX-File Template Source) to perform these functions is identical. There are differences between the two simulation environments which are covered in the rest of this chapter.
Note
All data must be of normalized double-precision floating-point type (i.e., the data must lie between -1.0 and 1.0) before passing it to the DSP simulator via the input arguments of a MEX-file. Conversion to and from fixed-point is performed for you, to allow the Motorola simulator to manipulate your data. Be aware that this conversion may effect the accuracy of your output.
|
| Using the Motorola DSP Developer's Kit | | What the DSP Developer's Kit Provides |  |