Skip to content
/ pydepp Public

PyDEPP is a Python library that provides a high-level, object-oriented interface for interacting with Digilent FPGA boards over the DEPP (Digilent Asynchronous Parallel Port) protocol. It leverages the Digilent Adept SDK to enable seamless communication with DEPP-compatible devices.

License

Notifications You must be signed in to change notification settings

0xMax42/pydepp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyDEPP: Python Bindings for the Digilent DEPP Protocol

PyDEPP is a Python library that provides a high-level, object-oriented interface for interacting with Digilent FPGA boards over the DEPP (Digilent Asynchronous Parallel Port) protocol. It leverages the Digilent Adept SDK to enable seamless communication with DEPP-compatible devices.

Features

  • Register Access: Read and write single or multiple registers with ease.
  • Data Streaming: Stream data to and from registers for high-performance applications.
  • Timeout Configuration: Set custom communication timeouts for DEPP operations.
  • Context Management: Use Python's with statement for automatic resource management.
  • Debugging Tools: Includes a detailed register dump for inspection and debugging.

Requirements

  • Python 3.7 or higher
  • Digilent Adept Runtime and SDK installed on your system
  • Shared libraries libdmgr.so and libdepp.so available in your library paths

Installation

From Source

  1. Clone the repository:

    git clone https://github.com/0xMax42/pydepp.git
    cd pydepp
  2. Install the library:

    pip install .

Usage

Basic Example

from pydepp import AdeptDepp

DEVICE_NAME = "Basys3"

with AdeptDepp(DEVICE_NAME) as depp:
    # Read a register
    value = depp.get_reg(0)
    print(f"Register 0 value: {value}")

    # Write to a register
    depp.set_reg(0, 42)
    print("Wrote 42 to register 0")

    # Stream data
    data = bytes([1, 2, 3, 4, 5])
    depp.put_stream(4, data)
    print("Streamed data to register 4")

Full Example

For a more comprehensive example, see the example.py file in the repository.

API Overview

AdeptDepp Class

  • Initialization: Open a connection to a DEPP-compatible device.
  • Register Access:
    • get_reg(reg: int) -> int: Read a single register.
    • set_reg(reg: int, value: int): Write to a single register.
    • get_reg_block(addresses: List[int]) -> List[int]: Read multiple registers.
    • set_reg_block(addr_data: List[int]): Write multiple registers.
  • Data Streaming:
    • put_stream(reg: int, data: bytes): Stream data to a register.
    • get_stream(reg: int, count: int) -> bytes: Stream data from a register.
  • Timeout:
    • set_timeout(timeout_ns: int): Set communication timeout in nanoseconds.
  • Context Management:
    • Use with AdeptDepp(...) for automatic resource cleanup.

Development

Building the Project

To build the project, ensure you have setuptools installed and run:

python setup.py sdist bdist_wheel

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

Acknowledgments

  • Digilent Adept SDK: This library relies on the Adept SDK for low-level DEPP communication.
  • Author: 0xMax42

About

PyDEPP is a Python library that provides a high-level, object-oriented interface for interacting with Digilent FPGA boards over the DEPP (Digilent Asynchronous Parallel Port) protocol. It leverages the Digilent Adept SDK to enable seamless communication with DEPP-compatible devices.

Topics

Resources

License

Stars

Watchers

Forks

Languages