Skip to main content

Python based UVM-RAL generator

Project description

pyralgen

pyralgen is a lightweight Python-based UVM-RAL code generator. It leverages the SystemRDL standard to describe the register specifications and extends the PeakRDL-uvm framework to include build-in register coverage support.

Features

  • UVM-RAL code generation with automatic coverage model insertion
  • Template-driven: easily extend or override code templates
  • Industry best practices: idiomatic, maintainable SystemVerilog output
  • Configurable: enable or disable coverage, factory usage, and more via CLI options

Prerequisites

  • Python 3.9.21 or later.

Installing

Note: pyralgen is still under active development.

Clone the repository and set up the Python environment :

# Clone project
git clone https://github.com/cirofabianbermudez/pyralgen.git
cd pyralgen

# Bootstrap Python venv and install deps
./scripts/setup/setup_python_env.sh
source .venv/bin/activate

# Verify installation
pyuvcgen -h

Example

The easiest way to use pyralgen is via the command line tool:

# Generate UVM-RAL
pyralgen -c registers.rdl -o ral_regs_pkg.sv

Integration

Inside the top_env.sv make sure to enable coverage models for register model before creating the register model and enable sampling of coverage after building the register model.

class top_env extends uvm_env;

  `uvm_component_utils(top_env)

  function void top_env::build_phase(uvm_phase phase);
    ...
    if (regmodel == null) begin

      // Enable Coverage models for register model <- Add this
      uvm_reg::include_coverage("*", UVM_CVR_ALL);

      // Create and build the register model
      regmodel = ral_reg_block::type_id::create("regmodel", this);
      uvm_config_db #(ral_reg_block)::set(this, "", "regmodel", regmodel);
      regmodel.build();

      // Enable sampling of coverage               <- Add this
      if (m_config.coverage_enable) begin
        regmodel.set_coverage(UVM_CVR_ALL);
      end

      // Lock and reset
      regmodel.lock_model();
      regmodel.reset()
    end

Development

  1. Clone de repository and navigate to its root directory:

    git clone https://github.com/cirofabianbermudez/pyralgen.git
    cd pyuvcgen
    
  2. Create a Python virtual environment and install dependencies:

    ./script/setup/setup_python_env.sh
    source .venv/bin/activate
    
  3. Verify installation:

    pyuvcgen -h
    

License

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues or submit a pull request.

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

pyralgen-1.0.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyralgen-1.0.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file pyralgen-1.0.1.tar.gz.

File metadata

  • Download URL: pyralgen-1.0.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyralgen-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c133c28a616ad5763bc0f959773b2c9f647f2fa2cbae1ec20917ca261e461663
MD5 a4d7b0174c8b9711213fe8fdf2758790
BLAKE2b-256 6896d069dee40f6158950c3fc7bf06087c96a73071e5c75fe73a56c7cba27859

See more details on using hashes here.

File details

Details for the file pyralgen-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyralgen-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyralgen-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f431bdd598fd85f69f16903de5a7275c90c3b985902786c06174f12572eda2f7
MD5 a693194a54470d96d35542c359b78005
BLAKE2b-256 a148e906273b06f42864bf46306de077b62a8bfbe5b741f3327d4262f2070711

See more details on using hashes here.

Supported by

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