Giter VIP home page Giter VIP logo

symbolator's Introduction

image

Symbolator

Symbolator is a component diagramming tool for VHDL and Verilog. It will parse HDL source files, extract components or modules and render them as an image.

library ieee;
use ieee.std_logic_1164.all;

package demo is
  component demo_device is
    generic (
      SIZE : positive;
      RESET_ACTIVE_LEVEL : std_ulogic := '1'
    );
    port (
      --# {{clocks|}}
      Clock : in std_ulogic;
      Reset : in std_ulogic;

      --# {{control|Named section}}
      Enable : in std_ulogic;
      Data_in : in std_ulogic_vector(SIZE-1 downto 0);
      Data_out : out std_ulogic_vector(SIZE-1 downto 0)
    );
  end component;
end package;

> symbolator -i demo_device.vhdl Scanning library: . Creating symbol for demo_device.vhdl "demo_device" -> demo_device-demo_device.svg

Produces the following:

image

Symbolator can render to PNG bitmap images or SVG, PDF, PS, and EPS vector images. SVG is the default.

Requirements

Symbolator requires either Python 2.7 or Python 3.x, Pycairo, and Pango.

The installation script depends on setuptools. The source is written in Python 2.7 syntax but will convert cleanly to Python 3 when the installer passes it through 2to3.

The Pango library is used compute the dimensions of a text layout. There is no standard package to get the Pango Python bindings installed. It is a part of the Gtk+ library which is accessed either through the PyGtk or PyGObject APIs, both of which are supported by Symbolator. You should make sure that one of these libraries is available before installing Symbolator. A Windows installer is available. For Linux distributions you should install the relevant libraries with your package manager.

Licensing

Symbolator is licensed for free commercial and non-commercial use under the terms of the MIT license. The Symbolator Sphinx extension is derived from the Graphviz extension and is BSD licensed.

Download

You can access the Symbolator Git repository from Github. You can install direct from PyPI with the "pip" command if you have it available.

Documentation

The full documentation is available online at the main Symbolator site.

symbolator's People

Contributors

kevinpt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

symbolator's Issues

symbolator sphinx failed to work

this line in file symbolator_sphinx.py cause an import error when trying to make a sphinx document site using symbolator plugin:

from sphinx.locale import _, __

everithing works fine if change to:

from sphinx.locale import _

Got this error while running symbolator on a verilog file

Is symbolator properly supported for verilog? I got the following error when I ran it on a .v file. I have tried out multiple output formats etc. but no joy.

./symbolator.py alu.v
Scanning library: .                                                                                                    
Creating symbol for alu.v "alu"
-> __alu.svg              
Traceback (most recent call last):
File "./symbolator.py", line 596, in <module>                                                                             
   main()                                                                                                                
File "./symbolator.py", line 591, in main                                                                                 
   sym.draw(0,0, nc)                                          
File "./symbolator.py", line 272, in draw                                                                                 
   sym_width = max(s.min_width(c, style.font) for sym in self.symbols for s in sym.sections)
File "./symbolator.py", line 272, in <genexpr>                                                                            
   sym_width = max(s.min_width(c, style.font) for sym in self.symbols for s in sym.sections)
File "./symbolator.py", line 158, in min_width                                                                            
   lmax = max(tw.text_width(c, font_params) for tw in self.left_pins)
File "./symbolator.py", line 158, in <genexpr>                                                                            
   lmax = max(tw.text_width(c, font_params) for tw in self.left_pins)
File "./symbolator.py", line 105, in text_width                                                                           
   x0, y0, x1, y1, baseline = c.surf.text_bbox(self.text, font_params)
File "/mnt/g/symbolator_files/symbolator/nucanvas/svg_backend.py", line 211, in text_bbox                                 
   return CairoSurface.cairo_text_bbox(text, font_params, spacing, self.scale)
File "/mnt/g/symbolator_files/symbolator/nucanvas/cairo_backend.py", line 122, in cairo_text_bbox
   layout = pangocairo.create_layout(ctx)
