Clarification on Driver Creation and custom overlay

Hi,

In Overlay Tutorial β€” Python productivity for Zynq (Pynq)
The tutorial provides two ways of making overly call easier for the user.

One method, called driver creation, seems straight forward
The second method is called customization of the overlay.

My understanding is they are achieving the same purpose.

Can you clarify what custom overlay can do but the driver cannot?
In the tutorial it mentioned
" While the default overlay is sufficient for many use cases, some overlays will require more customisation to provide a user-friendly API"

What exactlly is more customisation?

Kind regards
Jie

Driver is for a specific function.

PYNQ libraries provide APIs to expose the functionality available for specific devices. This is usually at the level of the API provided by the C/C++ driver for the peripheral.
One problem with this is that some objects expose quote low level detail.

As an example the default AXI GPIO drivers expose channels 1 and 2 as separate attributes meaning that accessing the LEDs in the base overlay requires the following contortion

base = Overlay(β€˜base.bit’) base.leds_gpio.channel1[0].on()

If your Overlay connects this GPIO to LEDs, then at the Overlay level a more Pythonic API would not expose the underlying architecture of the peripheral. A Python user would like to be able just do something like

from pynq.overlays.base import BaseOverlay
base_overlay.led.on()

You can do this with Overlay customization.

You could also achieve a similar effect with drivers. Depending on your design (and your prefernece), one approach may be better than the other.

Cathal

2 Likes

Thanks Cathal for the fast response.

1 Like