pynq.pl Module

The pynq.pl module facilitates management of the Programmable Logic. It provides the base class for dictionaries including IP, GPIO and Interrupts and methods for programming the PL which are used by other classes that inherit from the PL module.

class pynq.pl.PL[source]

Bases: object

Serves as a singleton for Overlay and Bitstream classes.

This class stores multiple dictionaries: IP dictionary, GPIO dictionary, interrupt controller dictionary, and interrupt pins dictionary.

bitfile_name

The absolute path of the bitstream currently on PL.

Type:str
timestamp

Bitstream download timestamp, using the following format: year, month, day, hour, minute, second, microsecond.

Type:str
ip_dict

All the addressable IPs from PS7. Key is the name of the IP; value is a dictionary mapping the physical address, address range, IP type, configuration dictionary, the state associated with that IP, any interrupts and GPIO pins attached to the IP and the full path to the IP in the block design: {str: {‘phys_addr’ : int, ‘addr_range’ : int, ‘type’ : str, ‘config’ : dict, ‘state’ : str, ‘interrupts’ : dict, ‘gpio’ : dict, ‘fullpath’ : str}}.

Type:dict
gpio_dict

All the GPIO pins controlled by PS7. Key is the name of the GPIO pin; value is a dictionary mapping user index (starting from 0), the state associated with that GPIO pin and the pins in block diagram attached to the GPIO: {str: {‘index’ : int, ‘state’ : str, ‘pins’ : [str]}}.

Type:dict
interrupt_controllers

All AXI interrupt controllers in the system attached to a PS7 interrupt line. Key is the name of the controller; value is a dictionary mapping parent interrupt controller and the line index of this interrupt: {str: {‘parent’: str, ‘index’ : int}}. The PS7 is the root of the hierarchy and is unnamed.

Type:dict
interrupt_pins

All pins in the design attached to an interrupt controller. Key is the name of the pin; value is a dictionary mapping the interrupt controller and the line index used: {str: {‘controller’ : str, ‘index’ : int}}.

Type:dict
hierarchy_dict

All of the hierarchies in the block design containing addressable IP. The keys are the hierarchies and the values are dictionaries containing the IP and sub-hierarchies contained in the hierarchy and and GPIO and interrupts attached to the hierarchy. The keys in dictionaries are relative to the hierarchy and the ip dict only contains immediately contained IP - not those in sub-hierarchies. {str: {‘ip’: dict, ‘hierarchies’: dict, ‘interrupts’: dict, ‘gpio’: dict, ‘fullpath’: str}}

Type:dict
class pynq.pl.PLMeta[source]

Bases: type

This method is the meta class for the PL.

This is not a class for users. Hence there is no attribute or method exposed to users.

We make no assumption of the overlay during boot, so most of the dictionaries are empty. Those dictionaries will get populated when users download an overlay onto the PL.

Note

If this metaclass is parsed on an unsupported architecture it will issue a warning and leave class variables undefined

bitfile_name

The getter for the attribute bitfile_name.

Returns:The absolute path of the bitstream currently on PL.
Return type:str
clear_devicetree()[source]

Clear the device tree dictionary.

This should be used when downloading the full bitstream, where all the dtbo are cleared from the system.

clear_dict()[source]

Clear all the dictionaries stored in PL.

This method will clear all the related dictionaries, including IP dictionary, GPIO dictionary, etc.

devicetree_dict

The getter for the attribute devicetree_dict

Returns:The dictionary containing the device tree blobs.
Return type:dict
dict_views

Getter attribute for the systemgraph First checks to see if the metadata file is where it is expected. If it is, parses it, and create a runtime_views object for it

gpio_dict

The getter for the attribute gpio_dict.

Returns:The dictionary storing the PS GPIO pins.
Return type:dict
hierarchy_dict

The getter for the attribute hierarchy_dict

Returns:The dictionary containing the hierarchies in the design
Return type:dict
insert_device_tree(abs_dtbo)[source]

Insert device tree segment.

For device tree segments associated with full / partial bitstreams, users can provide the relative or absolute paths of the dtbo files.

Parameters:abs_dtbo (str) – The absolute path to the device tree segment.
interrupt_controllers

The getter for the attribute interrupt_controllers.

Returns:The dictionary storing interrupt controller information.
Return type:dict
interrupt_pins

The getter for the attribute interrupt_pins.

Returns:The dictionary storing the interrupt endpoint information.
Return type:dict
ip_dict

The getter for the attribute ip_dict.

Returns:The dictionary storing addressable IP instances; can be empty.
Return type:dict
load_ip_data(ip_name, data, zero=False)[source]

This method writes data to the addressable IP.

Note

The data is assumed to be in binary format (.bin). The data name will be stored as a state information in the IP dictionary.

Parameters:
  • ip_name (str) – The name of the addressable IP.
  • data (str) – The absolute path of the data to be loaded.
  • zero (bool) – Zero out the address of the IP not covered by data
Returns:

Return type:

None

mem_dict

The getter for the attribute mem_dict

Returns:The dictionary containing the memories in the design.
Return type:dict
remove_device_tree(abs_dtbo)[source]

Remove device tree segment for the overlay.

Parameters:abs_dtbo (str) – The absolute path to the device tree segment.
reset(parser=None)[source]

Reset all the dictionaries.

This method must be called after a bitstream download. 1. In case there is a hwh file, this method will reset the states of the IP, GPIO, and interrupt dictionaries . 2. In case there is no hwh file, this method will simply clear the state information stored for all dictionaries.

An existing parser given as the input can significantly reduce the reset time, since the PL can reset based on the information provided by the parser.

Parameters:parser (HWH) – A parser object to speed up the reset process.
shutdown()[source]

Shutdown the AXI connections to the PL in preparation for reconfiguration

timestamp

The getter for the attribute timestamp.

Returns:Bitstream download timestamp.
Return type:str
update_partial_region(hier, parser)[source]

Merge the parser information from partial region.

Combine the currently PL information and the partial HWH file parsing results.

Parameters:
  • hier (str) – The name of the hierarchical block as the partial region.
  • parser (HWH) – A parser object for the partial region.