Motorola DSP Developer's Kit | ![]() ![]() |
Data Snapshots
Snapshots provide access to DSP memory and/or DSP register data from within the MATLAB engine session. This allows debugging of the algorithm within the MEX function when running in the INTERACTIVE mode. Access means you are able to monitor and process a copy of any DSP memory data and DSP registers in the simulator without altering the contents.
Two types of snapshots are available: Instant and Continuous snapshots.
Instant Snapshot
The instant snapshot represents the data at the current point of simulator execution, i.e., at the time the snapshot command is issued. You must issue the instant snapshot command from the GUI simulator command window. Some examples include
snapshot reg r4 snapshot mem x:$0:$10
After the execution of these commands, observe the workspace of the MATLAB engine session that was created by the MEX function. There should be two structure variables, one is the snapshot of the DSP register R4, and the other is the snapshot of the DSP X memory block from $0000 to $0010. For accessing structure variables, refer to the "Programming with MATLAB" section in the MATLAB documentation. Each structure contains attribute information and the actual value as seen by the simulator.
Continuous Snapshot
Data from a continuous snapshot is updated after each DSP instruction is executed by the simulator. You must declare continuous snapshots in the MEX-file at compile time. The following source lines added to the MEX-file <matlab>toolbox/motdsp/motdsp/56300/mot563_mean.cpp
set up continuous snapshots.
#ifdef STANDALONE // Continuously monitor register 'X1'. ADD_SNAPSHOT_REG("Snapshot_X1", "X1"); // Continuously monitor DSP X memory block at location $0000 ADD_SNAPSHOT_MEM("Snapshot_MEM_X", memory_map_x, 0x00, (ulong)CUR_DIM_SIZE); #endif
#ifdef STANDALONE // Continuously monitor register 'X1'. sim->AddSnapShot("Snapshot_X1", "X1"); // Continuously monitor DSP X memory block at location $0000 sim->AddSnapShot("Snapshot_MEM_X", memory_map_x, 0x00, (ulong)CUR_DIM_SIZE); #endif
Continuous snapshots for the DSP register X1, and DSP X memory block from address $0 to address CUR_DIM_SIZE
(see the MEX-file for the definition of this block size macro) are created when you run MOT563_MEAN
. Step through the DSP assembly or C-code and observe the contents of the snapshot variables updating in the MATLAB engine session.
System Analysis Return Data (SARD)
This feature returns information about the execution of the DSP assembly program within the simulator to the MATLAB environment. Both the INTERACTIVE and NON_INTERACTIVE modes support this feature. The data contains:
(These P, X, and Y memory size values show only static information available at assembly time.)
The creation and return of SARD
data is optional. To enable this feature, set a MATLAB variable named <FUNCTION_NAME>_SARDflag
. When you run the corresponding MEX function, a MATLAB struct array with the name <FUNCTION_NAME>_SARD
appears in the workspace. Be aware that the variable <FUNCTION_NAME>
is case-sensitive.
The following example shows the use of SARD
with the MOT563_MAX
function.
» x = rand(10,1) » mot563_max_SARDflag = 1 » mot563_max(x) ans = 0.9318 » whos Name Size Bytes Class mot563_max_SARD 1x1 792 struct array mot563_max_SARDflag 1x1 8 double array ans 1x1 8 double array x 10x1 80 double array Grand total is 13 elements using 888 bytes » mot563_max_SARD mot563_max_SARD = Instruction Count: 31 ClockCycle Count: 49 Program Size: 14 XMem Size: 0 YMem Size: 0 Status Register: C00390
The SARD
is updated each time a function of the same name executes.
![]() | callMatlab | Reference | ![]() |