Motorola DSP Developer's Kit | ![]() ![]() |
Importing Data to DSP Simulator
Pass data into and out of the DSP simulator using appropriate methods of the simulator classes or the alternative macros provided.
Writing to DSP Registers
WRITE_REG( const char *regname, double regval ) WRITE_REG( const char *regname, ulong regval )
WriteToDspReg( const char *regname, double regval ) WriteToDspReg( const char *regname, ulong regval )
If the argument is of type unsigned long
, data is written as an integer. If the argument is of type double
, data is written using fractional representation. An error will be asserted if the register name is not valid.
The behavior of the system is undefined if a fractional value is stored in a register intended to hold only integer values, for example, the Program Counter (PC).
// write an integer value into the Program Counter WRITE_REG( "PC", (ulong)200 ); // store the value in Register R1 as a fraction WRITE_REG("R1", 0.125 );
Writing to DSP Memory
WRITE_MEM_SYM( const char *label, double*/ulong* data, int blocksize) WRITE_MEM_MAP( const char *regname, double*/ulong* data, int blocksize)
WriteToDspMem( const char *label, double *mydata, int size ) WriteToDspMem( const char *label, ulong *mydata, int size ) WriteToDspMem(enum mem_map, ulong addr, double *mydata, int size) WriteToDspMem(enum mem_map, ulong addr, ulong *mydata, int size)
The memory address for a write is specified using a symbolic label from the associated assembly or C-code file or by specifying the memory map (X-,Y- or P-memory) and address offset. The latter is used when the write memory locations vary with the size of the MEX-file's input arguments (i.e., dynamically allocated in the DSP memory).
Data is written to the DSP memory in either an integer or fractional format, depending on the type of the array passed to the method.
// Write input arg 'a' to address 'IN1' WRITE_MEM_SYM( "IN1", a->GetData(), a->GetSize() ); // Write input arg 'a' to P Memory WRITE_MEM_MAP( P_MEM, 0xF000, a->GetData(), a->GetSize());
![]() | Running the Simulation | Exporting Data to MATLAB | ![]() |