# [BinPy](http://binpy.github.io/)
[![Build Status](https://travis-ci.org/BinPy/BinPy.png?branch=develop)](https://travis-ci.org/BinPy/BinPy)
[![Code Health](https://landscape.io/github/BinPy/BinPy/develop/landscape.svg?style=flat)](https://landscape.io/github/BinPy/BinPy/develop)
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/binpy/binpy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
* [About](#what-is-binpy)
* [Installation](#installation)
* [Documentation](#documentation)
* [Contribute](#contribute-to-binpy)
<a id="about"></a>
What is BinPy?
---------------
BinPy 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.
BinPy focusses on the fundamentals. Everything has been written from scratch such as gates, logical operations, etc.
Our 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.
How to use
----------
Here's an example of SR latch constructed from a pair of cross-coupled NOR gates
[ Image of SR Latch taken from Wikipedia ]
![SR latch | Source: Wikipedia =200px](https://upload.wikimedia.org/wikipedia/commons/c/c6/R-S_mk2.gif)
[ BinPy Code to Simulate an SR Latch ]
```python
from __future__ import print_function
from BinPy import *
# Connector to connect output of second NOR gate with input of first NOR gate
con1 = Connector()
# Connector to connect output of first NOR gate with input of second NOR gate
con2 = Connector()
R = 0 # Reset input for the SR-Latch
S = 0 # Set input for the SR-Lacth
NOR1 = NOR(con1, R) # First NOR gate
NOR1.setOutput(con2) # Set output for NOR gate
NOR2 = NOR(con2, S) # Second NOR gate
NOR2.setOutput(con1) # Set output for NOR gate
NOR1.setInput(1, 1)
NOR2.setInput(1, 0) # Set state
print('Q: ', NOR2.output(), '\t', 'Q\': ', NOR1.output())
NOR1.setInput(1, 0)
NOR2.setInput(1, 1) # Reset state
print('Q: ', NOR2.output(), '\t', 'Q\': ', NOR1.output())
NOR1.setInput(1, 0)
NOR2.setInput(1, 0) # Hold state
print('Q: ', NOR2.output(), '\t', 'Q\': ', NOR1.output())
NOR1.setInput(1, 1)
NOR2.setInput(1, 1) # Invalid state
print('Q: ', NOR2.output(), '\t', 'Q\': ', NOR1.output())
```
<strong>Output</strong>
```python
Q: 1 Q': 0
Q: 0 Q': 1
Q: 0 Q': 1
Q: 0 Q': 0 #Invalid State
```
<strong>Operations, Combinatonal Logic and Algorithms</strong>
```python
from BinPy import *
# Operations
operator = Operations()
operator.ADD(1011,11)
operator.SUB(1011,11)
operator.COMP('0011',1) #Second argument chooses betweem 1's or 2's Compliment
# Combinational Logic
m = MUX(1,1,0,1)
m.selectLines(0,1)
print "MUX Out: ", m.output()
d = DEMUX()
d.selectLines(0,1)
print "DEMUX Out: ", d.output()
d = Decoder(0,1)
print "Decoder Out: ", d.output()
e = Encoder(0,1,0,0)
print "Encoder Out: ", e.output()
# Sequential Circuits
a = DFlipFlop(1,0)
print "DFlipFlop Out: ", a.output()
# IC
myIC = IC_7400()
p = {1:1,2:0,4:0,5:0,7:0,10:1,9:1,13:0,12:0,14:1}
myIC.setIC(p)
print "IC_7400 Out: ", myIC.run()
myIC1 = IC_7401()
p = {2:0,3:1,5:0,6:0,7:0,8:1,9:1,11:0,12:0,14:1}
myIC1.setIC(p)
print "IC_7401 Out: ", myIC1.run()
# Algorithms
# Includes the Quine-McCluskey algorithm for solving K-Maps
FinalEquation = QM(['A','B'])
print "Minimized Boolean Equation : " , FinalEquation.get_function(qm.solve([0,1,2],[])[1])
```
<strong>Output</strong><br/>
```python
{'carry': 0, 'sum': [1, 1, 1, 0]}
{'carry': 1, 'difference': [1, 0, 0, 0]}
MUX Out: 1
DEMUX Out: [0, 0, 0, 0]
Decoder Out: [0, 1, 0, 0]
Encoder Out: [0, 1]
DFlipFlop Out: [1,0]
IC_7400 Out: {8: 0, 11: 1, 3: 1, 6: 1}
IC_7401 Out: {1: 1, 10: 0, 4: 1, 13: 1}
Minimized Boolean Equation : ((NOT B) OR (NOT A))
```
BinPy also comes with a console that is a simple wrapper around the classic python console from which you can directly use the BinPy Resources.
To start it, simply issue ```$ binpy``` if BinPy is installed in your path.
<a id="documentation"></a>
Documentation
-------------
Auto-generated documentation is available for reference at [BinPy docs](http://binpy.readthedocs.org/en/latest/)
<a id="wiki"></a>
Wiki
----
Check 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.
<a id="installation"></a>
Installation
------------
## Linux
###Install with pip
#####Python2
######PIP and setuptools
```sh
sudo apt-get install python-pip
sudo pip install --upgrade setuptools
```
######BinPy
```sh
sudo pip install https://github.com/BinPy/BinPy/zipball/master
```
######IPython Notebook
```sh
sudo pip install --upgrade ipython[all]
```
#####Python3
######PIP and setuptools
```sh
sudo apt-get install python3-pip
sudo pip3 install --upgrade setuptools
```
######BinPy
```sh
sudo pip3 install https://github.com/BinPy/BinPy/zipball/master
```
######IPython Notebook
```sh
sudo pip3 install --upgrade ipython[all]
```
#####Install `autopep8` Tool to ensure your contributions pass the `pep8` test.
```sh
sudo pip install --upgrade autopep8
```
###Install BinPy using git
#####Python2
```sh
sudo apt-get install git setuptools
git clone https://github.com/BinPy/BinPy.git
cd BinPy/
sudo python setup.py install
```
#####Python3
```sh
sudo apt-get install git python3-pip
sudo pip3 install --upgrade setuptools
git clone https://github.com/BinPy/BinPy.git
cd BinPy/
sudo python3 setup.py install
```
####
Future Work
------------
* Introduction of all ICs
* Introduction of problem solving algorithms
* Addition of Microprocessors and Analog Devices
* Graphical representation of the circuit
Visit 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.
<a id="contribute"></a>
Contribute to BinPy
-------------------
For 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).
- [Report Bugs and Issues](https://github.com/BinPy/BinPy/issues)
- [Solve Bugs and Issues](https://github.com/BinPy/BinPy/issues?page=1&state=open)
- Write Tutorials, Examples and Documentation
__DEV NOTE:__
- It is expected that your code must follow [pep8](https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCkQFjAA&url=https%3A%2F%2Fwww.python.org%2Fdev%2Fpeps%2Fpep-0008&ei=4SxIU4LWJ4mzrAfEyoHgBg&usg=AFQjCNGUTp-Bavhz439Hr22L2HoxWDeNGg&sig2=dep_DZ8B918mWzzvX8KUYQ) standards. To conform to the same please install `autopep8` tool following the instructions in the [installation section](#installation).
- 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
`autopep8 -r -i -a -a -v .`
To learn more about the `autopep8` tool visit [here](https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCkQFjAA&url=https%3A%2F%2Fpypi.python.org%2Fpypi%2Fautopep8%2F&ei=SjFIU7jkIcWKrQfE5oDgBQ&usg=AFQjCNGP0o38e1Ia6S7_TfsDIJrvgdGAug&sig2=Yp4VZe9UepdYtoCF_mcBFg).
- Ensure that all the tests pass by running `nosetests; nosetests3` in `BinPy\BinPy\tests`
没有合适的资源?快使用搜索试试~ 我知道了~
纯Python编写的电子仿真库___下载.zip
共432个文件
py:188个
rst:109个
ipynb:108个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 82 浏览量
2023-04-16
20:01:28
上传
评论
收藏 552KB ZIP 举报
温馨提示
纯Python编写的电子仿真库___下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
纯Python编写的电子仿真库___下载.zip (432个子文件)
AUTHORS 1KB
make.bat 7KB
theme.conf 69B
.coveragerc 142B
solar.css 6KB
solarized-dark.css 4KB
SR_LATCH.gif 30KB
.gitattributes 20B
.gitignore 388B
layout.html 1KB
MANIFEST.in 17B
Analog Signal Generators.ipynb 36KB
NBitDownCounter.ipynb 17KB
DecadeCounter.ipynb 17KB
Stage14Counter.ipynb 16KB
OctalCounter.ipynb 16KB
NBitRippleCounter.ipynb 16KB
SRLatch.ipynb 16KB
JKFlipFlop.ipynb 15KB
TFlipFlop.ipynb 15KB
DFlipFlop.ipynb 13KB
BinaryCounter.ipynb 12KB
IC7402.ipynb 11KB
IC7400.ipynb 11KB
IC74153.ipynb 11KB
IC7403.ipynb 11KB
IC7412.ipynb 11KB
IC7415.ipynb 11KB
IC7408.ipynb 11KB
IC7410.ipynb 11KB
IC7404.ipynb 11KB
IC7413.ipynb 11KB
IC74151A.ipynb 10KB
IC7444.ipynb 10KB
IC74156.ipynb 10KB
IC7443.ipynb 10KB
IC7445.ipynb 10KB
IC7442.ipynb 10KB
IC74139.ipynb 10KB
IC74138.ipynb 10KB
IC7431.ipynb 10KB
IC74152.ipynb 10KB
IC7451.ipynb 9KB
IC4077.ipynb 9KB
IC7458.ipynb 9KB
IC4011.ipynb 9KB
IC4071.ipynb 9KB
IC4070.ipynb 9KB
IC4081.ipynb 9KB
IC4023.ipynb 9KB
IC4075.ipynb 9KB
IC4073.ipynb 9KB
IC4025.ipynb 9KB
IC4000.ipynb 9KB
IC4078.ipynb 9KB
IC4072.ipynb 9KB
IC4012.ipynb 9KB
IC4002.ipynb 9KB
IC4082.ipynb 9KB
IC7419.ipynb 9KB
IC4001.ipynb 9KB
IC7418.ipynb 9KB
IC7416.ipynb 9KB
IC4068.ipynb 9KB
IC7424.ipynb 9KB
IC7405.ipynb 9KB
IC7426.ipynb 9KB
IC7428.ipynb 9KB
IC7437.ipynb 9KB
IC7401.ipynb 9KB
IC7433.ipynb 9KB
IC7486.ipynb 9KB
IC7422.ipynb 9KB
IC7425.ipynb 9KB
IC7432.ipynb 9KB
IC7427.ipynb 9KB
IC7454.ipynb 9KB
IC7455.ipynb 9KB
IC7440.ipynb 9KB
IC7420.ipynb 9KB
IC7421.ipynb 9KB
IC7430.ipynb 9KB
IC7464.ipynb 9KB
JohnsonCounter.ipynb 8KB
Linker.ipynb 8KB
multivibrator_mode3.ipynb 7KB
Bus.ipynb 7KB
multivibrator_mode2.ipynb 6KB
RingCounter.ipynb 6KB
multivibrator_mode1.ipynb 6KB
Subtractors.ipynb 6KB
Analog Converters.ipynb 6KB
expression_convert_example.ipynb 6KB
bittools.ipynb 6KB
Adders.ipynb 6KB
Connector.ipynb 5KB
XNOR.ipynb 5KB
PowerSupply.ipynb 4KB
FourBitLoadRegister.ipynb 4KB
XOR.ipynb 4KB
共 432 条
- 1
- 2
- 3
- 4
- 5
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功