Skip to main content

VHDL and System Verilog parser written in c++

Project description

hdlConvertor

Travis-ci Build Status Win Build status PyPI version Python version ROADMAP Gitter Coverage Status

The System Verilog and VHDL parser, preprocessor and code generator for Python/C++ written in C++. The lower layers are ANTLR4 generated parsers with full language support. Next layer converts this raw Verilog/VHDL AST to simple universal AST (Classes defined in hdlConvertor::hdlObjects and it's python equivalent.). So your project does not not have to care about Verilog/VHDL differences and deprecated ridiculous features. It is also possible to convert this AST back to original HDL or access the comments from HDL.

overview

Supported languages:

Installation

Linux: Installing dependencies (Ubuntu 19.04)

# use up to date compiler, gcc>=7
# on old systems without libantlr4-runtime-dev you have to add apt repo manually, see .travis.yml
sudo apt install build-essential uuid-dev cmake default-jre python3 python3-dev python3-pip libantlr4-runtime-dev antlr4

Installing this library

# note this may be older version than you see in repo
sudo pip3 install hdlConvertor

# or download repository and run
sudo pip3 install -r requirements.txt
sudo python3 setup.py install

Or the same for python 2.7 with other options just for demonstration.

Installer also supports other commands which may be usefull

python setup.py install --prefix /tmp/python_install/ -j 8 --build-type Debug -- -DANTLR_JAR_LOCATION=/antlr-4.7.1-complete.jar -- VERBOSE=1

You can also install only C++ library/generate .deb package (nothing specific, just normal cmake-based library)

mkdir build && cd build
cmake .. && cmake . --build
cpack # to generate .deb package

Windows:

Take a look at appveyor.yml. It is required to download antlr4 first and have visual studio or other c++ compiler installed.

Usage

The HDL AST (the parsed code) is represented by objects from hdlConvertor.hdlAst. There are classes for objects in HDL langues and there is also type specified for every property in anotations. This allows IDEs to advise and it is also a part of doc.

Example of usage:

import sys
from hdlConvertor.language import Language
from hdlConvertor.toVerilog import ToVerilog
from hdlConvertor import HdlConvertor

filenames = ["your.v", ]
include_dirs = []
c = HdlConvertor()
d = c.parse(filenames, Language.VERILOG, include_dirs, hierarchyOnly=False, debug=True)

tv = ToVerilog(sys.stdout)
tv.print_context(d)

for o in d.objs:
    print(o)

overview

Similar projects:

(Tell us If you know about some other project!)

  • cl-vhdl - lisp, Parser of VHDL into lisp-expressions
  • HDL_ANTLR4 - C# projects that use ANTLR4 library to analyse VHDL and Verilog code
  • hdlparse - vhdl/verilog parser in python
  • ieee1800_2017 - Java, SystemVerilog preprocessor
  • Pyverilog - python verilog toolkit
  • pyVHDLParser - python vhdl parser with 2008 support
  • rust_hdl - rust vhdl 2008 parser
  • slang - Parser and compiler library for SystemVerilog.
  • systemc-clang - SystemC Parser using the Clang Front-end
  • v2sc - vhdl to systemc
  • veelox - Java+ANTLR, An experiment in SystemVerilog Preprocessing
  • verilog-parser - A Flex/Bison Parser for the IEEE 1364-2001 Verilog Standard.
  • vbpp - C, Verilog PreProcessor
  • Verilog-Perl
  • vpp.pl - verilog preprocessor with integrated Perl
  • sv2v- Haskell, SystemVerilog to Verilog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hdlConvertor-1.5.tar.gz (148.9 kB view details)

Uploaded Source

File details

Details for the file hdlConvertor-1.5.tar.gz.

File metadata

  • Download URL: hdlConvertor-1.5.tar.gz
  • Upload date:
  • Size: 148.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for hdlConvertor-1.5.tar.gz
Algorithm Hash digest
SHA256 272945ade17dfa7a8d7ec4572ac2f5d8e380b3d8ea92bc67cd884f80df238229
MD5 26e5f3bda4d35e6cc8007ef18c6ee773
BLAKE2b-256 c3cd8409ad980caf3e433c353a5e31a6fcf94989c868983b97b5961b8298f752

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page