KeyError: 'could not find foreign type Context'
sumanth@LAPTOP-MFGQBV4B:/mnt/g/symbolator_files/symbolator$ ```

Verilog unpacked arrays not supported

Hi Kevin,

I have this module

module abc (
input clk;
input rst;
input [7:0] data[4];
output [7:0]
);
// Missing code doesn't change symbolator behaviour
endmodule

Symbolator generates this:

t-abc svg

So there seems to be a problem with unpacked arrays.

Best wishes and keep on rockin'!

Add support for "entity" as well?

Hello @kevinpt, this tool is great!

My project does not use components in packages, but instead only entity files. Would it be interesting for symbolator to support that? I can probably make the updates myself (to symbolator and hdlparse), but I thought I'd ask if you think it is a good idea before starting.

Best regards,
Lukas

pip install doesn't seem work?

Hi,
eager to try this tool but I can't get it to install. First of all it doesn't automatically install pycairo and pango dependencies? (hdlparse is installed fine though)

Then, if I install them, install symbolator and run the tool, I get the following error :

File "/home/${USER}/.local/lib/python3.7/site-packages/nucanvas/cairo_backend.py", line 13, in <module>
    import pango
ModuleNotFoundError: No module named 'pango'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./symbolator", line 11, in <module>
    load_entry_point('symbolator==1.0.2', 'console_scripts', 'symbolator')()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/${USER}/.local/lib/python3.7/site-packages/symbolator.py", line 10, in <module>
    from nucanvas.cairo_backend import CairoSurface
  File "/home/${USER}/.local/lib/python3.7/site-packages/nucanvas/cairo_backend.py", line 17, in <module>
    from gi.repository import Pango as pango
ModuleNotFoundError: No module named 'gi'

Further research brings me to the issue that I am missing "gi" package. When installing this package, pygobject I run into some other issues ...

Note that I am installing everything on python3 through pip install --user, not sure this has something to do with the issue, although I never had an issue so far ...

Get symbolator registered at awesome-vhdl

Hello Kevin,

as GitHub hosts so many awesome lists (Python, Ruby, ...), I thought, we should create a list for VHDL too.

I created awesome-vhdl.
Please create a pull request and get synbolator listed. You can also suggest to create or rename categories. When the number of listed VHDL projects increases, I'll create a PR for the awesome list itself (list of lists).

Looking forward to vote on your PR
Patrick

Installation error from pip3 on ubuntu

I am getting the following error when trying to install on ubuntu 22.04.
Install using pip (python2.7) works fine instead.

pip3 install --upgrade symbolator
Defaulting to user installation because normal site-packages is not writeable
Collecting symbolator
  Using cached symbolator-1.0.2.tar.gz (30 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in symbolator setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Library dependencies

Hi Kevinpt,

I installed symbolator on a Debian VM (latest version) with the "pip" command. Everything has been installed but I could not generate the SVG file.. This is surely the dependecy.

Could you be more precise on which library or packages, I should have installed on my OS?

Regards

symbolator not working with sphinx 4.x

Symbolator is not working with Sphinx 4.x.

>>> import symbolator_sphinx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/symbolator_sphinx/__init__.py", line 1, in <module>
    from .symbolator_sphinx import *
  File "/usr/local/lib/python3.8/site-packages/symbolator_sphinx/symbolator_sphinx.py", line 33, in <module>
    from sphinx.util.osutil import ensuredir, ENOENT, EPIPE, EINVAL
ImportError: cannot import name 'ENOENT' from 'sphinx.util.osutil' (/usr/local/lib/python3.8/site-packages/sphinx/util/osutil.py)

It should be possible to fix this error.

The line in: https://github.com/kevinpt/symbolator/blob/master/symbolator_sphinx/symbolator_sphinx.py#L33

must be changed to: from errno import ENOENT, EPIPE, EINVAL

missinglinkelectronics/sphinxcontrib-svg2pdfconverter@252a0b0

HDL parse is not good enough

I have encountered three situations that symbolator generates an unexpected symbol.

  • Instantiation of a module whose name contains input, such as input_buffer. Symbolator will render this as a port "_buffer".
  • Comments in a Verilog module's parameter declaration part “#()”. Symbolator will also render this as an unexpected parameter port.
  • Special name in parameter. For example, a parameter named clock_ratio. Symbolator will add a triangle symbol for it.

File path

Hello,

Im having problems with file path. It doesnt run:
symbolator -i /home/Repo/file.vhd
Only runs:
symbolator -i file.vhd

Thank you.

Unable to install the dependencies on windows

I have spent days trying to figure out how to get this thing working. I have python 2 and python 3 installed on windows.
I've also downloaded the latest GTK libraries. All I get when I run Symbolator from the command line is
no module named: 'cairo'
when I do pip install pycairo all I get is cairo.h : No such file or directory found although I can clearly find a cairo.h on using the search in the file manager (already tried adding cairo.h filepath to system path). I eventually gave up on windows and tried installing it on Ubuntu using WSL and although I was able to take care of the 'cairo' dependency somehow I'm still getting a no module named: 'pango'
I'm unable to find a pango in Pypi or anywhere else.

This is extremely frustrating. Please help me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.