pynq.lib.pynqmicroblaze Module

class pynq.lib.pynqmicroblaze.MBInterruptEvent(intr_pin, intr_ack_gpio)[source]

Bases: object

The class provides and asyncio Event-like interface to the interrupt subsystem for a Microblaze. The event is set by raising an interrupt and cleared using the clear function.

Typical use is to call clear prior to sending a request to the Microblaze and waiting in a loop until the response is received. This order of operations will avoid race conditions between the Microblaze and the host code.

clear()[source]

Clear the interrupt and reset the event. Resetting the event should be done before sending a request that will be acknowledged interrupts.

wait()[source]

Coroutine to wait until the event is set by an interrupt.

class pynq.lib.pynqmicroblaze.MicroblazeHierarchy(description, mbtype='Unknown')[source]

Bases: pynq.overlay.DefaultHierarchy

Hierarchy driver for the microblaze subsystem.

Enables the user to load programs on to the microblaze. All function calls and member accesses are delegated to the loaded program.

static checkhierarchy(description)[source]
mbtype

The defined type of the microblaze subsystem. Used by driver programs to limit what microblaze subsystems the program is run on. The Pynq-Z1 base overlay has ‘Ardiuno’ and ‘Pmod’ microblaze types.

class pynq.lib.pynqmicroblaze.PynqMicroblaze(mb_info, mb_program)[source]

Bases: object

This class controls the active Microblaze instances in the system.

ip_name

str – The name of the IP corresponding to the Microblaze.

rst_name

str – The name of the reset pin for the Microblaze.

mb_program

str – The absolute path of the Microblaze program.

state

str – The status (IDLE, RUNNING, or STOPPED) of the Microblaze.

reset_pin

GPIO – The reset pin associated with the Microblaze.

mmio

MMIO – The MMIO instance associated with the Microblaze.

interrupt

Event – An asyncio.Event-like class for waiting on and clearing interrupts.

program()[source]

This method programs the Microblaze.

This method is called in __init__(); it can also be called after that. It uses the attribute self.mb_program to program the Microblaze.

Returns:
Return type:None
read(offset, length=1)[source]

This method reads data from the shared memory of Microblaze.

Parameters:
  • offset (int) – The beginning offset where data are read from.
  • length (int) – The number of data (32-bit int) to be read.
Returns:

An int of a list of data read from the shared memory.

Return type:

int/list

reset()[source]

Reset the Microblaze to stop it from running.

This method will update the status of the Microblaze.

Returns:
Return type:None
run()[source]

Start the Microblaze to run program loaded.

This method will update the status of the Microblaze.

Returns:
Return type:None
write(offset, data)[source]

This method write data into the shared memory of the Microblaze.

Parameters:
  • offset (int) – The beginning offset where data are written into.
  • data (int/list) – A list of 32b words to be written.
Returns:

Return type:

None