Main Content

writeMemoryOffset

Write data to memory regions on FPGA or SoC hardware by using the offset address

Since R2023b

    Description

    example

    writeMemoryOffset(hFPGA,interfaceID,addrOffset,data) writes all words in data to the FPGA, hFPGA, to the offset specified by addrOffset using the interface specified by interfaceID.

    Examples

    collapse all

    Write scalar data to FPGA-accessible memory regions by using the offset address and interface ID.

    Create an fpga object, hFPGA, for a 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));

    Write vector data to 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));

    Input Arguments

    collapse all

    Target FPGA object, specified as an fpga object.

    Name of FPGA interface, specified as a string or character vector.

    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

    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 R2023b