All Projects → BinPy → Binpy

BinPy / Binpy

Licence: other
An electronic simulation library written in pure Python

Projects that are alternatives of or similar to Binpy

Auto Reid And Others
Auto-ReID and Other Person Re-Identification Projects
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Go Tflite
Go binding for TensorFlow Lite
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Pysonar
Decentralized Machine Learning Client
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Datacollect
A collection of tools to collect and download various data.
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Nas fpn tensorflow
NAS-FPN: Learning Scalable Feature Pyramid Architecture for Object Detection.
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Trading Gym
This trading-gym is the first trading for agent to train with episode of short term trading itself.
Stars: ✭ 194 (-2.51%)
Mutual labels:  jupyter-notebook
Up Down Captioner
Automatic image captioning model based on Caffe, using features from bottom-up attention.
Stars: ✭ 195 (-2.01%)
Mutual labels:  jupyter-notebook
Rl Adventure
Pytorch Implementation of DQN / DDQN / Prioritized replay/ noisy networks/ distributional values/ Rainbow/ hierarchical RL
Stars: ✭ 2,505 (+1158.79%)
Mutual labels:  jupyter-notebook
Python For Finance Cookbook
Python for Finance Cookbook, published by Packt
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Datascience
책) 파이썬으로 데이터 주무르기 - 소스코드 및 데이터 공개
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Graph Notebook
Library extending Jupyter notebooks to integrate with Apache TinkerPop and RDF SPARQL.
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Pytorch Geometric Yoochoose
This is a tutorial for PyTorch Geometric on the YooChoose dataset
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Radio
RadIO is a library for data science research of computed tomography imaging
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Bilateral solver
Python code for the fast bilateral solver
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Food2vec
🍔
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Integratedgradients
Python/Keras implementation of integrated gradients presented in "Axiomatic Attribution for Deep Networks" for explaining any model defined in Keras framework.
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Ml Lessons
Intro to deep learning for medical imaging lesson, by MD.ai
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Basset
Convolutional neural network analysis for predicting DNA sequence activity.
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Neuralnetworks.thought Experiments
Observations and notes to understand the workings of neural network models and other thought experiments using Tensorflow
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Mgcnn
Multi-Graph Convolutional Neural Networks
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook

BinPy

Build Status Code Health ![Gitter](https://badges.gitter.im/Join Chat.svg)

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

[ BinPy Code to Simulate an SR Latch ]

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())


Output

Q:  1 	Q':  0
Q:  0 	Q':  1
Q:  0 	Q':  1
Q:  0 	Q':  0	#Invalid State

Operations, Combinatonal Logic and Algorithms

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])

Output

{'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.

Documentation

Auto-generated documentation is available for reference at BinPy docs

Wiki

Check out the BinPy Wiki page for a complete summary of BinPy, The Development workflow, Downloading and Installation guide, Tutorials, Technical References and Much more.

Installation

Linux

###Install with pip

#####Python2

######PIP and setuptools

sudo apt-get install python-pip
sudo pip install --upgrade setuptools

######BinPy

sudo pip install https://github.com/BinPy/BinPy/zipball/master

######IPython Notebook

sudo pip install --upgrade ipython[all]

#####Python3

######PIP and setuptools

sudo apt-get install python3-pip
sudo pip3 install --upgrade setuptools

######BinPy

sudo pip3 install https://github.com/BinPy/BinPy/zipball/master

######IPython Notebook

sudo pip3 install --upgrade ipython[all]

#####Install autopep8 Tool to ensure your contributions pass the pep8 test.

sudo pip install --upgrade autopep8

###Install BinPy using git

#####Python2

sudo apt-get install git setuptools
git clone https://github.com/BinPy/BinPy.git
cd BinPy/
sudo python setup.py install

#####Python3

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 and ideas page in Wiki to know more.

Contribute to BinPy

For a detailed summary of all the coding guidelines and development workflow, visit our Wiki page.

DEV NOTE:

  • It is expected that your code must follow pep8 standards. To conform to the same please install autopep8 tool following the instructions in the installation section.

  • 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.

  • Ensure that all the tests pass by running nosetests; nosetests3 in BinPy\BinPy\tests directory.

  • To check for the pep8 indentation status issue the following command

    pep8 ./ --ignore=E501

If 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.

Bitdeli Badge

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].