PeakRDL-uvm

2.4.0 · active · verified Thu Apr 16

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

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `UVMExporter` class programmatically to compile a SystemRDL file and generate a UVM register model. It first creates a dummy RDL file, compiles it using `systemrdl-compiler`, elaborates the design, and then uses `PeakRDL-uvm` to export the UVM package.

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)

view raw JSON →