SourcePoint AMD Help

Table of Contents

Memory Access

Display and modify memory.

Syntax

To display memory:

ย ย ย [[px]] data-type addr-spec [display-base]

To modify memory:

ย ย ย [[px]] data-type addr-spec = {expr[,...] | data-type addr-spec | debug-var-array}

To fill memory:

ย ย ย [[px]] data-type destination-range = expr

To copy memory:

ย ย ย [[px]] data-type destination-range = data-type source-range

Where:

[px]

is the viewpoint override, including punctuation ( [ ] ), specifying that the viewpoint is temporarily set to processor x of the boundary scan chain. ย The processor can be specified as px (where x is the processor ID), or an alias you have defined for a given processor ID. ย ALL cannot be used as a viewpoint override.

data-type

specifies the data type used to access memory (e.g., ord1, ord2, ord4, etc.). For more information, see Data Types.

expr

specifies a number or an expression. You can enter more than one expression by using a comma as a separator.

addr-spec

{addr | addr-range}

addr

specifies an address. For more information, see Memory Access: Addresses, found later in this topic.

addr-range

is an address range. ย There are two ways to specify a range: addr1 to addr2 or addr length expr.

destination-range

is a range of memory to write.

source-range

is a range or memory to read.

addr1 to addr2

specifies a range of memory beginning with address addr1 and including address addr2. Addr2 must be greater than addr1.

addr length expr

specifies a range of memory beginning with address addr1. ย The range includes a number of items (specified by expr).

expr

specifies a number or an expression. You can enter more than one expression by using a comma as a separator.

debug-var-array

is an array of debug variables to write to memory (e.g., ord4 data[10]).

display-base

specifies a temporary override of the current display base (bin | oct | dec | hex).

Discussion

For memory read commands, the requested data is displayed in the current base (specified by the base control variable), unless an override is specified. Addresses are always displayed in hexadecimal. If the data-type is ord1 (or byte), the ASCII representation of the data is shown on the right-hand side of the screen with non-printing characters displayed as a period.

Memory is read using the viewpoint processor unless a processor override is specified.

For a memory copy command, the source and destination ranges may not overlap, and the destination range must be equal to or greater than the source range. If the destination range is larger, the source data are repeated to fill the destination range of memory.

The data-type size is the resolution used for copy or fill. Only complete data items are written to the destination, and the source and destination data-types must match.

You can also use memory access commands in an expression. For example, define ord4 var1 = byte 100hp takes the value at location 100hp, translates it to an ord4, and puts in a debug variable name var1.

When a memory access operation is part of an expression, ranges of addresses are not allowed.

Note: If verify=true, the emulator reads back what is written.

Example 1

To display a byte of memory:

Command input:

int1 20000h

Result:

42H

Example 2

To write 32 bits of memory at address 100:

Command input:

ord4 100 = 12345678

ord4 100

Result:

12345678H

Example 3

To set a debug variable from 4 bytes of memory at addr 1000p:

Command input:

define ord4 myData = ord4 1000p

Example 4

To fill a range of memory with a single value and then display the range:

Command input:

ord1 100h length 20h = 30h
ord1 100h length 20h

Result:

00000100 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
00000110 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30

Example 5

To copy a range of memory:

Command input:

ord1 200h length 20h = 42
ord1 100h length 10h = ord1 200h length 10h
ord1 100h length 10h

Result:

00000100 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42

Example 6

To write a repeating sequence of values and display the new values:

Command input:

ord2 700h length 5t = 1,2,3
ord2 700h length 5t

Result:

00000700 0001 0002 0003 0001 0002

Example 7

To copy a value from one memory location to another and read the new value:

Command input:

ord1 200hp = ord1 100hp
ord1 200hp

Result:

42H "B"

Example 8

To copy the contents of a file to target memory at address 0:

Command input:

define ord4 file1

define ord4 nItemsRead

define ord1 buf[1000]

define ptr pMem = 0

ย 

file1 = fopen("test.dat", "r")

while (feof(file1) == 0)

{

ย ย ย nItemsRead = fread(buf, file1)

ย ย ย ord1 pMem length nItemsRead = buf

ย ย ย pMem += nItemsRead

}

fclose(file1)

Example 9

To copy the first 50 bytes of an array to target memory at address 0:

Command input:

define ord1 buf[1000]
define ptr pMem = 0
ord1 pMem length 50 = buf ย ย ย ย ย ย ย // copy first 50 bytes

Example 10

To copy target memory beginning at address 1000h into an nstring variable (note that memory is read until a terminating null character is found, or until 1000 characters have been read):

Command input:

define nstring filename = nstring 1000h
filename
ย 

Result:

"c:\doc\test.txt"

ย 

Memory Access: Addresses

This section describes addresses used for memory access commands.

Syntax

expr [ p ]

Where:

expr

specifies a number or an expression that will evaluate to a virtual address .

p

causes an address to be interpreted as a physical address.

Discussion

Use memory access commands to access memory in the target system. ย When the <addr> option appears in the syntax guide, enter an appropriate address, pointer debug variable, or an expression that evaluates to an address.

The emulator supports physical and virtual addressing. It assumes that numeric addresses are virtual unless overridden by a "p" (without quotation marks) suffix for physical address.

Virtual Address

A virtual address is the default emulator address type. The Memory Management Unit allows an address to be mapped to a different physical address. This is frequently used to manage physical memory allocation, as in the case where memory allocation of multiple processes with potentially conflicting address mappings is needed.

Physical Address

A physical address is the address used as an index into physical memory.

Related Topics: