PeakRDL-uvm
PeakRDL-uvm is a Python library that generates a Universal Verification Methodology (UVM) register model from compiled SystemRDL input. It is part of the broader PeakRDL ecosystem for control and status register (CSR) automation. The current version is 2.4.0, and the project maintains an active development and release cadence.
Common errors
-
ImportError: No module named 'peakrdl.uvm'
cause Attempting to import from the deprecated `peakrdl.uvm` namespace after it was removed in v2.3.0 (deprecated since v2.1.0).fixUpdate your import statements to `from peakrdl_uvm import UVMExporter`. -
AttributeError: 'UVMExporter' object has no attribute 'old_method_name'
cause Major API refactoring occurred in v2.0.0, causing methods and properties from older versions to become unavailable.fixRefer to the documentation or release notes for v2.0.0 to understand the new API. You will need to rewrite parts of your exporter logic. -
TypeError: UVMExporter.__init__() got an unexpected keyword argument 'user_template_dir'
cause Configuration option `user_template_dir` was added in v2.4.0. Using it with older versions of the library will result in an error.fixUpgrade `peakrdl-uvm` to version 2.4.0 or newer to use the `user_template_dir` option. Alternatively, remove the `user_template_dir` argument if not strictly needed.
Warnings
- breaking The project was renamed from `RALBot-uvm` to `PeakRDL-uvm` in version 2.0.0. Older import paths or commands using `RALBot-uvm` will no longer work.
- breaking Version 2.0.0 introduced a significant refactoring of the UVM exporter implementation, leading to substantial API differences. Code written for versions prior to 2.0.0 will likely break.
- deprecated The `peakrdl.uvm` namespace package import was deprecated in v2.1.0 and removed in v2.3.0. Attempting to import from this path in newer versions will fail.
- breaking Support for Python 3.5 and 3.6 was dropped in version 2.4.0. Users on these Python versions will not be able to install or run `peakrdl-uvm` v2.4.0 or later.
Install
-
pip install peakrdl-uvm -
pip install peakrdl peakrdl-uvm
Imports
- UVMExporter
from peakrdl.uvm import UVMExporter
from peakrdl_uvm import UVMExporter
Quickstart
import sys
import os
from systemrdl import RDLCompiler, RDLCompileError
from peakrdl_uvm import UVMExporter
# Create a dummy RDL file for demonstration
rdl_content = """
addrmap my_design {
reg {
field { sw = w; hw = r; } foo;
} bar at 0x0;
};
"""
with open("my_design.rdl", "w") as f:
f.write(rdl_content)
# Compile the SystemRDL file
rdlc = RDLCompiler()
try:
rdlc.compile_file("my_design.rdl")
root = rdlc.elaborate()
except RDLCompileError:
print("RDL Compilation Error!")
sys.exit(1)
# Export the UVM register model
exporter = UVMExporter()
output_path = "my_design_uvm_pkg.sv"
exporter.export(node=root, path=output_path)
print(f"UVM register model generated to {output_path}")
# Clean up dummy files
os.remove("my_design.rdl")
os.remove(output_path)