Skip to content

Python package for generating uvm-python register models from SystemRDL 2.0 descriptions.

License

Notifications You must be signed in to change notification settings

tpoikela/uvm-python-rdl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status PyPI - Python Version

uvm-python-rdl

Generate UVM (uvm-python) register model from compiled SystemRDL input. This is ported from the project https://github.com/SystemRDL/PeakRDL-uvm

Installing

python3 -m pip install .

Running the script

This package includes a script to generate the register model, and some unit tests for sanity checking.

uvm-python-rdl <test_name> <rdl_file>

Exporter Usage

Pass the elaborated output of the SystemRDL Compiler to the exporter.

import sys
from systemrdl import RDLCompiler, RDLCompileError
from uvm_python_rdl import UVMExporter

rdlc = RDLCompiler()

try:
    rdlc.compile_file("path/to/my.rdl")
    root = rdlc.elaborate()
except RDLCompileError:
    sys.exit(1)

exporter = UVMPythonExporter()
exporter.export(root, "registers.py")

Reference

UVMPythonExporter(**kwargs)

Constructor for the UVM Exporter class

Optional Parameters

  • user_template_dir
    • Path to a directory where user-defined template overrides are stored.
  • user_template_context
    • Additional context variables to load into the template namespace.

UVMPythonExporter.export(node, path, **kwargs)

Perform the export!

Parameters

  • node
    • Top-level node to export. Can be the top-level RootNode or any internal AddrmapNode.
  • path
    • Output file.

Optional Parameters

  • export_as_package
    • If True (Default), UVM register model is exported as a Python package. Package name is based on the output file name.
    • If False, register model is exported as an includable header.
  • reuse_class_definitions
    • If True (Default), exporter attempts to re-use class definitions where possible. Class names are based on the lexical scope of the original SystemRDL definitions.
    • If False, class definitions are not reused. Class names are based on the instance's hierarchical path.
  • use_uvm_factory
    • If True, class definitions and class instances are created using the UVM factory.
    • If False (Default), UVM factory is disabled. Classes are created directly via new() constructors.

Related projects

About

Python package for generating uvm-python register models from SystemRDL 2.0 descriptions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published