Generate graphs from BLIF files
Project description
BLIF2GRAPH
Generates a graph from a BLIF (SIS) file.
Description
This library uses argparse to parse arguments:
If the --fsm
flag is passed to the program the blifparser library
parses the input file and blif2graph generates an FSM graph using graphviz.
You can also pass other arguments together with the --fsm
flag:
--input
: BLIF input file path (required)--style
: INI style config file path (you can use graphviz styles)--output
: Output file path (no extension)--format
: Set output graph format (default: svg)--view_graph
: View output graph (default: False)--debug
: View debug message (default: False)
The
--lgate
flag exists to be used to support logic gate graphs in the future: IT IS NOT CURRENTLY IMPLEMENTEDIf you'd like to contribute with a Pull Request, please do!
Requirements
- python 3
- graphviz: creates the FSM graph
- graphviz python library: "connects" python to graphviz
- blifparser python library: parses BLIF files
Installation
Install using pip:
pip install blif2graph
Usage
You can use it from the command line:
# generates an FSM graph, fsm.blif input, fsmgraph.pdf output, view result using the default PDF viewer software at the end
python3 blif2graph.py --fsm --input fsm.blif --output fsmgraph --format pdf --view_graph
# generates an FSM graph, myfsm.blif input, default fsm.svg output, custom graphviz style, view result using the default SVG viewer software at the end
python3 blif2graph.py --fsm --input myfsm.blif --style mystyles.ini --view_graph
Example of an FSM custom style file:
[graph]
fontsize = 16
fontcolor = black
fontname = Times-Roman
rankdir = TB # TB: top to bottom (inverse: BT), LR: left to right (inverse: RL)
splines = true
overlap = false
size = 8,5
bgcolor = transparent
center = true
charset = UTF-8
colorscheme =
concentrate = false # true: concentrate arrows together in one line until a certain point
dpi = 96.0
[edges]
fontsize = 16
arrowsize = .5
arrowhead = normal
arrowtail = normal
color = gray31
fillcolor = black
fontcolor = black
fontname = Times-Roman
colorscheme =
constraint = true
decorate = true
dir = forward
penwidth = 1.0
[nodes]
fontsize = 16
colorscheme =
color = black
fillcolor = black
fontcolor = black
fontname = Times-Roman
penwidth = 2.0
You can also import the script and call the main() function passing a list of arguments:
import blif2graph
params = " --fsm --input ..\\myfsm.blif --format pdf --view_graph "
params = [param for param in params.split(" ") if param.strip() != ""]
blif2graph.main(params)
Changelog
2021-09-10 1.0.0:
First commit
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file blif2graph-1.0.0.tar.gz
.
File metadata
- Download URL: blif2graph-1.0.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b64a278c33971a219abbf2446373097191dbf6771379d00b4bb47d27432934ed |
|
MD5 | 543188f7ca07fef144c03a25f76895ca |
|
BLAKE2b-256 | bc28705c24a518c61390c8d4447faf5eca8fec7237ee03c9eae924c89b230c9c |
File details
Details for the file blif2graph-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: blif2graph-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bcbada2f7806ad98a84eabbbd5441eea72ddef78ea4a2243e9774f5f5bec845 |
|
MD5 | 2016c6f59fcd466188f30f55a8580a08 |
|
BLAKE2b-256 | 912475e022ab3aab7f018391a0ee08f71638602760e8455c2f0ef9cf0c7d716a |