Get Pins on an IP - 2024.1 English

Vitis Tutorials: Embedded Software (XD260)

Document ID
XD260
Release Date
2024-06-19
Version
2024.1 English

Users can use the get_pins API to get the pins in an XSA file. These can be pins at a high level

Vitis [0]: pins = HwDesign.get_pins(hierarchical='true')
Vitis [0]: print(pins)
s_axi_aclk s_axi_aresetn s_axi_awaddr s_axi_awvalid s_axi_awready s_axi_wdata s_axi_wstrb s_axi_wvalid s_axi_wready s_axi_bresp s_axi_bvalid s_axi_bready s_axi_araddr s_axi_arvalid s_axi_arready s_axi_rdata s_axi_rresp s_axi_rvalid s_axi_rready gpio_io_o ACLK ARESETN ...

Similar to the cells object previously, users can return the pin properties

Vitis [0]: pins[0].report_property()
Property      Type    Read-only  Value
CLASS         string  true       port
CLK_FREQ      string  true       99990005
DIRECTION     string  true       I
INTERFACE     bool    true       0
IRQID         string  true       
IS_CONNECTED  bool    true       1
LEFT          string  true       
NAME          string  true       s_axi_aclk
POLARITY      enum    true       
RIGHT         string  true       
SENSITIVITY   enum    true       
TYPE          enum    true       clk

Users can use this to make a better filter. For example, if users wantred to return all clk pins

Vitis [0]: clk_pins = HwDesign.get_pins(hierarchical='true',filter='TYPE==clk')
Vitis [0]: print(clk_pins)
s_axi_aclk ACLK S00_ACLK M00_ACLK slowest_sync_clk maxihpm0_fpd_aclk pl_clk0

Users can return the pins on a specfic object such as the axi_gpio cell used above

Vitis [0]: print(cells[0])
axi_gpio_0
Vitis [0]: axi_gpio_pins = HwDesign.get_pins(of_object=cells[0],filter='TYPE==clk')
Vitis [0]: print(axi_gpio_pins)
s_axi_aclk

Filtering on the TYPE pin property is also useful to find all interrupt pins

Vitis [0]: axi_gpio_pins = HwDesign.get_pins(of_object=cells[0],filter='TYPE==INTERRUPT')

Users can filter on the pin DIRECTION && TYPE

Vitis [0]: axi_gpio_in_clks = HwDesign.get_pins(of_object=cells[0],filter='DIRECTION==I&&TYPE==clk')
Vitis [0]: print(axi_gpio_in_clks)
s_axi_aclk