Skip to main content

Python abstraction layer for registerfile access

Project description

regfile_generics

BSD License Build Status Coverage Status Code style: black

Installation

From PyPI

python3 -m pip install --upgrade regfile_generics

From source

git clone https://github.com/icglue/regfile_generics
cd regfile_generics
python3 -m pip install .

Usage

Setup Regfile and Regfile Device for Access

See tests/fixtures.py how to create a regfile by deriving from the Regfile class. Implement read/write functions and pass them (or overwrite while deriving) to an adequate RegfileDevice class.

Accessing Registers

    # dict like:
    regfile["reg1_high"] = {"cfg": 0x0AA, "cfg_trigger": 0x0, "cfg_trigger_mode": 0x0}
    # or single field (might issue read-modify-write)
    regfile["reg1_high"]["cfg"] = 0xB

    # uvm like:
    regfile.reg2_r.config_f.set(2)
    regfile.reg2_r.update()

    # write_update
    regfile["reg_addr40_r"].write_update(start=1, enable_feature0=0, enable_feature1=0)

    # read (can be int or dict or string context)
    assert entry["cfg"] == 0x22
    print(entry["cfg"])

    # read entire entry to an variable, so that no further read request will be issued

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regfile_generics-0.1.0.tar.gz (14.5 kB view hashes)

Uploaded Source

Built Distribution

regfile_generics-0.1.0-py3-none-any.whl (12.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page