Bases: BinPy.Gates.gates.GATES
This Class implements 4 bit BCD Adder, and return its BCD Sum and Carry Output: [SUM, CARRY] Example:
>>> from BinPy import *
>>> ba = BCDAdder([0, 1, 1, 0], [1, 0, 1, 0], 0)
>>> ba.output()
[0, 0, 0, 0, 1]
Bases: BinPy.Gates.gates.GATES
This Class implements Binary Adder, Arithmetic sum of two bit strings and return its Sum and Carry Output: [CARRY, SUM] Example:
>>> from BinPy import *
>>> ba = BinaryAdder([0, 1], [1, 0], 0)
>>> ba.output()
[0, 1, 1]
Bases: BinPy.Gates.gates.GATES
This Class implements Binary Subtractor, Arithmetic difference of two bit strings and return its difference and borrow Output: [BORROW, DIFFERENCE] Example:
>>> from BinPy import *
>>> bs = BinarySubtractor([0, 1], [1, 0], 1)
>>> bs.output()
[1, 1, 0]
Bases: BinPy.Gates.gates.GATES
This class can be used to create DEMUX in your circuit. DEMUX is used to select It takes single input and n select lines and decode the select lines into BCD form base upon the input. In case of high input, it works as a decoder. INPUT: Single Input, 1 or 0 OUTPUT: BCD form of select lines in case of high input, else low output SELECT LINES: nth select line at nth index
>>> from BinPy import *
>>> demux = DEMUX(0) "DEMUX takes 1 input (digital or Connector)"
>>> demux.selectLines(0) "Put select Lines"
>>> demux.output()
[0, 0]
>>> demux.selectLine(0, 1) "Select line at index 0 is changed to 1"
>>> demux.output()
[0, 1]
Bases: BinPy.Gates.gates.GATES
This class can be used to create decoder in your circuit. Input is taken as Binary String and returns the equivalent BCD form. INPUT: n Binary inputs, nth input ant the nth index OUTPUT: Gives equivalent BCD form
>>> decoder = Decoder(0) "Decoder with 1 input, 0"
>>> decoder.output()
[1, 0]
>>> decoder.setInputs(0, 1) "sets the new inputs to the decoder"
[0, 1, 0, 1]
Bases: BinPy.Gates.gates.GATES
This class can be used to create encoder in your circuit. It converts the input BCD form to binary output. It works as the inverse of the decoder INPUT: Input in BCD form, length of input must me in power of 2 OUTPUT: Encoded Binary Form
>>> encoder = Encoder(0, 1) "Encoder with BCD input 01 "
>>> encoder.output() "Binary Form"
[1]
>>> encoder.setInputs(0, 0, 0, 1) "Sets the new inputs"
[1 , 1]
Bases: BinPy.Gates.gates.GATES
This Class implements Full Adder, Arithmetic sum of three bits and return its Sum and Carry Output: [SUM, CARRY] Example:
>>> from BinPy import *
>>> fa = FullAdder(0, 1, 1)
>>> fa.output()
[0, 1]
Bases: BinPy.Gates.gates.GATES
This Class implements Full Subtractor, Arithmetic difference of three bits and return its Difference and Borrow Output: [DIFFERENCE, BORROW] Example:
>>> from BinPy import *
>>> fs = FullSubtractor(0, 1, 1)
>>> fs.output()
[0, 1]
Bases: BinPy.Gates.gates.GATES
This Class implements Half Adder, Arithmetic sum of two bits and return its Sum and Carry Output: [SUM, CARRY] Example:
>>> from BinPy import *
>>> ha = HalfAdder(0, 1)
>>> ha.output()
[1, 0]
Bases: BinPy.Gates.gates.GATES
This Class implements Half Subtractor, Arithmetic difference of two bits and return its Difference and Borrow output Output: [DIFFERENCE, BORROW] Example:
>>> from BinPy import *
>>> hs = HalfSubtractor(0, 1)
>>> hs.output()
[1, 1]
Bases: BinPy.Gates.gates.GATES
This class can be used to create MUX in your circuit. MUX is used to select a single output line out of many inputs. This class can be used as any 2^n X n Multiplexer where n is the number of select lines used to select the input out of 2^n input lines. INPUT: nth index has nth input value, input should be power of 2 OUTPUT: single output, 1 or 0 SELECT LINES: In binary form, select line for 4 will be 1 0 0
>>> from BinPy import *
>>> mux = MUX(0, 1) "MUX takes its 2^n inputs (digital or Connector)"
>>> mux.selectLines(0) "Put select Line"
>>> mux.output()
0
>>> mux.selectLine(0, 1) "Select line at index 0 is changed to 1"
>>> mux.output()
1
>>> mux.setInput(1, 0) "Input line at index 1 is changed to 0"
>>> mux.output()
0