writememory
Write data to AXI4 memory-mapped locations
Description
writememory(
writes all words specified in mem,addr,data)data, starting from the address specified
in addr, and then incrementing the address for each word.
addr, must refer to an AXI slave memory location controlled by the
AXI manager IP on your hardware board. The socAXIManager
object, mem, manages the connection between MATLAB® and the AXI manager IP.
writememory(
writes all words specified in mem,addr,data,Name,Value)data, starting from the address specified
in addr, with additional options specified by one or more
Name,Value pair arguments.
Examples
For this example, you must have a design running on a hardware board connected to the MATLAB host machine.
Create a MATLAB AXI manager object. The object connects with the hardware board and confirms
that the IP is present. You can create the object with a vendor name or an
socHardwareBoard object.
mem = socAXIManager('Xilinx');
Write and read one or more addresses with one command. By default, the functions auto-increment the address for each word of data. For instance, write ten addresses, then read the data back from a single location.
writememory(mem,140,[10:19]) rd_d = readmemory(mem,140,1)
rd_d = uint32 10
Now, read the written data from ten locations.
rd_d = readmemory(mem,140,10)
rd_d = 1×10 uint32 row vector 10 11 12 13 14 15 16 17 18 19
Set the BurstType property to 'Fixed' to turn
off the auto-increment and access the same address multiple times. For instance, read the
written data ten times from the same address.
rd_d = readmemory(mem,140,10,'BurstType','Fixed')
rd_d = 1×10 uint32 row vector 10 10 10 10 10 10 10 10 10 10
Write incrementing data ten times to the same address. The final value stored in address
140 is 29.
writememory(mem,140,[20:29],'BurstType','Fixed') rd_d = readmemory(mem,140,10)
rd_d = 1×10 uint32 row vector 29 11 12 13 14 15 16 17 18 19
Alternatively, specify the address as a hexadecimal string. To cast the read data to a
data type other than uint32, use the OutputDataType
property.
writememory(mem,'1c',[0:4:64]) rd_d = readmemory(mem,'1c',16,'OutputDataType',numerictype(0,6,4))
rd_d =
Columns 1 through 10
0 0.2500 0.5000 0.7500 1.0000 1.2500 1.5000 1.7500 2.0000 2.2500
Columns 11 through 16
2.5000 2.7500 3.0000 3.2500 3.5000 3.7500
DataTypeMode: Fixed-point: binary point scaling
Signedness: Unsigned
WordLength: 6
FractionLength: 4When you are done accessing the board, release the JTAG connection.
release(mem)
Input Arguments
JTAG connection to AXI manager IP running on your hardware board, specified as an
socAXIManager
object.
Starting address for read operation, specified as an integer or a hexadecimal
character vector. The function casts the address to uint32 data type.
The address must refer to an AXI slave memory location controlled by the AXI manager IP
on your hardware board.
Example: 'a4'
Data words to write, specified as a scalar or a vector. By default, the function
writes the data to a contiguous address block, incrementing the address for each
operation. To turn off the address increment and write each data value to the same
location, set the BurstType property to
'Fixed'.
Before sending the write request to the board, the function casts the input data to
uint32 or int32 data type. The data type
conversion follows these rules:
If the input data type is
double, then the data is cast toint32data type.If the input data type is
single, then the data is cast touint32data type.If the bit width of the input data type is less than 32 bits, then the data is sign-extended to 32 bits.
If the bit width of the input data type is longer than 32 bits, then the data is cast to
int32oruint32data type, matching the signedness of the original data type.If the input data is a fixed-point data type, then the function writes the stored integer value of the data.
When you specify a large operation size, such as writing a block of DDR memory, the function automatically breaks the operation into multiple bursts, using the maximum supported burst size. The maximum supported burst size is 256 words.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
Example: writememory(mem,140,[20:29],'BurstType','Fixed')
AXI4 burst type, specified as the comma-separated pair consisting of
'BurstType' and either 'Increment' or
'Fixed'. If this value is 'Increment', the AXI
manager writes a vector of data from contiguous memory locations, starting with the
specified address. If this value is 'Fixed', the AXI manager
writers all data from the same address.
Version History
Introduced in R2019a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)