Binary Decoder Circuit Simulator
Simulate binary decoder circuits including 2-to-4, 3-to-8 and 4-to-16 decoders. Set the binary input code, control the enable signal and see which one-hot output becomes active for the selected input combination.
—
DECODER
—
—
Binary Decoder Circuit Simulator
The Binary Decoder Circuit Simulator models standard combinational decoder circuits that convert an n-bit binary input into one of 2ⁿ output lines. Each possible binary input combination corresponds to one unique decoder output.
The simulator supports 2-to-4, 3-to-8 and 4-to-16 decoders. These use two, three or four binary input bits and provide four, eight or sixteen possible output lines respectively.
You can also test an enable input and switch between active-high and active-low output conventions. This makes the simulator useful for studying one-hot decoding, address decoding, chip selection and digital logic design.
How to Use the Binary Decoder Simulator
Choose the decoder size and toggle the input bits between zero and one. Keep enable E at 1 for normal active-high decoder operation, then press Simulate Binary Decoder.
3-to-8 decoder
Input:
A B C = 1 0 1
Binary:
101
Decimal:
5
Enabled:
E = 1
Active output:
Y5Only the output whose index matches the binary input value becomes active.
What Is a Binary Decoder?
A binary decoder is a combinational circuit that converts a binary code into one of several mutually exclusive outputs. It can be viewed as the opposite conceptual operation of an encoder.
2 input bits
↓
2-to-4 decoder
↓
4 possible output lines
3 input bits
↓
3-to-8 decoder
↓
8 possible output linesThe number of outputs is normally 2 raised to the number of binary inputs.
2-to-4 Binary Decoder
A 2-to-4 decoder has two binary inputs and four outputs. Every possible 2-bit value activates a different output.
| A | B | Decimal | Active Output |
|---|---|---|---|
| 0 | 0 | 0 | Y0 |
| 0 | 1 | 1 | Y1 |
| 1 | 0 | 2 | Y2 |
| 1 | 1 | 3 | Y3 |
2-to-4 Decoder Truth Table
For an active-high decoder with E=1, exactly one output is high.
E A B | Y0 Y1 Y2 Y3
---------------------
1 0 0 | 1 0 0 0
1 0 1 | 0 1 0 0
1 1 0 | 0 0 1 0
1 1 1 | 0 0 0 1When the decoder is disabled, all active-high outputs become zero.
2-to-4 Decoder Boolean Expressions
With active-high inputs and enable E, the four outputs can be written as minterms of A and B.
Y0 = E AND NOT A AND NOT B
Y1 = E AND NOT A AND B
Y2 = E AND A AND NOT B
Y3 = E AND A AND BEach output corresponds to one unique combination of the two input bits.
3-to-8 Binary Decoder
A 3-to-8 decoder uses three binary input bits to select one of eight outputs. The possible input values range from binary 000 through 111.
ABC = 000 → Y0
ABC = 001 → Y1
ABC = 010 → Y2
ABC = 011 → Y3
ABC = 100 → Y4
ABC = 101 → Y5
ABC = 110 → Y6
ABC = 111 → Y73-to-8 Decoder Example
Input:
A = 1
B = 0
C = 1
Binary:
101
Decimal:
5
Result:
Y5 = 1
All other outputs:
0The binary input is interpreted as a numeric output address.
3-to-8 Decoder Boolean Equations
Y0 = E·A'·B'·C'
Y1 = E·A'·B'·C
Y2 = E·A'·B ·C'
Y3 = E·A'·B ·C
Y4 = E·A ·B'·C'
Y5 = E·A ·B'·C
Y6 = E·A ·B ·C'
Y7 = E·A ·B ·CEach output is an individual minterm of the three binary variables.
4-to-16 Binary Decoder
A 4-to-16 decoder accepts a four-bit binary number and activates one of sixteen output lines.
Input range:
0000 → Y0
0001 → Y1
0010 → Y2
...
1010 → Y10
...
1111 → Y15Four input bits can represent sixteen unique values because 2⁴ equals 16.
4-to-16 Decoder Example
Input:
1010
Decimal:
10
Enabled:
E = 1
Active output:
Y10
Active-high output vector:
0000010000000000
when displayed from Y15 down to Y0,
the 1 appears at the Y10 position.Why a Decoder Produces 2ⁿ Outputs
Every input bit can have two states. With n independent binary inputs, there are 2ⁿ possible combinations.
| Input Bits | Possible Codes | Decoder Type |
|---|---|---|
| 1 | 2 | 1-to-2 |
| 2 | 4 | 2-to-4 |
| 3 | 8 | 3-to-8 |
| 4 | 16 | 4-to-16 |
What Is One-Hot Output?
A one-hot output means exactly one output line is asserted at a time. Standard active-high binary decoding naturally produces one-hot output when the decoder is enabled.
3-to-8 decoder
Input:
010
One-hot output:
Y0 = 0
Y1 = 0
Y2 = 1
Y3 = 0
Y4 = 0
Y5 = 0
Y6 = 0
Y7 = 0Binary Input to Output Index
The decoder output index is simply the unsigned decimal value of the binary input code.
Binary:
110
Decimal conversion:
1×4 + 1×2 + 0×1
= 6
Decoder output:
Y6This direct relationship makes decoders useful for selecting hardware resources based on binary addresses.
Decoder Enable Input
Many decoder circuits include an enable input. When the enable condition is not satisfied, normal decoding is suppressed.
Active-high enable:
E = 1
Decoder operates normally.
E = 0
Decoder disabled.
Active-high outputs:
all 0The simulator uses an active-high enable input E.
Active-High Decoder Outputs
With active-high output logic, the selected output becomes 1 and all unselected outputs remain 0.
Input:
10
Active output:
Y2
Outputs:
Y0 = 0
Y1 = 0
Y2 = 1
Y3 = 0Active-Low Decoder Outputs
Some decoder ICs use active-low outputs. In this convention, the selected output becomes 0 while unselected outputs remain 1.
Input:
10
Selected:
Y2
Active-low outputs:
Y0 = 1
Y1 = 1
Y2 = 0
Y3 = 1Active-low signals are often indicated with a bar, bubble or slash in circuit diagrams and data sheets.
Decoder Output Minterms
Each decoder output represents exactly one minterm of the binary input variables. This makes binary decoders closely related to Boolean expression implementation.
2-bit input A,B
Y0 corresponds to:
A'B'
Y1:
A'B
Y2:
AB'
Y3:
ABUsing a Decoder to Implement Boolean Functions
Because each decoder output represents one minterm, selected outputs can be ORed together to implement a Boolean function expressed as a sum of minterms.
Function:
F(A,B,C) = Σm(1,3,5)
Using a 3-to-8 decoder:
F = Y1 OR Y3 OR Y5This is one reason decoders are important in combinational logic design.
Binary Decoder vs Encoder
| Device | Input | Output | Main Function |
|---|---|---|---|
| Binary Decoder | Compact binary code | One of many lines | Expand/decode code |
| Encoder | One of many input lines | Compact binary code | Encode input index |
The two circuits perform complementary transformations, although their practical implementations may include additional enable, priority or valid signals.
Binary Decoder vs Demultiplexer
A decoder and demultiplexer can look similar because both use select information to activate one of multiple output paths.
| Feature | Decoder | Demultiplexer |
|---|---|---|
| Binary select/address input | Yes | Yes |
| Separate routed data input | Usually no | Yes |
| One-of-many output | Yes | Yes |
| Main purpose | Decode code/address | Route data |
Decoder Circuits in Memory Addressing
Binary decoders are commonly associated with address selection. A binary address can be decoded so only one memory row, register, device or functional block receives an active select signal.
3-bit address:
101
Decimal address:
5
3-to-8 decoder output:
Y5
Selected resource:
Resource 5Decoder Circuits for Chip Select
A decoder can generate chip-select signals from address bits. Only the output associated with the current address becomes active, allowing one device to respond while others remain disabled.
Address bits:
A2 A1 A0
Decoder:
3-to-8
Possible device-select lines:
CS0 through CS7Decoder Circuits in CPUs and Digital Systems
Decoders are used throughout digital systems for instruction decoding, register selection, memory addressing, control signal generation, display driving and resource selection.
A processor can decode instruction fields or addresses into individual control signals that activate particular internal paths.
Decoder Cascading
Larger decoder circuits can be built by combining smaller decoders and using enable inputs to activate the correct section.
Example concept:
Two 3-to-8 decoders
+
one higher-order select bit
can be arranged to produce
16 individually selectable outputs.Practical cascading depends on the enable polarity and behavior of the specific decoder circuit or IC.
Decoder Truth Table and Minterm Relationship
Every row of a complete binary truth table corresponds to exactly one decoder output. For this reason, decoder output indices and Boolean minterm indices use the same binary numbering.
A B C = 1 1 0
Binary:
110
Minterm:
m6
Decoder output:
Y6Common Binary Decoder Mistakes
A common mistake is reversing the significance of the input bits. In this simulator, A is the most significant input bit, followed by B, C and D as the decoder size increases.
Another mistake is expecting several outputs to be active at once. A normal binary decoder produces one selected output for each enabled input combination.
It is also important to distinguish active-high from active-low output logic. The selected line is 1 in active-high mode but 0 in active-low mode.
Binary Decoder Circuit Simulator Limitations and Notes
This simulator models ideal combinational 2-to-4, 3-to-8 and 4-to-16 binary decoders. It includes an active-high enable input and selectable active-high or active-low output behavior.
The tool does not model physical propagation delay, fan-out, electrical loading, unknown logic states, tri-state outputs or the detailed enable pin arrangements of specific commercial decoder ICs.
Input A is treated as the most significant bit. Therefore ABC=101 maps to decimal 5 and output Y5.