├── .circleci └── config.yml ├── .coveragerc ├── .gitignore ├── .readthedocs.yml ├── LICENSE ├── MANIFEST.in ├── README.md ├── doc ├── .gitignore ├── build.py ├── conf.py ├── index.rst └── requirements.doc.txt ├── pyDigitalWaveTools ├── __init__.py ├── json │ ├── __init__.py │ ├── value_format.py │ └── writer.py └── vcd │ ├── __init__.py │ ├── common.py │ ├── parser.py │ ├── value_format.py │ └── writer.py ├── setup.cfg ├── setup.py └── tests ├── AxiRegTC_test_write.vcd ├── __init__.py ├── all.py ├── example0.json ├── example0.vcd ├── jsonWriter_test.py ├── multiscope.vcd ├── vcdParser_test.py ├── vcdWriter_test.py ├── verilog2005-sample0.vcd └── verilog2005-sample1.vcd /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | orbs: 4 | python: circleci/python@0.2.1 5 | py: nic30/python-all-in-1@0.3.0 6 | 7 | jobs: 8 | install-test-deploy: 9 | executor: python/default 10 | resource_class: small 11 | steps: 12 | - checkout 13 | # - python/load-cache 14 | - py/install-setup-py 15 | # - python/save-cache 16 | - py/test-and-coverage 17 | - py/deploy-pypi-on-tag 18 | 19 | workflows: 20 | main: 21 | jobs: 22 | - install-test-deploy: 23 | context: 24 | - pypi 25 | filters: 26 | tags: 27 | only: /.*/ -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | 4 | source = 5 | pyDigitalWaveTools 6 | 7 | [report] 8 | exclude_lines = 9 | pragma: no cover 10 | def __repr__ 11 | raise AssertionError 12 | raise NotImplementedError 13 | if __name__ == .__main__.: 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | doc/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | 103 | # eclipse project 104 | .project 105 | .pydevproject 106 | .settings/ 107 | 108 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | build: 3 | os: ubuntu-lts-latest 4 | tools: 5 | python: "3.12" 6 | apt_packages: 7 | - graphviz 8 | python: 9 | install: 10 | - requirements: doc/requirements.doc.txt 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Nic30 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include pyDigitalWaveTools *.vcd 2 | include README.md 3 | include MANIFEST.in -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pyDigitalWaveTools 2 | [![CircleCI](https://circleci.com/gh/Nic30/pyDigitalWaveTools.svg?style=svg)](https://circleci.com/gh/Nic30/pyDigitalWaveTools) 3 | [![Coverage Status](https://coveralls.io/repos/github/Nic30/pyDigitalWaveTools/badge.svg?branch=master)](https://coveralls.io/github/Nic30/pyDigitalWaveTools?branch=master) 4 | [![PyPI version](https://badge.fury.io/py/pyDigitalWaveTools.svg)](http://badge.fury.io/py/pyDigitalWaveTools) 5 | [![Documentation Status](https://readthedocs.org/projects/pydigitalwavetools/badge/?version=latest)](http://pydigitalwavetools.readthedocs.io/en/latest/?badge=latest) 6 | [![Python version](https://img.shields.io/pypi/pyversions/pyDigitalWaveTools.svg)](https://img.shields.io/pypi/pyversions/pyDigitalWaveTools.svg) 7 | 8 | python library for operations with VCD and other digital wave files 9 | 10 | ## Feature list 11 | * parse VCD (std 2009) files to intermediate format 12 | * write VCD files, user specified formatters for user types, predefined formatters for vectors, bits and enum values 13 | * dump intermediate format as simple json 14 | 15 | ## Hello pyDigitalWaveTools 16 | 17 | Here is a simple example how to use the VCD parser: 18 | 19 | ```python 20 | #!/usr/bin/env python3 21 | import json 22 | import sys 23 | from pyDigitalWaveTools.vcd.parser import VcdParser 24 | 25 | if len(sys.argv) > 1: 26 | fname = sys.argv[1] 27 | else: 28 | print('Give me a vcd file to parse') 29 | sys.exit(-1) 30 | 31 | with open(fname) as vcd_file: 32 | vcd = VcdParser() 33 | vcd.parse(vcd_file) 34 | data = vcd.scope.toJson() 35 | print(json.dumps(data, indent=4, sort_keys=True)) 36 | ``` 37 | 38 | 39 | ## Output json format 40 | ``` 41 | scope 42 | { "name": "" 43 | "children" : {"" : child} 44 | } 45 | 46 | child can be scope or signal record 47 | 48 | signal record 49 | { "name": "" 50 | "type": {"sigType": "", 51 | "width": }, 52 | "data": [], 53 | } 54 | 55 | data record format 56 | [