mem --write - 2021.2 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 English
Important: This option cannot be used with embedded processor platforms.

The mem --write command writes a defined pattern to a specified set of memory locations.

It has the following command line format:

xbutil mem --write [-d card] [-a [0x]start_addr] 
[-i size_bytes] [-e pattern_byte]

The following table lists the available options.

Table 1. xbutil mem --write Command Options
Option Description Required
-d <card> Specifies the target card. <card> can be specified as either the card_id or Bus:Device:Function (BDF). Defaults to card_id = 0 if not specified.
Note: Use the xbutil scan command to display both the card_id and BDF for installed cards.
N
-a <start_addr> Specifies a valid starting address in either hex or decimal format. Hex format requires leading 0x that is, 0x100. Default address is 0x0.

Valid addresses can be obtained using the Linux dmesg command as outlined below.

N
-i <size_bytes> Specifies the memory transfer size in bytes in either hex or decimal format. Hex format requires leading 0x that is, 0x100. N
-e <pattern> Specifies the byte pattern written to all defined byte locations in either hex or decimal format. Hex format requires leading 0x that is, 0xEF. N

An example of the output using the following command with xclbin using DDR banks 0, 1, 2, and 3 shown below:

xbutil mem --write -a 0x0 -d2 -i 0x10 -e 0xef
INFO: Found total 1 card(s), 1 are usable
INFO: Writing to single bank, 16 bytes from DDR/HBM/PLRAM address 0x0
INFO: Writing DDR/HBM/PLRAM with 16 bytes of pattern: 0xef from address 0x0
INFO: xbutil mem succeeded.

The following error is returned if an invalid starting address is used. The starting address must be within the address space of the device. In this example 0x400 is an invalid starting address.

ERROR: Start address 0x400 is not valid
Available memory banks:
ERROR: xbutil mem failed.
Tip: Use grep to display the available address spaces. For instance, the following command displays the DDR memory base addresses:
dmesg | grep -A 10 -i ddr

The Linux dmesg output will give the base address for the various DDR memories. A sample of the output for DDR[1] is shown below:

[23174.283512] xocl 0000:a6:00.1: xocl_init_mem: Memory Bank: DDR[1]
[23174.283514] xocl 0000:a6:00.1: xocl_init_mem: Base Address:0x8000000000
[23174.283515] xocl 0000:a6:00.1: xocl_init_mem: Size:0x400000000

Replace the -i ddr search term above with the -i hbm to look up the base address for HBM memories.

To read memory addresses, see mem --read.