What is Decoder?
A circuit that activates exactly one of 2ⁿ outputs according to an n-bit input. It is used to select the row addressed in a memory. The reverse function is an encoder.
Japanese name: デコーダ
A circuit that activates exactly one of 2ⁿ outputs according to an n-bit input. It is used to select the row addressed in a memory. The reverse function is an encoder.
Japanese name: デコーダ
An n-to-2ⁿ decoder has one output for every possible input code. Each output is an AND of the input bits, each taken true or complemented, so it goes active for exactly one combination: output k is the minterm for code k. A 2-to-4 decoder needs four 2-input AND gates plus inverters; a 3-to-8 decoder needs eight 3-input gates. Many decoders add an enable input and use active-low outputs, and the enable lets small decoders be cascaded into larger ones. Since every minterm is available, a decoder followed by OR gates can implement any combinational function of its inputs.
An encoder does the reverse: it converts one active line out of 2ⁿ into an n-bit code. A plain encoder gives a wrong result if two inputs are active at once, so a priority encoder reports the highest-priority active input instead. A demultiplexer is a decoder whose enable carries data, routing one input signal to the output chosen by the select bits. A multiplexer can be viewed as a decoder whose outputs gate the data inputs into a common OR. Code converters such as a BCD-to-seven-segment driver are also called decoders even though their outputs are not one-hot.
Every memory array uses decoders: the row decoder turns the row address into one active word line, and the column decoder selects which bit lines connect to the sense amplifiers and I/O. Driving thousands of word lines with single wide AND gates would be slow, so large decoders use predecoding: the address is split into groups of two or three bits, each group is decoded into a few one-hot lines, and a small gate at each row combines one line from each group. Address-decoder faults are among the faults that March tests are designed to catch.
In a CPU, the instruction decoder interprets opcode fields and generates control signals; high-performance x86 cores decode variable-length instructions into simpler micro-operations and may cache them to avoid decoding again. A video decoder is a dedicated hardware block that decompresses video streams far more energy-efficiently than running the same algorithm in software on a general-purpose core. These are much larger circuits than a binary decoder, but they share the idea of translating an encoded input into the signals that act on it.
Answer: B. Decoder
A decoder activates exactly one of 2ⁿ outputs based on an n-bit input—eight outputs for three bits. It selects word lines or columns from memory addresses and decodes CPU instructions. Since each output corresponds to one input combination (a minterm), a decoder plus OR gates can implement any logic function. An encoder performs the reverse.
Answer: C. March test
A March test is a memory test algorithm that walks addresses in ascending and descending order, performing writes and reads on each cell in a fixed sequence. The common March C− uses 10 operations per cell and detects coupling faults between cells and address-decoder faults in addition to stuck-at faults. Test time scales linearly with cell count, so it works even for large memories.
A 4-to-16 decoder has 2⁴ = 16 outputs, and exactly one of them is active for each 4-bit input code. In general an n-bit decoder has 2ⁿ outputs.
A decoder converts an n-bit code into one active line out of 2ⁿ, while an encoder converts one active line out of 2ⁿ back into an n-bit code. A priority encoder handles cases where several inputs are active.
They are closely related: a decoder with an enable input becomes a demultiplexer when the enable is used as the data input. The select bits then choose which output receives the data.
Building real circuits is a good way to check what you learned in the questions.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.