writeMemory
Description
writeMemory(
writes all words specified in hFPGA
,addr
,data
)data
to the
FPGA, hFPGA
, starting from the address specified in
addr
and incrementing the address for each word. The address must be in
the range of one of the AXI4 Slave or Memory interfaces added to the
hFPGA
object. The write operation writes to the
appropriate interface based on the address provided.
Examples
Write Scalar Data to Memory
Write scalar data to FPGA-accessible memory.
Create a fpga
object, hFPGA
, for a Xilinx® target.
hFPGA = fpga("Xilinx")
hFPGA = fpga with properties: Vendor: "Xilinx" Interfaces: [0x0 fpgaio.interface.InterfaceBase]
Add the memory interface to the hFPGA
object by using the
addMemoryInterface
function. Specify the memory interface name,
base address, and address range. Save the memory interface object to
hInterface.
hInterface = addMemoryInterface(hFPGA, InterfaceID = "myInterface",... BaseAddress = 0x80000000,AddressRange = 0x20000000)
hInterface = Memory with properties: InterfaceID: "myInterface" BaseAddress: "0x80000000" AddressRange: "0x20000000" WriteDriver: [1×1 matlabshared.libiio.sharedmem.write] ReadDriver: [1×1 matlabshared.libiio.sharedmem.read] InputPorts: [0×0 string] OutputPorts: [0×0 string]
Write data to a memory location.
writeMemory(hFPGA,0x80000000,uint32(5));
Write Vector Data to Memory
Write vector data to FPGA-accessible memory.
Create a fpga
object, hFPGA
, for a Xilinx target.
hFPGA = fpga("Xilinx")
hFPGA = fpga with properties: Vendor: "Xilinx" Interfaces: [0x0 fpgaio.interface.InterfaceBase]
Add the memory interface to the hFPGA
object by using the
addMemoryInterface
function. Specify the memory interface name,
base address, and address range. Save the memory interface object to
hInterface.
hInterface = addMemoryInterface(hFPGA, InterfaceID = "myInterface",... BaseAddress = 0x80000000,AddressRange = 0x20000000)
hInterface = Memory with properties: InterfaceID: "myInterface" BaseAddress: "0x80000000" AddressRange: "0x20000000" WriteDriver: [1×1 matlabshared.libiio.sharedmem.write] ReadDriver: [1×1 matlabshared.libiio.sharedmem.read] InputPorts: [0×0 string] OutputPorts: [0×0 string]
Write data to a memory location.
writeMemory(hFPGA,0x80000000,uint32(1:5));
Input Arguments
hFPGA
— Target FPGA object
fpga object
Target FPGA object, specified as an fpga
object.
addr
— Starting address for write operation
nonnegative integer | nonnegative hexadecimal value
Starting address for the write operation, specified as a nonnegative integer that is
a multiple of 4 or hexadecimal value that is a multiple of 4. The function casts the
address to the uint32
or uint64
data type,
depending on the memory interface address width. The address must be in the range of one
of the AXI4 Slave or Memory interfaced added to the hFPGA
object.
Example: 0x80000000
specifies a starting address of
0x80000000
.
Data Types: uint32
| uint64
data
— Data words to write
scalar | vector
Data words to write, specified as a uint32
scalar or vector. By
default, the function writes the data to a contiguous address block and increments the
address for each operation.
When you specify a large operation size, such as when you write a block of DDR memory, the function automatically breaks the operation into multiple bursts, using the maximum supported burst size of 256 words.
Example: [1:100]
specifies 100 contiguous memory
locations.
Data Types: uint32
Version History
Introduced in R2023a
See Also
Objects
Functions
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)