Skip to content

VHDL/pyVHDLModel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 21, 2025
2b4af3b · Apr 21, 2025
Apr 21, 2025
Apr 21, 2025
Dec 26, 2021
Feb 9, 2025
Apr 21, 2025
Apr 21, 2025
Apr 21, 2025
Dec 26, 2020
Dec 9, 2024
Dec 26, 2020
Jan 4, 2023
Apr 21, 2025
Apr 21, 2025
Apr 21, 2025
Feb 9, 2025

Repository files navigation

Sourcecode on GitHub Sourcecode License Documentation Documentation License Gitter
PyPI PyPI - Status PyPI - Python Version
GitHub Workflow - Build and Test Status Libraries.io status for latest release Codacy - Quality Codacy - Coverage Codecov - Branch Coverage

An abstract VHDL language model written in Python.

Main Goals

This package provides a unified abstract language model for VHDL. Projects reading from source files can derive own classes and implement additional logic to create a concrete language model for their tools.

Projects consuming pre-processed VHDL data (parsed, analyzed or elaborated) can build higher level features and services on such a model, while supporting multiple frontends.

Use Cases

pyVHDLModel Generators

  • High-level API for GHDL's libghdl offered via pyghdl.
  • Code Document-Object-Model (Code-DOM) in pyVHDLParser.

pyVHDLModel Consumers

  • Create graphical views of VHDL files or designs.
    Possible candidates: Symbolator
  • Created a (re)formatted output of VHDL.

Examples

List all Entities with Generics and Ports

The following tiny example is based on GHDL's pyGHDL.dom package implementing pyVHDLModel.

from pathlib import Path
from pyGHDL.dom.NonStandard import Design, Document

sourceFile = Path("example.vhdl")

design = Design()
library = design.GetLibrary("lib")
document = Document(sourceFile)
design.AddDocument(document, library)

for entity in document.Entities.values():
  print(f"{entity.Identifier}")
  print("  generics:")
  for generic in entity.GenericItems:
    identifiers = ", ".join([str(i) for i in generic.Identifiers])
    print(f"  - {identifiers} : {generic.Mode!s} {generic.Subtype}")
  print("  ports:")
  for port in entity.PortItems:
    identifiers = ", ".join([str(i) for i in port.Identifiers])
    print(f"  - {identifiers} : {port.Mode!s} {port.Subtype}")

Contributors

License

This Python package (source code) licensed under Apache License 2.0.
The accompanying documentation is licensed under Creative Commons - Attribution 4.0 (CC-BY 4.0).


SPDX-License-Identifier: Apache-2.0