MATLAB Link for Code Composer Studio Development Tools    
regread

Return a value from a specified target processor register

Syntax

Description

reg = regread(cc,'regname','represent',timeout) reads the data value in the regname register of the target processor and returns the value in reg as a double-precision value. For convenience, regread converts each return value to the MATLAB double datatype independent of the datatype defined by represent. Making this conversion lets you manipulate the data in MATLAB. String regname specifies the name of the source register on the target. Link cc defines the target to read from. Valid entries for regname depend on your target processor. Register names are not case-sensitive -- a0 is the same as A0. For example, the TMS320C6xxx processor family provides the following register names that are valid entries for regname:

Register Names
Register Contents
A0, A1, A2,..., A15
General purpose A registers
B0, B1, B2,..., B15
General purpose B registers
PC, ISTP, IFR, IRP, NRP, AMR, CSR
Other general purpose 32-bit registers
A1:A0, A2:A1,..., B15:B14
64-bit general purpose register pairs

Other processors provide other register sets. Refer to the documentation for your target processor to determine the registers for the processor.

The represent input argument defines the format of the data stored in regname. Input argument represent takes one of three input strings:

represent string
Description
2scomp
Source register contains a signed integer value in two's complement format. This is the default setting when you omit the represent argument.
binary
Source register contains an unsigned binary integer.
ieee
Source register contains a floating point 32-bit or 64-bit value in IEEE floating-point format. Use this only when you are reading from 32 and 64 bit registers on the target.

To limit the time that regread spends transferring data from the target processor, the optional argument timeout tells the data transfer process to stop after timeout seconds. timeout is defined as the number of seconds allowed to complete the read operation. You might find this useful for limiting prolonged data transfer operations. If you omit the timeout option in the syntax, regread defaults to the global timeout defined in cc.

reg = regread(cc,'regname','represent') reads the data value in the regname register of the target processor and returns the value in reg as a double-precision value. String regname specifies the name of the source register on the target. Link cc defines the target to read from. For convenience, regread converts each return value to the MATLAB double datatype independent of the datatype defined by represent. Making this conversion lets you manipulate the data in MATLAB. The represent input argument defines the format of the data stored in regname.

reg = regread(cc,'regname') reads the data value in the regname register of the target processor and returns the value in reg. String regname specifies the name of the source register on the target. Link cc defines the target to read from. For convenience, regread converts each return value to the MATLAB double datatype independent of the datatype of the source. Making this conversion lets you manipulate the data in MATLAB.

Examples

For the C5xxx processor family, most registers are memory-mapped and consequently are available using read and write. However, the PC register is not memory-mapped. The following command demonstrates how to read the PC register. To identify the target, cc is a link for CCS IDE.

To tell MATLAB what datatype you are reading, the string binary indicates that the PC register contains a value stored as an unsigned binary integer.

In response, MATLAB displays

For processors in the C6xxx family, regread lets you access processor registers directly. To read the value in general purpose register A0, type the following function.

treg now contains the two's complement representation of the value in A0.

Now read the value stored in register B2 as an unsigned binary integer, by typing

See Also
read, regwrite, write


  readnumeric regwrite