Contenido principal

programFPGA

R2026b

Program FPGA device through JTAG connection

Since R2026b

Description

programFPGA(jtagObj,programFile) programs the FPGA device connected to the selected JTAG cable using the specified bitstream file.

example

programFPGA(jtagObj,programFile,JTAGChainPosition=chainPosition) programs the FPGA device at the position specified by the chainPosition argument. Specify the chainPosition argument when multiple FPGA devices of the same vendor are present in the JTAG scan chain.

Examples

collapse all

Program the FPGA device connected to the selected JTAG cable by using a bitstream file. This example creates a jtagchain object, views the detected devices in the JTAG chain, and programs a selected FPGA device.

Set your system environment for accessing AMD® tools from MATLAB® by using the hdlsetuptoolpath function.

hdlsetuptoolpath('ToolName','Xilinx Vivado',...
                 'ToolPath','C:\Vivado\2025.1\Win\bin\vivado')

Create a jtagchain object for AMD devices. When you create the object, the constructor automatically scans the JTAG chain and populates the Devices property with information about the detected devices.

jtagObj = jtagchain("AMD");
### Checking Vivado tool

jtagObj =

  JTAGChain with properties:

          Vendor: "AMD"
       CableType: "auto"
       CableName: "auto"
    TckFrequency: 15
         Devices: [2×3 table]

The Devices property contains the devices detected in the JTAG chain.

jtagObj.Devices
ans =

  2×3 table

    ChainPosition       Manufacturer           Part   
    _____________    ___________________    __________

          1          "ARM Ltd."             ""        
          2          "Xilinx (AMD FPGA)"    "XC7Z045I"

After identifying the devices in the JTAG chain, program the FPGA using the programming file /dir/mybitstream.bit at JTAG chain position 2.

programFPGA(jtagObj,"/dir/mybitstream.bit",JTAGChainPosition=2);

Input Arguments

collapse all

Instance of JTAG chain object, specified as a jtagchain object.

Name of the programming file to load to the FPGA, specified as a character vector or string scalar.

You can either navigate to the folder that contains the programming file and specify only the file name, or specify the full file path directly without changing directories.

Example: "arty.runs\impl_1\design_1.bit" — For an AMD non-Versal® device

Example: "versal.runs\impl_1\design_1.pdi" — For an AMD Versal device

Example: "fpgaproj\design_1.sof" — For an Intel® device

Data Types: char | string

JTAG chain position, specified as a positive integer.

  • When you set Vendor to "AMD" or "Altera":

    • If a single FPGA device is present in the JTAG scan chain, specifying chainPosition is optional. If you do not specify chainPosition in this case, the function uses the FPGA device position detected by the jtagchain object. For example, if the FPGA is at position 2 in the JTAG chain, the function uses a value of 2.

    • If multiple FPGA devices are present in the JTAG scan chain, you must specify chainPosition. If you do not specify chainPosition in this case, the function returns an error.

  • When you set Vendor to "Microchip", the function ignores chainPosition.

Example: JTAGChainPosition=2

Data Types: uint8 | uint16 | uint32 | uint64

Version History

Introduced in R2026b

See Also

|