{"id":13813294,"url":"https://github.com/BinPy/BinPy","last_synced_at":"2025-05-15T00:32:38.352Z","repository":{"id":10470281,"uuid":"12645366","full_name":"BinPy/BinPy","owner":"BinPy","description":"An electronic simulation library written in pure Python","archived":false,"fork":false,"pushed_at":"2021-07-26T20:28:56.000Z","size":2156,"stargazers_count":204,"open_issues_count":18,"forks_count":78,"subscribers_count":17,"default_branch":"develop","last_synced_at":"2024-09-09T22:38:12.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://binpy.github.io/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BinPy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-06T13:59:49.000Z","updated_at":"2024-08-15T16:50:06.000Z","dependencies_parsed_at":"2022-09-11T17:54:05.164Z","dependency_job_id":null,"html_url":"https://github.com/BinPy/BinPy","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinPy%2FBinPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinPy%2FBinPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinPy%2FBinPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinPy%2FBinPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BinPy","download_url":"https://codeload.github.com/BinPy/BinPy/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225319206,"owners_count":17455724,"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":[],"created_at":"2024-08-04T04:01:11.791Z","updated_at":"2024-11-19T08:30:20.449Z","avatar_url":"https://github.com/BinPy.png","language":"Jupyter Notebook","readme":"# [BinPy](http://binpy.github.io/)\n\n[![Build Status](https://travis-ci.org/BinPy/BinPy.png?branch=develop)](https://travis-ci.org/BinPy/BinPy)\n[![Code Health](https://landscape.io/github/BinPy/BinPy/develop/landscape.svg?style=flat)](https://landscape.io/github/BinPy/BinPy/develop)\n[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/binpy/binpy?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n * [About](#what-is-binpy)\n * [Installation](#installation)\n * [Documentation](#documentation)\n * [Contribute](#contribute-to-binpy)\n\n\n\u003ca id=\"about\"\u003e\u003c/a\u003e\nWhat is BinPy?\n---------------\nBinPy is a digital electronics simulation library with a bunch of digital devices ( and a few experimental analog devices ) and tools / algorithms under its hood. BinPy is aimed towards students, helping them learn about digital logic in an interactive way. Being an open source project makes it easier for one to get an indepth understanding of the the underlying concepts by glossing at the source.\n\nBinPy focusses on the fundamentals. Everything has been written from scratch such as gates, logical operations, etc. \n\nOur future goals include a GUI tool to help easily build simple digital circuts and the implementation of the core using SPICE or equivalent tools for precise simulations.\n\nHow to use\n----------\n\nHere's an example of SR latch constructed from a pair of cross-coupled NOR gates\n\n[ Image of SR Latch taken from Wikipedia ]\n\n![SR latch | Source: Wikipedia =200px](https://upload.wikimedia.org/wikipedia/commons/c/c6/R-S_mk2.gif)\n\n[ BinPy Code to Simulate an SR Latch ]\n\n```python\n\nfrom __future__ import print_function\nfrom BinPy import *\n\n# Connector to connect output of second NOR gate with input of first NOR gate\ncon1 = Connector()\n# Connector to connect output of first NOR gate with input of second NOR gate\ncon2 = Connector()\n\nR = 0  # Reset input for the SR-Latch\nS = 0  # Set input for the SR-Lacth\n\nNOR1 = NOR(con1, R)  # First NOR gate\nNOR1.setOutput(con2)  # Set output for NOR gate\n\nNOR2 = NOR(con2, S)  # Second NOR gate\nNOR2.setOutput(con1)  # Set output for NOR gate\n\n\nNOR1.setInput(1, 1)\nNOR2.setInput(1, 0)  # Set state\nprint('Q: ', NOR2.output(), '\\t', 'Q\\': ', NOR1.output())\n\n\nNOR1.setInput(1, 0)\nNOR2.setInput(1, 1)  # Reset state\nprint('Q: ', NOR2.output(), '\\t', 'Q\\': ', NOR1.output())\n\n\nNOR1.setInput(1, 0)\nNOR2.setInput(1, 0)  # Hold state\nprint('Q: ', NOR2.output(), '\\t', 'Q\\': ', NOR1.output())\n\n\nNOR1.setInput(1, 1)\nNOR2.setInput(1, 1)  # Invalid state\nprint('Q: ', NOR2.output(), '\\t', 'Q\\': ', NOR1.output())\n\n\n```\n\u003cstrong\u003eOutput\u003c/strong\u003e\n```python\nQ:  1 \tQ':  0\nQ:  0 \tQ':  1\nQ:  0 \tQ':  1\nQ:  0 \tQ':  0\t#Invalid State\n```\n\n\u003cstrong\u003eOperations, Combinatonal Logic and Algorithms\u003c/strong\u003e\n\n```python\nfrom BinPy import *\n\n# Operations\noperator = Operations()\noperator.ADD(1011,11)\noperator.SUB(1011,11)\noperator.COMP('0011',1) #Second argument chooses betweem 1's or 2's Compliment\n\n\n# Combinational Logic\nm = MUX(1,1,0,1)\nm.selectLines(0,1)\nprint \"MUX Out: \", m.output()\n\nd = DEMUX()\nd.selectLines(0,1)\nprint \"DEMUX Out: \", d.output()\n\nd = Decoder(0,1)\nprint \"Decoder Out: \", d.output()\n\ne = Encoder(0,1,0,0)\nprint \"Encoder Out: \", e.output()\n\n# Sequential Circuits\na = DFlipFlop(1,0)\nprint \"DFlipFlop Out: \", a.output()\n\n# IC\nmyIC = IC_7400()\np = {1:1,2:0,4:0,5:0,7:0,10:1,9:1,13:0,12:0,14:1}\nmyIC.setIC(p)\nprint \"IC_7400 Out: \", myIC.run()\n\nmyIC1 = IC_7401()\np = {2:0,3:1,5:0,6:0,7:0,8:1,9:1,11:0,12:0,14:1}\nmyIC1.setIC(p)\nprint \"IC_7401 Out: \", myIC1.run()\n\n# Algorithms\n# Includes the Quine-McCluskey algorithm for solving K-Maps\nFinalEquation = QM(['A','B'])\nprint \"Minimized Boolean Equation : \" , FinalEquation.get_function(qm.solve([0,1,2],[])[1])\n```\n\n\u003cstrong\u003eOutput\u003c/strong\u003e\u003cbr/\u003e\n```python\n{'carry': 0, 'sum': [1, 1, 1, 0]}\n{'carry': 1, 'difference': [1, 0, 0, 0]}\nMUX Out: 1\nDEMUX Out: [0, 0, 0, 0]\nDecoder Out:  [0, 1, 0, 0]\nEncoder Out: [0, 1]\nDFlipFlop Out: [1,0]\nIC_7400 Out:  {8: 0, 11: 1, 3: 1, 6: 1}\nIC_7401 Out:  {1: 1, 10: 0, 4: 1, 13: 1}\nMinimized Boolean Equation : ((NOT B) OR (NOT A))\n```\nBinPy also comes with a console that is a simple  wrapper around the classic python console from which you can directly use the BinPy Resources.\n\nTo start it, simply issue ```$ binpy``` if BinPy is installed in your path.\n\n\u003ca id=\"documentation\"\u003e\u003c/a\u003e\nDocumentation\n-------------\nAuto-generated documentation is available for reference at [BinPy docs](http://binpy.readthedocs.org/en/latest/)\n\n\u003ca id=\"wiki\"\u003e\u003c/a\u003e\nWiki\n----\nCheck out the BinPy [Wiki page](http://github.com/BinPy/BinPy/wiki) for a complete summary of BinPy, [The Development workflow](https://github.com/BinPy/BinPy/wiki/Development-workflow), [Downloading and Installation guide](https://github.com/BinPy/BinPy/wiki/Download-Installation), [Tutorials](https://github.com/BinPy/BinPy/wiki/tutorial), [Technical References](https://github.com/BinPy/BinPy/wiki/Technical-References) and Much more.\n\n\u003ca id=\"installation\"\u003e\u003c/a\u003e\nInstallation\n------------\n\n## Linux\n\n###Install with pip\n\n#####Python2\n\n######PIP and setuptools\n\n```sh\nsudo apt-get install python-pip\nsudo pip install --upgrade setuptools\n```\n\n######BinPy\n\n```sh\nsudo pip install https://github.com/BinPy/BinPy/zipball/master\n```\n\n######IPython Notebook\n\n```sh\nsudo pip install --upgrade ipython[all]\n```\n\n#####Python3\n\n######PIP and setuptools\n\n```sh\nsudo apt-get install python3-pip\nsudo pip3 install --upgrade setuptools\n```\n\n######BinPy\n\n```sh\nsudo pip3 install https://github.com/BinPy/BinPy/zipball/master\n```\n\n######IPython Notebook\n\n```sh\nsudo pip3 install --upgrade ipython[all]\n```\n\n#####Install `autopep8` Tool to ensure your contributions pass the `pep8` test.\n\n```sh\nsudo pip install --upgrade autopep8\n```\n\n###Install BinPy using git\n\n#####Python2\n\n```sh\nsudo apt-get install git setuptools\ngit clone https://github.com/BinPy/BinPy.git\ncd BinPy/\nsudo python setup.py install\n```\n\n#####Python3\n\n```sh\nsudo apt-get install git python3-pip\nsudo pip3 install --upgrade setuptools\ngit clone https://github.com/BinPy/BinPy.git\ncd BinPy/\nsudo python3 setup.py install\n```\n\n####\n\nFuture Work\n------------\n\n* Introduction of all ICs\n* Introduction of problem solving algorithms\n* Addition of Microprocessors and Analog Devices\n* Graphical representation of the circuit\n\n\nVisit our [roadmap](https://github.com/BinPy/BinPy/wiki/roadmap) and [ideas page](https://github.com/BinPy/BinPy/wiki/ideas) in [Wiki](http://github.com/BinPy/BinPy/wiki) to know more.\n\n\u003ca id=\"contribute\"\u003e\u003c/a\u003e\n\nContribute to BinPy\n-------------------\n\nFor a detailed summary of all the coding guidelines and [development workflow](https://github.com/BinPy/BinPy/wiki/Development-workflow), visit our [Wiki page](http://github.com/BinPy/BinPy/wiki).\n\n - [Report Bugs and Issues](https://github.com/BinPy/BinPy/issues)\n - [Solve Bugs and Issues](https://github.com/BinPy/BinPy/issues?page=1\u0026state=open)\n - Write Tutorials, Examples and Documentation\n\n__DEV NOTE:__\n\n - It is expected that your code must follow [pep8](https://www.google.co.in/url?sa=t\u0026rct=j\u0026q=\u0026esrc=s\u0026source=web\u0026cd=1\u0026cad=rja\u0026uact=8\u0026ved=0CCkQFjAA\u0026url=https%3A%2F%2Fwww.python.org%2Fdev%2Fpeps%2Fpep-0008\u0026ei=4SxIU4LWJ4mzrAfEyoHgBg\u0026usg=AFQjCNGUTp-Bavhz439Hr22L2HoxWDeNGg\u0026sig2=dep_DZ8B918mWzzvX8KUYQ) standards. To conform to the same please install `autopep8` tool following the instructions in the [installation section](#installation).\n \n - After installation is complete. Make the necessary changes and commit your changes. After Committing your changes, `cd` to the BinPy root directory and issue the following command\n\n   `autopep8 -r -i -a -a -v .`\n   \n   To learn more about the `autopep8` tool visit [here](https://www.google.co.in/url?sa=t\u0026rct=j\u0026q=\u0026esrc=s\u0026source=web\u0026cd=1\u0026cad=rja\u0026uact=8\u0026ved=0CCkQFjAA\u0026url=https%3A%2F%2Fpypi.python.org%2Fpypi%2Fautopep8%2F\u0026ei=SjFIU7jkIcWKrQfE5oDgBQ\u0026usg=AFQjCNGP0o38e1Ia6S7_TfsDIJrvgdGAug\u0026sig2=Yp4VZe9UepdYtoCF_mcBFg).\n\n - Ensure that all the tests pass by running `nosetests; nosetests3` in `BinPy\\BinPy\\tests` directory.\n\n - To check for the pep8 indentation status issue the following command\n \n   `pep8 ./ --ignore=E501`\n\nIf all the tests pass successfully push your repo to the origin/branch and send us a Pull Request. We'll be happy to review the same and merge it with our codebase.\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mrsud/binpy/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","funding_links":[],"categories":["Jupyter Notebook","工具分类"],"sub_categories":["数字电路/逻辑门模拟器"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBinPy%2FBinPy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBinPy%2FBinPy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBinPy%2FBinPy/lists"}