readMemoryOffset
Read data from memory regions on FPGA or SoC hardware by using offset address
Since R2023b
Description
reads locations of data, data
= readMemoryOffset(hFPGA
,interfaceID
,addrOffset
,dataLen
)dataLen
from the FPGA,
hFPGA
, starting from the offset address specified in
addrOffset
and using the interface specified by
interfaceID
.
Examples
Read Scalar Data from Memory by Using Offset Addresses
Read scalar data from FPGA-accessible memory regions by using the offset address and interface ID.
Create an fpga
object, hFPGA
, for an Intel® target.
hFPGA = fpga("Intel")
hFPGA = fpga with properties: Vendor: "Intel" Interfaces: [0×0 fpgaio.interface.InterfaceBase]
Add the AXI4 slave interface to the
hFPGA
object by using the addAXI4SlaveInterface
function.
addAXI4SlaveInterface(hFPGA,InterfaceID = "Registers",... BaseAddress = 0x400D0000,... AddressRange = 0x10000);
Write data to a memory location.
writeMemoryOffset(hFPGA,"Registers",0x100,uint32(5));
Read data from a single location.
data = readMemoryOffset(hFPGA,"Registers",0x100,1)
data = uint32 5
Read Vector Data from Memory by Using Offset Addresses
Read vector data from FPGA-accessible memory regions by using the offset address and interface ID.
Create an fpga
object, hFPGA
, for an Intel target.
hFPGA = fpga("Intel")
hFPGA = fpga with properties: Vendor: "Intel" Interfaces: [0×0 fpgaio.interface.InterfaceBase]
Add the AXI4 slave interface to the
hFPGA
object by using the addAXI4SlaveInterface
function.
addAXI4SlaveInterface(hFPGA,InterfaceID = "Registers",... BaseAddress = 0x400D0000,... AddressRange = 0x10000);
Write data to a memory location.
writeMemoryOffset(hFPGA,"Registers",0x100,uint32(1:5));
Read data from a single location.
data = readMemoryOffset(hFPGA,"Registers",0x100,5)
data = uint32 1 2 3 4 5
Input Arguments
hFPGA
— Target FPGA object
fpga object
Target FPGA object, specified as an fpga
object.
interfaceID
— Name of FPGA interface
""
| string
| character vector
Name of FPGA interface, specified as a string or character vector.
addrOffset
— Memory offset address
nonnegative integer | nonnegative hexadecimal value
Memory offset address 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 offset must be in the range of the interface
addresses added to the hFPGA
object.
Example: 0x100
specifies an offset address of
0x100
.
Data Types: uint32
| uint64
dataLen
— Length of data to read
nonnegative integer
Length of data to read, starting at the location specified by
addrOffset
, specified as a nonnegative integer. By default, the
function reads data from a contiguous address block, and increments the address for each
operation.
When you specify a large operation size, such as when you read a block of DDR memory, the function automatically breaks the operation into multiple bursts, using the maximum supported burst size of 256 words.
Example: 5
specifies five contiguous memory
locations.
Output Arguments
data
— Read data
scalar | vector
Read data, returned as a scalar or vector, depending on the value you specify for
dataLen
.
Version History
Introduced in R2023b
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)