# Binary Decoder in Digital Logic

In Digital Electronics, discrete quantities of information are represented by binary codes. A binary code of n bits is capable of representing up to 2^n distinct elements of coded information. The name “Decoder” means to translate or decode coded information from one format into another, so a digital decoder transforms a set of digital input signals into an equivalent decimal code at its output. A decoder is a combinational circuit that converts binary information from n input lines to a maximum of 2^n unique output lines. ### Binary Decoder –

• Binary Decoders are another type of digital logic device that has inputs of 2-bit, 3-bit or 4-bit codes depending upon the number of data input lines, so a decoder that has a set of two or more bits will be defined as having an n-bit code, and therefore it will be possible to represent 2^n possible values.
• If a binary decoder receives n inputs it activates one and only one of its 2^n outputs based on that input with all other outputs deactivated. If the n -bit coded information has unused combinations, the decoder may have fewer than 2^n outputs.
• Example, an inverter ( NOT-gate ) can be classified as a 1-to-2 binary decoder as 1-input and 2-outputs is possible. i.e an input A can give either A or A complement as the output.
• Then we can say that a standard combinational logic decoder is an n-to-m decoder, where m <= 2^n, and whose output, Q is dependent only on its present input states.
• Their purpose is to generate the 2^n (or fewer) minterms of n input variables. Each combination of inputs will assert a unique output.

A Binary Decoder converts coded inputs into coded outputs, where the input and output codes are different and decoders are available to “decode” either a Binary or BCD (8421 code) input pattern to typically a Decimal output code.
Practical “binary decoder” circuits include 2-to-4, 3-to-8 and 4-to-16 line configurations.

### 2-to-4 Binary Decoder – The 2-to-4 line binary decoder depicted above consists of an array of four AND gates. The 2 binary inputs labeled A and B are decoded into one of 4 outputs, hence the description of a 2-to-4 binary decoder. Each output represents one of the minterms of the 2 input variables, (each output = a minterm). The output values will be:
Qo=A’B’
Q1=A’B
Q2=AB’
Q3=AB

The binary inputs A and B determine which output line from Q0 to Q3 is “HIGH” at logic level “1” while the remaining outputs are held “LOW” at logic “0” so only one output can be active (HIGH) at any one time. Therefore, whichever output line is “HIGH” identifies the binary code present at the input, in other words, it “decodes” the binary input.

Some binary decoders have an additional input pin labeled “Enable” that controls the outputs from the device. This extra input allows the outputs of the decoder to be turned “ON” or “OFF” as required. The output is only generated when the Enable input has value 1; otherwise, all outputs are 0. Only a small change in the implementation is required: the Enable input is fed into the AND gates which produce the outputs.

If Enable is 0, all AND gates are supplied with one of the inputs as 0 and hence no output is produced. When Enable is 1, the AND gates get one of the inputs as 1, and now the output depends upon the remaining inputs. Hence the output of the decoder is dependent on whether the Enable is high or low.

GATE CS Corner Questions

Practicing the following questions will help you test your knowledge. All questions have been asked in GATE in previous years or in GATE Mock Tests. It is highly recommended that you practice them.

References –

electronicshub – Binary Decoder

This article is contributed by Arushi Dhamija. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8552069,"math_prob":0.8584527,"size":5067,"snap":"2020-45-2020-50","text_gpt3_token_len":1147,"char_repetition_ratio":0.16610706,"word_repetition_ratio":0.014018691,"special_character_ratio":0.21393329,"punctuation_ratio":0.07249467,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98567957,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-25T00:37:18Z\",\"WARC-Record-ID\":\"<urn:uuid:3ea87a41-2d55-4e08-8131-4b31edc955e1>\",\"Content-Length\":\"94531\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7a39b0b2-bd05-4f78-a3c7-41ca000055ea>\",\"WARC-Concurrent-To\":\"<urn:uuid:898de6d6-11a8-484e-bfc6-941af0f9c8a7>\",\"WARC-IP-Address\":\"23.11.228.90\",\"WARC-Target-URI\":\"https://www.geeksforgeeks.org/binary-decoder-in-digital-logic/\",\"WARC-Payload-Digest\":\"sha1:V2DEZRO3TUIU7PELTFX5X3AUXCOJMBOE\",\"WARC-Block-Digest\":\"sha1:YUW25EPP5HVDPMWTJGHVWMRLL22G2AJB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107885059.50_warc_CC-MAIN-20201024223210-20201025013210-00436.warc.gz\"}"}