uvmgen


Nameuvmgen JSON
Version 0.5.0 PyPI version JSON
download
home_page
SummaryA toolkit of uvm tb generate.
upload_time2024-03-02 15:09:33
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords verification testbench uvm template tool generator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # icdk (IC Deveplopment Toolkit)  
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/uvmgen)
[![PyPI - Version](https://img.shields.io/pypi/v/uvmgen)](https://pypi.org/project/uvmgen)
![GitHub language count](https://img.shields.io/github/languages/count/Dragon-Git/icdk?logo=python)
[![Latest Release](https://img.shields.io/github/v/release/Dragon-Git/icdk?color=blue&label=Latest%20Release)](https://github.com/Dragon-Git/icdk/releases/latest)
[![downloads](https://pepy.tech/badge/uvmgen)](https://pepy.tech/project/uvmgen)
[![CI](https://github.com/Dragon-Git/icdk/actions/workflows/python-package.yml/badge.svg)](https://github.com/Dragon-Git/icdk/actions/workflows/python-package.yml)
![GitHub deployments](https://img.shields.io/github/deployments/Dragon-Git/icdk/release)

---
## Introduction
uvmgen includes a uvm testbench generation tool `uvmgen` and an experimental code snippets generation tool `sudef`.

- `uvmgen` is a command-line interface (CLI) program for generating testbench structures based on a provided JSON/YAML/TOML/XML configuration file. 
- `sudef` is an experimental command-line tool designed to process SystemVerilog files containing mako-style templates. By parsing specific comment formats, sudef generates SystemVerilog code that adheres to the defined templates.
## Installing
<details>
  <summary>Prerequisites</summary>

- Operating systems
  - Windows
  - Linux
  - macOS
- Python: 3.8 ~ 3.12
</details>

Use Python's package installer pip to install uvmgen:
```bash
python3 -m pip install uvmgen 
```

## uvmgen - uvm testbench generator

### Usage

The basic usage of uvmgen is as follows:
```bash
uvmgen --input <input_cfg_file> --output <output_directory>
```

### Options

- `--input <input_cfg_file>`: Specifies the input configuration file containing the configuration for the testbench structure.  
- `--output <output_directory>`: Specifies the directory where the generated files will be placed.

### Help

For additional help and options, you can use the -h or --help option:

```bash
uvmgen -h
```

### SyoSil ApS UVM Scoreboard
The [SyoSil ApS UVM Scoreboard](https://github.com/Dragon-Git/uvm_syoscb) is a feature of uvmgen that allows you to integrate SyoSil ApS UVM Scoreboard in environments. To use this feature, you need to add `pk_syoscb` to `import_pkgs` of env_pkg, and set the `SYOSCB_HOME` environment variables to SyoSil ApS UVM Scoreboard installed directory. The bash command is printed after uvmgen is successful, and the other shells can be replaced with the corresponding commands.

### Example

Suppose you have a JSON configuration file named testbench_config.json and you want to generate the testbench structure in a directory named tb, you would run the following command:

```bash
uvmgen --input testbench_config.json --output tb
# or
uvmgen -i testbench_config.json -o tb
# or
uvmgen -i testbench_config.json
```

You can use `test/json/example/typical.json` to generate a complete UVM environment, or use `test/json/base_pkg/***.***` to generate a single package.

## sudef - SV File Template Generator

### Overview

sudef is a command-line tool designed to process SystemVerilog (.sv) files that contain mako-style templates in comments. The tool generates code based on the provided templates, supporting both inline code generation and the inclusion of external files. By invoking sudef <svfile>, you can automatically generate the desired SystemVerilog code based on the specified template definitions.

### Usage

The basic usage of sudef is as follows:
```bash
sudef <srcfile>
```

- Inline Mode  
When `super_define()` is called with no arguments, sudef operates in inline mode. In this mode, the generated code is directly inserted into the original .sv file, replacing the template placeholders with the appropriate values.
- External File Mode  
When `super_define()` is called with arguments, sudef enters external file mode. In this mode, the generated code is written to a separate external file. The path and name of the external file are specified as arguments to `super_define()`.
### Experimental Nature
Due to its experimental nature, sudef may contain features that are not yet fully tested or implemented. You may encounter unexpected behavior or errors during usage. We encourage you to report any issues or suggested improvements to help us continually improve this program.

### Example

Let's consider a simple example where we have a SystemVerilog file named example.sv that contains a mako template:
```systemverilog
/* super_define()
<%

%>\
% for i in range(3):
int cfg_${i};
% endfor

`uvm_object_utils_begin(mycfg)
% for i in range(3):
`uvm_field_int(cfg_${i}, UVM_DEFAULT)
% endfor
`uvm_object_utils_end

*/
```
You can use sudef to generate the code by running:
```bash
sudef example.sv
```
The generated code will be:
```systemverilog
/* super_define()
<%

%>\
% for i in range(3):
int cfg_${i};
% endfor

`uvm_object_utils_begin(mycfg)
% for i in range(3):
`uvm_field_int(cfg_${i}, UVM_DEFAULT)
% endfor
`uvm_object_utils_end

*/
// super_define generate begin
int cfg_0;
int cfg_1;
int cfg_2;

`uvm_object_utils_begin(mycfg)
`uvm_field_int(cfg_0, UVM_DEFAULT)
`uvm_field_int(cfg_1, UVM_DEFAULT)
`uvm_field_int(cfg_2, UVM_DEFAULT)
`uvm_object_utils_end
// super_define generate end
```
If you want to generate the code to an external file, you can use super_define() with arguments:
```systemverilog
/* super_define(cfg_inc.svh)
<%

%>\
% for i in range(3):
int cfg_${i};
% endfor

`uvm_object_utils_begin(mycfg)
% for i in range(3):
`uvm_field_int(cfg_${i}, UVM_DEFAULT)
% endfor
`uvm_object_utils_end

*/
```
This will generate the same code as above but write it to a file named cfg_inc.svh and included by this file.

## Contribute
Contributions are always welcome! Simple fork this repo and submit a pull request.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "uvmgen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "verification,testbench,UVM,template,tool,generator",
    "author": "",
    "author_email": "Dragon-Git <1762578117@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/7d/e6/d58e8a10577e65cd3e2f32fe4c07ee2898e232d4912a08ba263ab1d3b58f/uvmgen-0.5.0.tar.gz",
    "platform": null,
    "description": "# icdk (IC Deveplopment Toolkit)  \n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/uvmgen)\n[![PyPI - Version](https://img.shields.io/pypi/v/uvmgen)](https://pypi.org/project/uvmgen)\n![GitHub language count](https://img.shields.io/github/languages/count/Dragon-Git/icdk?logo=python)\n[![Latest Release](https://img.shields.io/github/v/release/Dragon-Git/icdk?color=blue&label=Latest%20Release)](https://github.com/Dragon-Git/icdk/releases/latest)\n[![downloads](https://pepy.tech/badge/uvmgen)](https://pepy.tech/project/uvmgen)\n[![CI](https://github.com/Dragon-Git/icdk/actions/workflows/python-package.yml/badge.svg)](https://github.com/Dragon-Git/icdk/actions/workflows/python-package.yml)\n![GitHub deployments](https://img.shields.io/github/deployments/Dragon-Git/icdk/release)\n\n---\n## Introduction\nuvmgen includes a uvm testbench generation tool `uvmgen` and an experimental code snippets generation tool `sudef`.\n\n- `uvmgen` is a command-line interface (CLI) program for generating testbench structures based on a provided JSON/YAML/TOML/XML configuration file. \n- `sudef` is an experimental command-line tool designed to process SystemVerilog files containing mako-style templates. By parsing specific comment formats, sudef generates SystemVerilog code that adheres to the defined templates.\n## Installing\n<details>\n  <summary>Prerequisites</summary>\n\n- Operating systems\n  - Windows\n  - Linux\n  - macOS\n- Python: 3.8 ~ 3.12\n</details>\n\nUse Python's package installer pip to install uvmgen:\n```bash\npython3 -m pip install uvmgen \n```\n\n## uvmgen - uvm testbench generator\n\n### Usage\n\nThe basic usage of uvmgen is as follows:\n```bash\nuvmgen --input <input_cfg_file> --output <output_directory>\n```\n\n### Options\n\n- `--input <input_cfg_file>`: Specifies the input configuration file containing the configuration for the testbench structure.  \n- `--output <output_directory>`: Specifies the directory where the generated files will be placed.\n\n### Help\n\nFor additional help and options, you can use the -h or --help option:\n\n```bash\nuvmgen -h\n```\n\n### SyoSil ApS UVM Scoreboard\nThe [SyoSil ApS UVM Scoreboard](https://github.com/Dragon-Git/uvm_syoscb) is a feature of uvmgen that allows you to integrate SyoSil ApS UVM Scoreboard in environments. To use this feature, you need to add `pk_syoscb` to `import_pkgs` of env_pkg, and set the `SYOSCB_HOME` environment variables to SyoSil ApS UVM Scoreboard installed directory. The bash command is printed after uvmgen is successful, and the other shells can be replaced with the corresponding commands.\n\n### Example\n\nSuppose you have a JSON configuration file named testbench_config.json and you want to generate the testbench structure in a directory named tb, you would run the following command:\n\n```bash\nuvmgen --input testbench_config.json --output tb\n# or\nuvmgen -i testbench_config.json -o tb\n# or\nuvmgen -i testbench_config.json\n```\n\nYou can use `test/json/example/typical.json` to generate a complete UVM environment, or use `test/json/base_pkg/***.***` to generate a single package.\n\n## sudef - SV File Template Generator\n\n### Overview\n\nsudef is a command-line tool designed to process SystemVerilog (.sv) files that contain mako-style templates in comments. The tool generates code based on the provided templates, supporting both inline code generation and the inclusion of external files. By invoking sudef <svfile>, you can automatically generate the desired SystemVerilog code based on the specified template definitions.\n\n### Usage\n\nThe basic usage of sudef is as follows:\n```bash\nsudef <srcfile>\n```\n\n- Inline Mode  \nWhen `super_define()` is called with no arguments, sudef operates in inline mode. In this mode, the generated code is directly inserted into the original .sv file, replacing the template placeholders with the appropriate values.\n- External File Mode  \nWhen `super_define()` is called with arguments, sudef enters external file mode. In this mode, the generated code is written to a separate external file. The path and name of the external file are specified as arguments to `super_define()`.\n### Experimental Nature\nDue to its experimental nature, sudef may contain features that are not yet fully tested or implemented. You may encounter unexpected behavior or errors during usage. We encourage you to report any issues or suggested improvements to help us continually improve this program.\n\n### Example\n\nLet's consider a simple example where we have a SystemVerilog file named example.sv that contains a mako template:\n```systemverilog\n/* super_define()\n<%\n\n%>\\\n% for i in range(3):\nint cfg_${i};\n% endfor\n\n`uvm_object_utils_begin(mycfg)\n% for i in range(3):\n`uvm_field_int(cfg_${i}, UVM_DEFAULT)\n% endfor\n`uvm_object_utils_end\n\n*/\n```\nYou can use sudef to generate the code by running:\n```bash\nsudef example.sv\n```\nThe generated code will be:\n```systemverilog\n/* super_define()\n<%\n\n%>\\\n% for i in range(3):\nint cfg_${i};\n% endfor\n\n`uvm_object_utils_begin(mycfg)\n% for i in range(3):\n`uvm_field_int(cfg_${i}, UVM_DEFAULT)\n% endfor\n`uvm_object_utils_end\n\n*/\n// super_define generate begin\nint cfg_0;\nint cfg_1;\nint cfg_2;\n\n`uvm_object_utils_begin(mycfg)\n`uvm_field_int(cfg_0, UVM_DEFAULT)\n`uvm_field_int(cfg_1, UVM_DEFAULT)\n`uvm_field_int(cfg_2, UVM_DEFAULT)\n`uvm_object_utils_end\n// super_define generate end\n```\nIf you want to generate the code to an external file, you can use super_define() with arguments:\n```systemverilog\n/* super_define(cfg_inc.svh)\n<%\n\n%>\\\n% for i in range(3):\nint cfg_${i};\n% endfor\n\n`uvm_object_utils_begin(mycfg)\n% for i in range(3):\n`uvm_field_int(cfg_${i}, UVM_DEFAULT)\n% endfor\n`uvm_object_utils_end\n\n*/\n```\nThis will generate the same code as above but write it to a file named cfg_inc.svh and included by this file.\n\n## Contribute\nContributions are always welcome! Simple fork this repo and submit a pull request.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A toolkit of uvm tb generate.",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/Dragon-Git/icdk",
        "issue tracker": "https://github.com/Dragon-Git/icdk/issues"
    },
    "split_keywords": [
        "verification",
        "testbench",
        "uvm",
        "template",
        "tool",
        "generator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92e24a7793637b2e1e01f68b7d10a5e215134079a3d5bc451d565ddc23a004c6",
                "md5": "a9bad9cb996a52601ddb58c87ff4e23f",
                "sha256": "fadf276c2e8aac16131906e122139f1a59c5bef4d4f096d4c3c336b7b845bac6"
            },
            "downloads": -1,
            "filename": "uvmgen-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9bad9cb996a52601ddb58c87ff4e23f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 205687,
            "upload_time": "2024-03-02T15:09:31",
            "upload_time_iso_8601": "2024-03-02T15:09:31.625822Z",
            "url": "https://files.pythonhosted.org/packages/92/e2/4a7793637b2e1e01f68b7d10a5e215134079a3d5bc451d565ddc23a004c6/uvmgen-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7de6d58e8a10577e65cd3e2f32fe4c07ee2898e232d4912a08ba263ab1d3b58f",
                "md5": "4ebcaf25e3782d189cab539c7d9c5f73",
                "sha256": "4bb4cbded60c3e6027205b39e7c7ea3c65013f7ce0f28ce0984e1d18b16ac1a3"
            },
            "downloads": -1,
            "filename": "uvmgen-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4ebcaf25e3782d189cab539c7d9c5f73",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 142883,
            "upload_time": "2024-03-02T15:09:33",
            "upload_time_iso_8601": "2024-03-02T15:09:33.632303Z",
            "url": "https://files.pythonhosted.org/packages/7d/e6/d58e8a10577e65cd3e2f32fe4c07ee2898e232d4912a08ba263ab1d3b58f/uvmgen-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-02 15:09:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dragon-Git",
    "github_project": "icdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "uvmgen"
}
        
Elapsed time: 0.18511s