Skip to main content

A comprehensive Python framework for parsing Verilog code and generating circuit diagrams (Verilog Parser + Circuit Visualization)

Project description

DooPourd - Verilog Parser & Circuit Diagram Generator

A comprehensive Python framework for parsing Verilog code and generating circuit diagrams (SVG/PNG).

GitHub: https://github.com/Dev-vesper/DooPourd
PyPI: https://pypi.org/project/DooPourd/
License: MIT

Quick Install

pip install DooPourd

Works on Windows, macOS, Linux - no external tools needed!

Features

  • Verilog Parsing - Parse Verilog into fully-featured Abstract Syntax Trees (AST)
  • Lexical Analysis - Full tokenization with keywords, identifiers, operators, literals
  • Pure Python Circuit SVG - Generate circuit diagrams WITHOUT external tools (NEW v0.7.1!)
  • Circuit Diagrams - Generate SVG and PNG from Yosys output (optional)
  • AST Visualization - Graphical code structure via Graphviz (optional)
  • Cross-Platform - Windows, macOS, Linux - native support

Examples

1. Parse Verilog (Works Everywhere!) ✅

from verilog_framework.core import parse_verilog

code = """
module adder(input a, input b, output sum);
    assign sum = a + b;
endmodule
"""

ast = parse_verilog(code)
print(f"Module: {ast.name}")
print(f"Ports: {len(ast.port_list)}")

2. Generate Circuit Diagram - Pure Python! (NEW v0.7.1 ✨)

No external tools needed!

from verilog_framework.core import parse_verilog
from verilog_framework.visualization import CircuitSVG

code = """
module full_adder(input a, input b, input cin, output sum, output cout);
    assign sum = a ^ b ^ cin;
    assign cout = (a & b) | (cin & (a ^ b));
endmodule
"""

ast = parse_verilog(code)
svg = CircuitSVG(ast)
svg.save("circuit.svg")
print("Circuit saved to circuit.svg!")

Benefits:

  • ✅ No Yosys needed
  • ✅ No system dependencies
  • ✅ Windows native support
  • ✅ Works immediately after pip install

3. Analyze Ports (Works Everywhere!) ✅

from verilog_framework.core import parse_verilog

code = """
module counter(input clk, input reset, output [7:0] count);
    reg [7:0] count;
endmodule
"""

ast = parse_verilog(code)

# Extract inputs/outputs
inputs = [p.name for p in ast.port_list if p.direction == 'input']
outputs = [p.name for p in ast.port_list if p.direction == 'output']

print(f"Inputs: {inputs}")    # ['clk', 'reset']
print(f"Outputs: {outputs}")  # ['count']

Installation

Minimal Installation (Recommended)

pip install DooPourd

Includes Pure Python CircuitSVG for circuit diagrams - no external tools needed!

With Graphviz Support (Optional)

For AST structure visualization:

pip install DooPourd[graph]

Then install Graphviz on your system:

# macOS
brew install graphviz

# Ubuntu/WSL
sudo apt-get install graphviz

# Windows
choco install graphviz

With Advanced Diagrams (Linux/WSL only)

For detailed schematics via Yosys:

pip install DooPourd[circuit]
sudo apt-get install yosys npm
npm install -g netlistsvg

All Features

pip install DooPourd[all]

From Source

git clone https://github.com/Dev-vesper/DooPourd.git
cd DooPourd
pip install -e .

Platform Support

Feature Windows macOS Linux
Parse Verilog
Pure Python SVG
Graphviz visualization ⚠️ optional ⚠️ optional ⚠️ optional
Yosys diagrams ⚠️ optional ✅ optional ✅ optional

Supported Verilog Features

Supported Verilog Features

Feature Status
Module declarations ✅ Supported
Ports (input/output/inout) ✅ Supported
Wire declarations ✅ Supported
Reg declarations ✅ Supported
Bit-width specifications ✅ Supported
Continuous assignments ✅ Supported
Always blocks ✅ Supported
@(posedge/negedge) ✅ Supported
Binary/unary expressions ✅ Supported
Comments ✅ Supported
Multi-line code ✅ Supported

Note: Advanced features (functions, tasks, generate blocks) not yet supported.

Troubleshooting

"Graphviz not installed"

Optional feature - install graphviz on your system or use Pure Python CircuitSVG!

brew install graphviz  # macOS
# or
sudo apt-get install graphviz  # Linux

"Yosys not found"

Optional advanced feature for Linux/WSL. Pure Python CircuitSVG works on Windows without Yosys!

License

MIT - See LICENSE for details

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

doopourd-0.7.1.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

doopourd-0.7.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file doopourd-0.7.1.tar.gz.

File metadata

  • Download URL: doopourd-0.7.1.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for doopourd-0.7.1.tar.gz
Algorithm Hash digest
SHA256 f62346c255a6f556701389b1b9021b8bd1f5ef83538de206ed65bc1f7f25af0f
MD5 017ff8f99c4421b4bc86d9b276a4281e
BLAKE2b-256 e328215c1857c6b4717ba9149607866b6d1a0a25c76c20af78958ddd33746980

See more details on using hashes here.

File details

Details for the file doopourd-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: doopourd-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for doopourd-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 858341d332f0294df6f14121bcbe8eedc750e9af6b03c59c70b3c80bfbd6167e
MD5 2e509127a09e0bfdfa94fb5fe9b9d5b3
BLAKE2b-256 910542d280cd7e139b3b7c382e502305323de7e50bd139526469541d6ca295e3

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