Synchonous IP: how to manage in Python?


I have a synchronous IP that I would like to control via Python.
This IP has a variable latency that could change depending on the incoming data. The IP raise a flag to notify the conclusion of its elaboration.

How can I capture this event that represents the end of the computation of my IP?
Do I have to use Interrupts? How can I set them and link them in Python?



You could write the result to a register, and poll to check for the result, or use interrupts.
You can use asyncio to use interrupts with PYNQ.



Thank you,

I have tried to enable interrupts on my Custom IP,Zynq7 PS and then binded the ports.
Finally, I have generated the bitstream.

The overlay can be loaded and the ip_dict shows the name of my customIP (root_0).

{‘root_0’: {‘addr_range’: 65536,
‘device’: <pynq.pl_server.device.XlnkDevice at 0xb02af3d0>,
‘driver’: pynq.overlay.DefaultIP,
‘fullpath’: ‘root_0’,
‘gpio’: {},
‘interrupts’: {‘irq’: {‘controller’: ‘’,
‘fullpath’: ‘root_0/irq’,
‘index’: 0}},
‘mem_id’: ‘SEG_root_0_S_AXI_INTR_reg’,
‘phys_addr’: 1136721920,
‘state’: None,
‘type’: ‘’}}

Unfortunally, I can’t retrieve it and gives me this errors:

KeyError Traceback (most recent call last)
in ()
----> 1 overlay.root_0

/usr/local/lib/python3.6/dist-packages/pynq/ in getattr(self, key)
335 “”"
336 if self.is_loaded():
–> 337 return getattr(self._ip_map, key)
338 else:
339 raise RuntimeError(“Overlay not currently loaded”)

/usr/local/lib/python3.6/dist-packages/pynq/ in getattr(self, key)
735 elif key in self._description[‘ip’]:
736 ipdescription = self._description[‘ip’][key]
–> 737 driver = ipdescription’driver’
738 setattr(self, key, driver)
739 return driver

/usr/local/lib/python3.6/dist-packages/pynq/ in init(self, description)
600 self._gpio = {}
601 for interrupt, details in self._interrupts.items():
–> 602 setattr(self, interrupt, Interrupt(details[‘fullpath’]))
603 for gpio, entry in self._gpio.items():
604 gpio_number = GPIO.get_gpio_pin(entry[‘index’])

/usr/local/lib/python3.6/dist-packages/pynq/ in init(self, pinname)
96 self.number = PL.interrupt_pins[pinname][‘index’]
97 self.parent = weakref.ref(
—> 98 _InterruptController.get_controller(parentname))
99 self.event = asyncio.Event()
100 self.waiting = False

/usr/local/lib/python3.6/dist-packages/pynq/ in get_controller(name)
157 if == name:
158 return con
–> 159 ret = _InterruptController(name)
160 _InterruptController._controllers.append(ret)
161 return ret

/usr/local/lib/python3.6/dist-packages/pynq/ in init(self, name)
175 “”"
176 = name
–> 177 self.mmio = MMIO(PL.ip_dict[name][‘phys_addr’], 32)
178 self.wait_handles = [ for _ in range(32)]
179 self.event_number = 0

KeyError: ‘’

Any suggestions?

Hi @Stefano_Centomo
Looks like there’s a problem in the block design related to the AXI interrupt block. Could you please post a screenshot of the block design?