Skip to content

Commit

Permalink
Refactor UVM export. v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Apr 19, 2020
1 parent 8836cf3 commit 3d1b38e
Show file tree
Hide file tree
Showing 32 changed files with 1,953 additions and 798 deletions.
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Other tool litter
*.rpt
*.wlf
**/transcript
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
language: python
python:
- 3.5
- 3.6
- 3.7
- 3.8

script:
- python -m pip install .
- cd test
- python generate_testcase_data.py basic testcases/basic.rdl

after_success:
- coveralls

stages:
- test
# Only execute deployment stage on tagged release commits in the form of "v1.2.3"
# and from your repository (e.g. not PRs).
# Also allows alpha/beta releases such as "v1.2.3b2"
- name: deploy
if: repo = SystemRDL/PeakRDL-uvm AND tag =~ ^v\d+\.\d+\.\w+$

jobs:
include:
# Run lint
- name: Lint
install:
- python -m pip install pylint
- python -m pip install .
script: pylint --rcfile test/pylint.rc peakrdl

# Deploy source distribution
- stage: deploy
name: Deploy source distribution
install: python -m pip install twine
script: python setup.py sdist --formats=gztar
after_success: python -m twine upload --skip-existing dist/*.tar.gz
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
recursive-include peakrdl/uvm/templates *
recursive-exclude test *
48 changes: 34 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ralbot-uvm.svg)](https://pypi.org/project/ralbot-uvm)
[![Build Status](https://travis-ci.org/SystemRDL/PeakRDL-uvm.svg?branch=master)](https://travis-ci.org/SystemRDL/PeakRDL-uvm)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/peakrdl-uvm.svg)](https://pypi.org/project/peakrdl-uvm)

# RALBot-uvm
# PeakRDL-uvm
Generate UVM register model from compiled SystemRDL input

## Installing
Install from [PyPi](https://pypi.org/project/ralbot-uvm) using pip:
Install from [PyPi](https://pypi.org/project/peakrdl-uvm) using pip:

python3 -m pip install ralbot-uvm
python3 -m pip install peakrdl-uvm

--------------------------------------------------------------------------------

Expand All @@ -17,7 +18,7 @@ to the exporter.
```python
import sys
from systemrdl import RDLCompiler, RDLCompileError
from ralbot.uvmgen import uvmGenExporter
from peakrdl.uvm import UVMExporter

rdlc = RDLCompiler()

Expand All @@ -27,28 +28,47 @@ try:
except RDLCompileError:
sys.exit(1)

file = "test.svh"
exporter = uvmGenExporter()
exporter.export(root, file)
exporter = UVMExporter()
exporter.export(root, "test.sv")
```
--------------------------------------------------------------------------------

## Reference

### `uvmGenExporter(**kwargs)`
Constructor for the uvmGen exporter class
### `UVMExporter(**kwargs)`
Constructor for the UVM Exporter class

**Optional Parameters**

* `indentLvl`
* String to use for each indent level. Defaults to three spaces.
* `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.

### `uvmGenExporter.export(node, path)`
### `UVMExporter.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. Can be (dir+filename without suffix. such as "output/test_uvmgen")
* Output file.

**Optional Parameters**

* `export_as_package`
* If True (Default), UVM register model is exported as a SystemVerilog
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.
1 change: 1 addition & 0 deletions peakrdl/uvm/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "2.0.0"
3 changes: 3 additions & 0 deletions peakrdl/uvm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .__about__ import __version__

from .exporter import UVMExporter
Loading

0 comments on commit 3d1b38e

Please sign in to comment.