pynq.pl Module¶
The pynq.pl module facilitates management of the Programmable Logic (PL). The PL module manages the PL state through the PL class. The PL class is a singleton for the Overlay class and Bitstream classes that provide user-facing methods for bitstream and overlay manipulation. The TCL in the PL module parses overlay .tcl files to determine the overlay IP, GPIO pins, Interrupts indices, and address map. The Bitstream class within the PL module manages downloading of bitstreams into the PL.
-
class
pynq.pl.
Bitstream
(bitfile_name)[source]¶ Bases:
object
This class instantiates a programmable logic bitstream.
-
bitfile_name
¶ str – The absolute path of the bitstream.
-
timestamp
¶ str – Timestamp when loading the bitstream. Format: year, month, day, hour, minute, second, microsecond
-
-
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
¶ str – The absolute path of the bitstream currently on PL.
-
timestamp
¶ str – Bitstream download timestamp, using the following format: year, month, day, hour, minute, second, microsecond.
-
ip_dict
¶ 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}}.
-
gpio_dict
¶ 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]}}.
-
interrupt_controllers
¶ dict – 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.
-
interrupt_pins
¶ dict – 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}}.
-
hierarchy_dict
¶ dict – All of the hierarchies in the block design containing addressable IP. The keys are the hiearachies 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}}
-
-
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.
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 Note
If this method is called on an unsupported architecture it will warn and return an empty string
-
clear_dict
()[source]¶ Clear all the dictionaries stored in PL.
This method will clear all the related dictionaries, including IP dictionary, GPIO dictionary, etc.
-
client_request
(address='/home/docs/checkouts/readthedocs.org/user_builds/pynq/checkouts/v2.2.1/pynq/.log', key=b'xilinx')[source]¶ Client connects to the PL server and receives the attributes.
This method should not be used by the users directly. To check open pipes in the system, use lsof | grep <address> and kill -9 <pid> to manually delete them.
Parameters: - address (str) – The filename on the file system.
- key (bytes) – The authentication key of connection.
Returns: Return type: None
-
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
-
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)[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.
Returns: Return type: None
-
reset
()[source]¶ Reset both all the dictionaries.
This method must be called after a bitstream download. 1. In case there is a *.tcl file, this method will reset the IP, GPIO , and interrupt dictionaries based on the tcl file. 2. In case there is no *.tcl file, this method will simply clear the state information stored for all dictionaries.
-
server_update
(continued=1)[source]¶ Client sends the attributes to the server.
This method should not be used by the users directly. To check open pipes in the system, use lsof | grep <address> and kill -9 <pid> to manually delete them.
Parameters: continued (int) – Continue (1) or stop (0) the PL server. Returns: Return type: None
-
setup
(address='/home/docs/checkouts/readthedocs.org/user_builds/pynq/checkouts/v2.2.1/pynq/.log', key=b'xilinx')[source]¶ Start the PL server and accept client connections.
This method should not be used by the users directly. To check open pipes in the system, use lsof | grep <address> and kill -9 <pid> to manually delete them.
Parameters: - address (str) – The filename on the file system.
- key (bytes) – The authentication key of connection.
Returns: Return type: None
-
timestamp
¶ The getter for the attribute timestamp.
Returns: Bitstream download timestamp. Return type: str
-