Lab tutorials

How to Use the Decoder Simulator

Learn how to use the 2-to-4 decoder simulator. Set input lines, observe which output line goes active, and verify decoder behaviour including the enable pin.

Visual

InputsA0A1EN2-to-4DecoderOutputsY0Y1Y2Y3

Lab intro

A decoder takes an n-bit binary input and activates exactly one of its 2^n output lines. This tutorial uses a 2-to-4 decoder with two input lines A0 and A1, an active high enable pin EN, and four output lines Y0 through Y3. You will step through all four input combinations and confirm that only the addressed output line goes high for each.

What you will learn

  • How a 2-to-4 decoder maps a 2-bit binary address to one of four output lines
  • How the enable pin controls whether any output can go active
  • How to predict which output line Y0 through Y3 will be active for each A1 A0 combination
  • How decoders are used in memory address decoding and demultiplexing applications

Prerequisites

  • Understanding of binary encoding: 00, 01, 10, 11 and their decimal equivalents
  • Familiarity with active high and active low logic levels
  • Basic knowledge of combinational logic design

Step-by-step

  1. Step 1: Enable the decoder
    Open the 2-to-4 decoder simulator. You will see input toggles A0 and A1 on the left, an EN toggle also on the left, and four LED indicators Y0, Y1, Y2, Y3 on the right. Set EN to 1 first. With A0=0 and A1=0, Y0 should light up and Y1 through Y3 should remain dark.
    Tip: Without EN set to 1, none of the outputs will activate. Always enable the decoder before testing input combinations.
  2. Step 2: Test address 00
    Confirm A0=0 and A1=0 with EN=1. Y0 should be lit. No other output should be active. This address selects output line 0, which corresponds to decimal 0.
    Tip: Record which LED is lit for each combination. Only one LED should be lit at any time during normal operation.
  3. Step 3: Test address 01
    Set A0=1 and leave A1=0. Y0 should go dark and Y1 should light up. Only Y1 is active. Address 01 in binary is decimal 1, so Y1 is the correct output.
    Tip: A0 is the least significant bit. Changing A0 from 0 to 1 moves the active output from Y0 to Y1.
  4. Step 4: Test address 10
    Set A0=0 and A1=1. Y1 should go dark and Y2 should light up. Address 10 in binary is decimal 2, so Y2 is the active line.
    Tip: Note that you changed A1 this time, not A0. A1 is the most significant bit and has greater weight in determining the active output.
  5. Step 5: Test address 11
    Set both A0=1 and A1=1. Y2 should go dark and Y3 should light up. Address 11 in binary is decimal 3, so Y3 is the active line. This is the last of the four input combinations.
    Tip: Confirm that exactly one LED is lit and that it is Y3. If two LEDs appear lit, there may be a display rendering issue. Refresh and retest.
  6. Step 6: Test EN disable
    With A0=1 and A1=1 giving Y3 active, set EN to 0. Y3 should go dark. All four outputs should now be inactive. Change A0 and A1 to any values. No output should activate. Set EN back to 1. Y3 should light up again.
    Tip: The enable pin allows a decoder to be gated off without changing the address inputs. This is important in memory bank selection circuits.
  7. Step 7: Verify the full output table
    Re-enable EN and step through all four address combinations in order: 00, 01, 10, 11. For each, record which output is active. Confirm the table shows Y0 active for 00, Y1 for 01, Y2 for 10, and Y3 for 11.
    Tip: The output index always equals the decimal value of the binary address. This one-to-one mapping is the defining property of a decoder.

Expected output

With EN=1, exactly one output is active for each input combination: Y0 for A1=0 A0=0, Y1 for A1=0 A0=1, Y2 for A1=1 A0=0, and Y3 for A1=1 A0=1. At no point should two outputs be simultaneously active. With EN=0, all outputs should be inactive regardless of A0 and A1.

Troubleshooting tips

  • If no output is ever active even with EN=1, check whether the EN pin is active low in this simulator. An active low enable requires EN=0 to activate outputs, which is the opposite of an active high enable.
  • If two outputs are simultaneously lit, the simulator may be displaying a transient state during switching. Wait for the display to settle or reduce how quickly you toggle the inputs.
  • If the active output does not match the expected address, verify which bit is A0 and which is A1. Some simulators label the most significant bit as A0, reversing the standard ordering.
  • If Y0 through Y3 are labeled in descending order on screen with Y3 at the top, the visual layout may mislead you. Read output labels carefully rather than assuming top-to-bottom equals 0-to-3.
  • If the EN toggle appears active but outputs remain dark, the simulator may require a brief propagation delay. Try toggling one of the address inputs to force the output to refresh.