Search code examples
hardwarexordigital-logicnor

Design a XOR gate and a XNOR gate using a 2 to 4 Demultiplexer and 2-input OR gates


As above, can you please include a diagram or an image and explain me the reason of this design? thank you in advance.


Solution

  • A 2 to 4 Demultiplexer routes one input IN to one of four outputs (OUT0, OUT1, OUT2, OUT3).

    enter image description here (picture from http://www.play-hookey.com/digital/combinational/decoder_demux_four.html)

    The selection of the active output is done via two selection inputs A and B.

    To implement a two-input XOR, you can set the multiplexer data input to constant 1. Then feed OUT1 and OUT2 to a two-input OR. OUT1 and OUT2 are active, if the selection inputs are different (one input 0 and one input 1).

    For a two-input XNOR, outputs OUT0 and OUT3 are fed to the OR gate. Outputs OUT0 and OUT3 are active if both selection inputs are equal (both 0 or both 1).