BinPy/BinPy — pull request #46 by salil93 (2014-02-17 16:44:08+00:00)
Title: Logic Gates reimplemented

Refactored the entire Logic Gates code.

New Logic Gates classes have been written compatible with a new Connector class.

New Logic Gates are not restricted to just two inputs. They can be used both in a circuit and stand alone too. I guess by this we can avoid having two different implementations of logic gates.

Connector class is like the wire variable in verilog. Different logic gates can now tap onto any Connector class object.

The implementation is trigger based. As soon as there is a change in any one of the inputs of the gates, it triggers the other gates that are connected to it and the process continues (recursively) till the circuit reaches a state where inputs are no longer changing (base case for the recursion).

Usage

a = Connector()
a1 = AND(0,1)
a1.setOutput(a)

a2 = AND(a,1)
a2.output()

Circuit Diagram for the above code:

![20140217_220054](https://f.cloud.github.com/assets/1548906/2187090/13d9f432-97f1-11e3-980c-d870e92a17c1.jpg)