{"id":13772916,"url":"https://github.com/circuitgraph/circuitgraph","last_synced_at":"2025-05-11T05:34:09.166Z","repository":{"id":54385113,"uuid":"279113859","full_name":"circuitgraph/circuitgraph","owner":"circuitgraph","description":"Tools for working with circuits as graphs in python","archived":false,"fork":false,"pushed_at":"2023-11-17T07:27:49.000Z","size":11046,"stargazers_count":115,"open_issues_count":13,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-03T05:01:59.699Z","etag":null,"topics":["boolean-circuits","eda","graphs","netlist","python","satisfiability"],"latest_commit_sha":null,"homepage":"https://circuitgraph.github.io/circuitgraph/","language":"Verilog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/circuitgraph.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-12T17:26:35.000Z","updated_at":"2025-04-11T17:12:36.000Z","dependencies_parsed_at":"2024-01-15T05:09:41.947Z","dependency_job_id":"98763ae8-71ca-450c-b040-b57d450487e5","html_url":"https://github.com/circuitgraph/circuitgraph","commit_stats":{"total_commits":218,"total_committers":7,"mean_commits":"31.142857142857142","dds":0.6376146788990826,"last_synced_commit":"c801a4f9d9f94dc09d32e231f0b0a05643909b12"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circuitgraph%2Fcircuitgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circuitgraph%2Fcircuitgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circuitgraph%2Fcircuitgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circuitgraph%2Fcircuitgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/circuitgraph","download_url":"https://codeload.github.com/circuitgraph/circuitgraph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253523690,"owners_count":21921815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boolean-circuits","eda","graphs","netlist","python","satisfiability"],"created_at":"2024-08-03T17:01:09.157Z","updated_at":"2025-05-11T05:34:06.947Z","avatar_url":"https://github.com/circuitgraph.png","language":"Verilog","funding_links":[],"categories":["Circuit Compilers","Verilog"],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/circuitgraph/circuitgraph/master/docs/circuitgraph.png\" width=\"300\"\u003e\n\n# CircuitGraph\n\n[![Python package](https://github.com/circuitgraph/circuitgraph/actions/workflows/python-package.yml/badge.svg)](https://github.com/circuitgraph/circuitgraph/actions/workflows/python-package.yml)\n[![codecov](https://codecov.io/gh/circuitgraph/circuitgraph/branch/master/graph/badge.svg?token=26ZX0HILB2)](https://codecov.io/gh/circuitgraph/circuitgraph)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n\n[**CircuitGraph**](https://circuitgraph.github.io/circuitgraph/) is a library for working with hardware designs as graphs. CircuitGraph provides an interface to do this built on [NetworkX](https://networkx.github.io), along with integrations with other useful tools such as sat solvers and the [Yosys](http://www.clifford.at/yosys/) synthesis tool, and input/output to verilog.\n\n## Overview\n\nThe `Circuit` class is at the core of the library and it is essentially a wrapper around a [NetworkX](https://networkx.github.io) graph object. This graph is accessable through the `graph` member variable of `Circuit` and can be used as an entrypoint to the robust NetworkX API.\n\nHere's a simple example of reading in a verilog file, adding a node to the graph, and writing back to a new file.\n\n```python\nimport circuitgraph as cg\n\nc = cg.from_file('/path/to/circuit.v')\n# Add an AND gate to the circuit that takes as input nets o0, o1, o2, o3\nc.add('g', 'and', fanin=[f'o{i}' for i in range(4)])\ncg.to_file(c, '/path/to/output/circuit.v')\n```\n\nThe documentation can be found [here](https://circuitgraph.github.io/circuitgraph/).\n\n## Installation\n\nCircuitGraph requires Python3.7 or greater\nThe easiest way to install is via PyPi:\n```shell\npip install circuitgraph\n```\nTo install from the release, download and:\n```shell\npip install circuitgraph-\u003crelease\u003e.tar.gz\n```\n\nFinally, to install in-place with the source, use:\n```shell\ncd \u003cinstall location\u003e\ngit clone https://github.com/circuitgraph/circuitgraph.git\ncd circuitgraph\npip install -r requirements.txt\npip install -e .\n```\n### Optional Packages\n\nIn addition to the packages enumerated in `requirements.txt`, there are a few tools you can install to enable additional functionality.\n\nIf you would like to use the satisfiability functionality, install [PySAT](https://pysathq.github.io).\n\nOpen source synthesis can be perofmred by installing [Yosys](http://www.clifford.at/yosys/) and adding it to your path.\nAlternatively, Genus or DesignCompiler can be used by providing the path to a generic library to use by setting the `CIRCUITGRAPH_GENUS_LIBRARY_PATH` and `CIRCUITGRAPH_DC_LIBRARY_PATH` environment variables.\n\n## Contributing\n\nIf you have ideas on how to improve this library we'd love to hear your suggestions. Please open an issue.\nIf you want to develop the improvement yourself, please consider the information below.\n\nCoverage is computed using [Codecov](https://codecov.io).\n If you would like to generate coverage information locally, install coverage and codecov.\n```shell\npip install coverage codecov\nmake coverage\n```\n\nDocumentation is built using pdoc3.\n```shell\npip install pdoc3\nmake doc\n```\n\nTests are run using the builtin unittest framework. Some basic linting is performed using flake8.\n```shell\npip instsall flake8\nmake test\n```\n\nCode should be formatted using [black](https://black.readthedocs.io/en/stable/).\n[Pre-commit](https://pre-commit.com) is used to automatically run black on commit.\n```shell\npip install black pre-commit\npre-commit install\n```\nPre-commit also runs a few other hooks, including a docstring formatter and linter. Docs follow the `numpy` documentation convention.\n\n## Citation\n\nIf you use this software for your research, we ask you cite this publication:\nhttps://joss.theoj.org/papers/10.21105/joss.02646\n\n```\n@article{sweeney2020circuitgraph,\n  title={CircuitGraph: A Python package for Boolean circuits},\n  author={Sweeney, Joseph and Purdy, Ruben and Blanton, Ronald D and Pileggi, Lawrence},\n  journal={Journal of Open Source Software},\n  volume={5},\n  number={56},\n  pages={2646},\n  year={2020}\n}\n```\n\n## Acknowledgements\n\nCircuitgraph icon designed by [ncasti](https://github.com/ncasti).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircuitgraph%2Fcircuitgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcircuitgraph%2Fcircuitgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircuitgraph%2Fcircuitgraph/lists"}