DemultiplexerΒΆ

A demultiplexer (or demux) is a device taking a single input signal and selecting one of many data-output-lines, which is connected to the single input. A demultiplexer is often used with a complementary multiplexer on the receiving end.

This example shows you working procedure of a demultiplexer in BinPy.

from __future__ import print_function
from BinPy.Combinational.combinational import *
demux = DEMUX(1) # Must be a single input
demux.selectLines(0) #Select Lines must be power of 2
print (demux.output())
[1, 0]
demux.setInput(0, 0) #Input at index 1 is changed to 0"
print (demux.output()) # New Output of the demux
[0, 0]
print (demux.getInputStates()) # Get Input States
[0]
# Using Connectors as the input lines
conn = Connector()
demux.setOutput(0, conn)  # Sets conn as the output at index 0
gate1 = AND(conn, 0)  # Put this connector as the input to gate1
print (gate1.output())  # Output of the gate1
0
demux.selectLine(0, 1) # Changing select lines
print (demux.output()) # New output of demux
[0, 0]
# Information about demux instance can be found by using
print(demux)
DEMUX Gate; Output: [0, 0]; Inputs: [0];