Skip to main content

5.4 Decoders, Encoders & Priority Encoders

πŸ“šModule 05: Combinational Logic CircuitsTopic 5.4⏱️21 min read
🎯High-Yield For:University Semester Exams β€’ Hardware Engineering Rounds β€’ Foundational Computing

πŸ’‘ Core Intuition: The Postal Routing Hub & The Emergency Dispatcher​

Imagine an automated postal logistics hub receiving packages marked with a 3-bit binary postal code (A2A1A0A_2 A_1 A_0). An automated robotic arm reads the code and routes the package into exactly one of eight designated sorting chutes (Y0Y_0 through Y7Y_7). This is a Decoder: it expands an nn-bit compressed coded address into 2n2^n unique activation lines.

🍳 The Everyday Analogy: The 911 Emergency Dispatcher​

Now consider the inverse scenario. An emergency call center receives incoming alerts from multiple city alarm sensors:

  • Sensor 0: Minor water leak.
  • Sensor 1: Power grid fluctuation.
  • Sensor 2: Commercial robbery.
  • Sensor 3: High-rise hospital fire.

If multiple emergencies trigger simultaneously, the dispatcher cannot scramble responders randomly or combine codes into nonsense. A strict Priority Protocol enforces that the hospital fire (highest priority) completely overrides all lesser alarms. The dispatcher transmits the binary code of the highest-severity event while asserting an "Active Emergency" beacon. This is a Priority Encoder.

πŸ’» Bridging to Computer Science​

Decoders and Priority Encoders are foundational building blocks in computing systems:

  1. Memory Address Decoders: When a CPU writes to memory address 0x3F80, high-order address bits route through a decoder to assert the Chip Select (CSˉ\bar{CS}) pin of one specific 8GB RAM chip while keeping all other chips in low-power sleep.
  2. Instruction Decoders: Inside a CPU core, the instruction decoder decodes 32-bit machine code opcodes (like 0110011 for RISC-V ADD) to activate the appropriate ALU datapath multiplexers and write-enable lines.
  3. Hardware Interrupt Controllers: When a network packet arrives, a keyboard key is pressed, and a timer ticks simultaneously, the CPU's Programmable Interrupt Controller (PIC / APIC / ARM GIC) uses a priority encoder to present the highest-priority Interrupt Request (IRQ) to the CPU execution core.


πŸ—‚οΈ Decoder Fundamentals & The 74138 IC​

A Decoder is a combinational logic circuit that converts an nn-bit binary input code into a maximum of 2n2^n unique physical output lines.

🎯

1-of-2ⁿ Activation

One-Hot / Zero-Hot
  • For any valid n-bit input code, exactly ONE output line is active at any given moment.
  • Active-high decoders assert 1 on the selected line; active-low decoders assert 0.
πŸ”‘

Minterm Generation

Canonical Terms
  • Each output line corresponds to an individual minterm of the n input variables.
  • Output k is asserted if and only if input code equals binary k.
πŸ›‘

Enable (Chip Select)

Strobe Gate
  • Enables expansion and bus interfacing.
  • When disabled, ALL output lines are deactivated simultaneously.

The 2:4 Active-High Decoder with Enable​

  • Inputs: 22 data inputs (A,BA, B), 11 enable line (EE).
  • Outputs: 44 outputs (Y0,Y1,Y2,Y3Y_0, Y_1, Y_2, Y_3).
Enable (EE)AA (MSB)BB (LSB)Y3Y_3Y2Y_2Y1Y_1Y0Y_0Active Minterm
00Γ—\timesΓ—\times00000000None (Disabled)
11000000000011m0=AˉBˉm_0 = \bar{A}\bar{B}
11001100001100m1=AˉBm_1 = \bar{A}B
11110000110000m2m_2
11111111000000m3=ABm_3 = AB
πŸ“2:4 Active-High Decoder Equationsformula
Y0=E⋅AˉBˉ,Y1=E⋅AˉB,Y2=E⋅ABˉ,Y3=E⋅ABY_0 = E \cdot \bar{A}\bar{B}, \quad Y_1 = E \cdot \bar{A}B, \quad Y_2 = E \cdot A\bar{B}, \quad Y_3 = E \cdot AB
2:4 Decoder Gate-Level SchematicClick Pins to Trace Bus Rails
E=1A=1NOTA'=0B=0NOTB'=1ANDYβ‚€ANDY₁ANDYβ‚‚ANDY₃
1-of-4 Activation Table
EABY₃Yβ‚‚Y₁Yβ‚€
1000001
1010010
1100100
1111000

The 3:8 Active-Low Decoder (Industry Standard: 74138 IC)​

In industrial digital logic, active-low outputs are overwhelmingly preferred because bipolar TTL and CMOS NAND gates are physically faster and consume lower static power when pulling down to ground.

The classic 74138 (74HC138) features:

  • 33 Select Inputs: AA (LSB), BB, CC (MSB).
  • 33 Enable Inputs: G1G_1 (Active-High), GΛ‰2A\bar{G}_{2A} (Active-Low), GΛ‰2B\bar{G}_{2B} (Active-Low).
    • Chip is enabled iff G1=1G_1 = 1 AND GΛ‰2A=0\bar{G}_{2A} = 0 AND GΛ‰2B=0\bar{G}_{2B} = 0.
  • 88 Active-Low Outputs: YΛ‰0,YΛ‰1,…,YΛ‰7\bar{Y}_0, \bar{Y}_1, \dots, \bar{Y}_7.
πŸ“74138 Active-Low Output Equationsformula

When enabled (E=G1β‹…G2Aβ€Ύβ‹…G2Bβ€Ύ=1E = G_1 \cdot \overline{G_{2A}} \cdot \overline{G_{2B}} = 1):

Yˉk=mk‾\bar{Y}_k = \overline{m_k}

For example: Yˉ0=CˉBˉAˉ‾=C+B+A\bar{Y}_0 = \overline{\bar{C}\bar{B}\bar{A}} = C + B + A Yˉ7=CBA‾=Cˉ+Bˉ+Aˉ\bar{Y}_7 = \overline{CBA} = \bar{C} + \bar{B} + \bar{A}

Only the selected output goes to Logic 0; all other seven outputs remain held high at Logic 1.


🌳 Decoder Expansion & Tree Synthesis​

To construct a wider decoder than available in standard IC packages, we cascade smaller decoders by using their Enable inputs to steer the most significant address bits.

Building a 3:8 Decoder Using Two 2:4 Decoders​

  • Inputs: 3 variables (A,B,C)(A, B, C) where AA is MSB, and B,CB, C are lower bits.
  • Connect lower bits (B,C)(B, C) to the select lines of both 2:4 decoders.
  • Use the MSB (AA) to enable one decoder at a time:
    • When A=0A = 0: Enable the first decoder (covers outputs Y0…Y3Y_0 \dots Y_3 representing minterms m0…m3m_0 \dots m_3).
    • When A=1A = 1: Enable the second decoder (covers outputs Y4…Y7Y_4 \dots Y_7 representing minterms m4…m7m_4 \dots m_7).
Architecture Flow

3:8 Decoder Expansion Architecture Using Two 2:4 Decoders

Hierarchical steering: MSB address input A gates the enable pins while inputs B and C drive all lower decoders

πŸ’‘ Hover or click any card for deep-dive operational details
Inverter + Wire

MSB Address Steering (A)

Steers which of the two 2:4 sub-decoders is enabled.

β†’
Enables Sub-Decoders
Lower 4 Minterms

Decoder #1 (Outputs Yβ‚€..Y₃)

Evaluates (B, C) inputs when A = 0.

β†’
Active When A=0
Upper 4 Minterms

Decoder #2 (Outputs Yβ‚„..Y₇)

Evaluates (B, C) inputs when A = 1.

General Sizing Formula for Decoder Trees​

To construct an MM-to-2M2^M decoder using NN-to-2N2^N decoders (where M>NM > N):

  • The output stage requires 2Mβˆ’N2^{M-N} decoders of size NN-to-2N2^N.
  • The enable inputs of these output decoders are driven by a preliminary decoding stage of size (Mβˆ’N)(M-N)-to-2Mβˆ’N2^{M-N}.

For example, to build a 4:16 Decoder using 2:4 Decoders:

  • Output stage: 24βˆ’2=22=42^{4-2} = 2^2 = 4 decoders (each handles 4 outputs).
  • Control stage: 11 decoder of size 2:4 (drives the enable inputs of the 4 output decoders).
  • Total 2:4 Decoders required = 4+1=54 + 1 = 5.

⚑ Function Realization via Minterm Generators​

Because an nn-to-2n2^n decoder intrinsically evaluates all 2n2^n minterms, any arbitrary Boolean function in canonical Sum of Products (SOP) form can be synthesized simply by ORing the required minterm outputs!

Architecture Flow

Function Synthesis: Active-High vs. Active-Low Decoders

Comparing external combining gate requirements for canonical SOP logic synthesis

πŸ’‘ Hover or click any card for deep-dive operational details
Standard SOP

Active-High Decoder

Output pins assert Logic 1 for selected minterm: Y_k = m_k.

β†’
Requires OR Gate
Industrial Standard

Active-Low Decoder (74138)

Output pins assert Logic 0 for selected minterm: YΜ„_k = mΜ„_k.

πŸ”Proof: Synthesizing SOP Logic with Active-Low Decoders + NANDproof

Let a function be defined as F=βˆ‘m(1,4,7)=m1+m4+m7F = \sum m(1, 4, 7) = m_1 + m_4 + m_7.

An active-low decoder (like the 74138) provides inverted minterms on its output pins: Yˉ1=mˉ1,Yˉ4=mˉ4,Yˉ7=mˉ7\bar{Y}_1 = \bar{m}_1, \quad \bar{Y}_4 = \bar{m}_4, \quad \bar{Y}_7 = \bar{m}_7

Connect these active-low outputs to the inputs of an external NAND gate:

Output=YΛ‰1β‹…YΛ‰4β‹…YΛ‰7β€Ύ=mΛ‰1β‹…mΛ‰4β‹…mΛ‰7β€Ύ=mΛ‰1β€Ύ+mΛ‰4β€Ύ+mΛ‰7β€Ύ(ByΒ DeΒ Morgan’sΒ Law)=m1+m4+m7=F\begin{aligned} \text{Output} &= \overline{\bar{Y}_1 \cdot \bar{Y}_4 \cdot \bar{Y}_7} \\ &= \overline{\bar{m}_1 \cdot \bar{m}_4 \cdot \bar{m}_7} \\ &= \overline{\bar{m}_1} + \overline{\bar{m}_4} + \overline{\bar{m}_7} \quad (\text{By De Morgan's Law}) \\ &= m_1 + m_4 + m_7 = F \end{aligned}

Conclusion: Any arbitrary Boolean function can be implemented using an active-low decoder combined with a single NAND gate, requiring zero external inverters!


πŸ”„ Demultiplexers (DEMUX) & Structural Duality​

A Demultiplexer (DEMUX) is the functional inverse of a Multiplexer:

  • It takes 11 data input line (DinD_{in}) and steers it to one of 2n2^n output lines (Y0…Y2nβˆ’1Y_0 \dots Y_{2^n-1}) selected by nn control select lines (Snβˆ’1…S0S_{n-1} \dots S_0).

The Formal Identity Between Decoders and DEMUXes​

There is zero structural difference between a Decoder with an Enable line and a Demultiplexer:

  • In a Decoder, the Enable input is treated as a control strobe, and the select lines are inputs.
  • In a Demultiplexer, the Enable pin is used as the Data Input (DinD_{in})!
  • When Din=1D_{in} = 1, the selected output line asserts 11 (while all others remain 00).
  • When Din=0D_{in} = 0, all output lines remain 00.

1-to-2nΒ DEMUX≑n-to-2nΒ DecoderΒ withΒ Enable\text{1-to-}2^n\text{ DEMUX} \equiv n\text{-to-}2^n\text{ Decoder with Enable}

πŸ“‘

Interactive 1:4 Demultiplexer (DEMUX) Hardware Lab

Toggle select lines (S₁, Sβ‚€) and input data stream (Din) to observe live data steering across the 4 output lines.

Data Routing
1:4 Demultiplexer Gate-Level SchematicClick Pins to Steer Data Stream
Din=1S₁=0NOTS₁'=1Sβ‚€=1NOTSβ‚€'=0ANDYβ‚€ANDY₁ANDYβ‚‚ANDY₃
Demultiplexing Routing Status
Y_0Code 00
0
Y_1Code 01
1
βž” DISTRIBUTED
Y_2Code 10
0
Y_3Code 11
0

🎯 Encoders & The Priority Resolution Problem​

An Encoder performs the inverse operation of a decoder: it takes 2n2^n (or fewer) input lines and compresses them into an nn-bit binary output code.

The Standard Binary Encoder (Octal-to-Binary: 8-to-3)​

Assumes that exactly one input line DkD_k is asserted at any time:

Active InputY2Y_2 (MSB)Y1Y_1Y0Y_0 (LSB)
D0=1D_0 = 1000000
D1=1D_1 = 1000011
D2=1D_2 = 1001100
D3=1D_3 = 1001111
D4=1D_4 = 1110000
D5=1D_5 = 1110011
D6=1D_6 = 1111100
D7=1D_7 = 1111111

Equations:

  • Y2=D4+D5+D6+D7Y_2 = D_4 + D_5 + D_6 + D_7
  • Y1=D2+D3+D6+D7Y_1 = D_2 + D_3 + D_6 + D_7
  • Y0=D1+D3+D5+D7Y_0 = D_1 + D_3 + D_5 + D_7
4:2 Standard Encoder SchematicClick Pins to Test Encoding
Y₃=0Yβ‚‚=1Y₁=0Yβ‚€=0(Encodes to 00; No OR gate required)ORA₁A₁ = Y₃ + Yβ‚‚ORAβ‚€Aβ‚€ = Y₃ + Y₁
βœ…
Standard Encoding: Valid 1-Hot input. Encoding clean binary output.
Standard Encoder Truth Table
Active LineY₃Yβ‚‚Y₁Yβ‚€A₁Aβ‚€
Yβ‚€ only000100
Y₁ only001001
Yβ‚‚ only010010
Y₃ only100011

The Two Fatal Flaws of Standard Encoders​

A naive binary encoder fails catastrophically in real-world computer systems due to two fundamental ambiguities:

  1. The "All-Zero" Ambiguity:
    If all input lines are 00 (D0=D1=β‹―=D7=0D_0 = D_1 = \dots = D_7 = 0), the circuit outputs Y2Y1Y0=000Y_2 Y_1 Y_0 = 000.
    Notice that this output is identical to the code produced when input D0=1D_0 = 1! The processor cannot distinguish between "Device 0 requested service" and "No device requested service."
  2. Multiple Simultaneous Assertions:
    If both D2=1D_2 = 1 and D4=1D_4 = 1 are asserted simultaneously: Y2=1,Y1=1,Y0=0β€…β€ŠβŸΉβ€…β€ŠOutputΒ =1102=610Y_2 = 1, \quad Y_1 = 1, \quad Y_0 = 0 \implies \text{Output } = 110_2 = 6_{10}
    The circuit outputs the code for device 66, even though device 6 never requested anything!

To resolve these fatal flaws, engineers invented the Priority Encoder.


🚨 Priority Encoder Architecture & K-Map Derivation​

A Priority Encoder establishes a strict hierarchy among inputs (by convention, higher-indexed inputs have higher priority). If multiple inputs are asserted at once, the circuit outputs the binary code of the highest-priority active line.

It also introduces an essential output flag:

  • Valid Bit (VV) / Group Select (GSGS): Asserts logic 11 if at least one input line is active, and logic 00 if all inputs are inactive.

Truth Table of a 4-to-2 Priority Encoder​

Let inputs be D3,D2,D1,D0D_3, D_2, D_1, D_0, where D3D_3 has the highest priority and D0D_0 has the lowest priority:

D3D_3 (Highest)D2D_2D1D_1D0D_0 (Lowest)Y1Y_1 (MSB)Y0Y_0 (LSB)Valid Flag (VV)
00000000Γ—\timesΓ—\times00
00000011000011
000011Γ—\times001111
0011Γ—\timesΓ—\times110011
11Γ—\timesΓ—\timesΓ—\times111111
  • Γ—\times denotes "Don't Care" (the input state is irrelevant because a higher-priority line dominates).

K-Map Minimization for 4:2 Priority Encoder​

πŸ”Derivation of Priority Encoder Equationsproof

Derivation of Valid Bit (VV):
VV is 11 whenever any input line is active:

V=D0+D1+D2+D3V = D_0 + D_1 + D_2 + D_3

Derivation of Output Y1Y_1:
Y1Y_1 must be 11 when D3=1D_3 = 1 (regardless of all others) OR when D2=1D_2 = 1 (provided D3=0D_3 = 0):

Y1=D3+Dˉ3D2=D3+D2Y_1 = D_3 + \bar{D}_3 D_2 = D_3 + D_2

Derivation of Output Y0Y_0:
Y0Y_0 must be 11 when D3=1D_3 = 1 OR when (D1=1D_1 = 1 AND D2=0D_2 = 0 AND D3=0D_3 = 0):

Y0=D3+Dˉ3Dˉ2D1=D3+Dˉ2D1Y_0 = D_3 + \bar{D}_3 \bar{D}_2 D_1 = D_3 + \bar{D}_2 D_1
  • Output Y1Y_1 Logic: 2-input OR gate taking D3D_3 and D2β†’Y1=D3+D2D_2 \to Y_1 = D_3 + D_2.
  • Output Y0Y_0 Logic: 2-input AND gate computing DΛ‰2D1\bar{D}_2 D_1, feeding into a 2-input OR gate with D3β†’Y0=D3+DΛ‰2D1D_3 \to Y_0 = D_3 + \bar{D}_2 D_1.
  • Valid Flag VV Logic: 4-input OR gate taking all lines β†’V=D3+D2+D1+D0\to V = D_3 + D_2 + D_1 + D_0.
4:2 Priority Encoder Gate-Level SchematicClick Pins to Test Priority Masking
D₃=0 (High)Dβ‚‚=1NOTD₁=1Dβ‚€=1 (Low)ANDORY₁ORYβ‚€ORV
Active Request Arbiter: Dβ‚‚
Priority Resolution Table
D₃Dβ‚‚D₁Dβ‚€Y₁Yβ‚€V
0000Γ—Γ—0
0001001
001Γ—011
01Γ—Γ—101
1Γ—Γ—Γ—111

🏭 Real-World Production Context: Memory Address Decoding & Hardware Interrupt Controllers​

In modern computer architecture, decoders and priority encoders form the foundational hardware layer connecting processors with volatile memory and asynchronous peripherals.

Microprocessor Memory Mapping & Interrupt Handling Subsystem

Layer 1: Address Bus

High-Order Address Lines (A15-A13)

🎯

CPU asserts 16-bit address during memory fetch. Top 3 bits feed a 3:8 decoder (74138) to select a specific 8 KB page.

A15, A14, A13 Address LinesDeterministic Address DemuxZero Overlap Guarantee
↓Decoded Chip Select (/CS)
Layer 2: Memory Banks

Bank Selection via Active-Low Decoders

πŸ’Ύ

Active-low outputs (/Y0 to /Y7) connect to the /CS lines of SRAM, ROM, and Memory-Mapped I/O, activating exactly one target.

ROM (000x)SRAM Bank 0 (001x)I/O Ports (111x)
↓Device Interrupt Request Lines
Layer 3: Interrupt Subsystem

Priority Interrupt Controller (8:3 Priority Encoder)

⚑

Peripherals assert asynchronous IRQ lines. Priority encoder instantly outputs highest-priority vector to CPU.

Timer Tick (IRQ0 - Highest)Keyboard (IRQ1)Network NIC (IRQ5)
↓Vector Address & INT Signal
Layer 4: Execution Core

CPU Interrupt Service Routine (ISR)

πŸš€

The core pushes program state, loads the vector table address from the encoder output, and services the critical event.

Vector Offset DispatchLow Latency Context SwitchRe-entrant IRQ Stack
  • Memory Address Decoding: When a CPU addresses physical memory, the higher-order address lines determine which memory device or peripheral is enabled, while the lower-order address lines specify the specific memory cell inside that chip. The 3:8 active-low decoder ensures mutually exclusive chip-select assertion, preventing electrical bus contention.
  • Interrupt Resolution: When multiple real-time external events arrive simultaneously (such as a power failure alert, timer tick, and network packet), an internal priority encoder immediately forwards the critical interrupt vector to the CPU with O(1)O(1) hardware latency.

πŸ“ Numerical Applications & Worked Examples​

Example 1: Full Adder Realization Using 74138 (Active-Low Decoder) & NAND Gates​

Problem Statement:
Synthesize a 1-bit Full Adder (A,B,Cin→S,CoutA, B, C_{in} \to S, C_{out}) using a single 3:8 active-low Decoder (74138) and the minimum number of external logic gates. Show the connection schematic and write the algebraic validation.

Step 1: Identify Canonical Minterms​

For a Full Adder with inputs (A,B,Cin)(A, B, C_{in}):

  • Sum: S(A,B,Cin)=βˆ‘m(1,2,4,7)S(A, B, C_{in}) = \sum m(1, 2, 4, 7)
  • Carry Out: Cout(A,B,Cin)=βˆ‘m(3,5,6,7)C_{out}(A, B, C_{in}) = \sum m(3, 5, 6, 7)

Step 2: Interface to 74138 Decoder​

  • Connect address inputs: C=AC = A (MSB), B=BB = B, A=CinA = C_{in} (LSB).
  • Enable inputs: Tie G1=VDDG_1 = V_{DD}, GΛ‰2A=GND\bar{G}_{2A} = GND, GΛ‰2B=GND\bar{G}_{2B} = GND to permanently enable the IC.
  • The 74138 outputs produce inverted minterms: YΛ‰k=mΛ‰k\bar{Y}_k = \bar{m}_k.

Step 3: Select External Combining Gates​

Using the property ∏mΛ‰kβ€Ύ=βˆ‘mk\overline{\prod \bar{m}_k} = \sum m_k:

  1. Sum Output (SS):
    Route outputs Yˉ1,Yˉ2,Yˉ4,Yˉ7\bar{Y}_1, \bar{Y}_2, \bar{Y}_4, \bar{Y}_7 into a 4-input NAND gate: S=Yˉ1⋅Yˉ2⋅Yˉ4⋅Yˉ7‾=mˉ1⋅mˉ2⋅mˉ4⋅mˉ7‾=m1+m2+m4+m7S = \overline{\bar{Y}_1 \cdot \bar{Y}_2 \cdot \bar{Y}_4 \cdot \bar{Y}_7} = \overline{\bar{m}_1 \cdot \bar{m}_2 \cdot \bar{m}_4 \cdot \bar{m}_7} = m_1 + m_2 + m_4 + m_7
  2. Carry Output (CoutC_{out}):
    Route outputs Yˉ3,Yˉ5,Yˉ6,Yˉ7\bar{Y}_3, \bar{Y}_5, \bar{Y}_6, \bar{Y}_7 into a second 4-input NAND gate: Cout=Yˉ3⋅Yˉ5⋅Yˉ6⋅Yˉ7‾=mˉ3⋅mˉ5⋅mˉ6⋅mˉ7‾=m3+m5+m6+m7C_{out} = \overline{\bar{Y}_3 \cdot \bar{Y}_5 \cdot \bar{Y}_6 \cdot \bar{Y}_7} = \overline{\bar{m}_3 \cdot \bar{m}_5 \cdot \bar{m}_6 \cdot \bar{m}_7} = m_3 + m_5 + m_6 + m_7

Total Components: Exactly 11 74138 Decoder and 22 4-input NAND gates.


Example 2: Synthesizing a 4:16 Decoder Using 2:4 Decoders​

Problem Statement:

  1. Determine the exact number of 2:4 Decoders with active-high Enable inputs required to construct a 4:16 Decoder.
  2. Specify the wiring diagram showing how primary input address lines A3,A2,A1,A0A_3, A_2, A_1, A_0 are partitioned.
  3. If each 2:4 Decoder has a propagation delay of 2.2Β ns2.2\text{ ns}, calculate the total latency of the 4:16 Decoder system.

Step 1: Determine Module Count​

  • A 4:16 Decoder has 44 input lines and 1616 output lines.
  • Each 2:4 Decoder produces 44 outputs.
  • To produce 1616 outputs, we need 16/4=4Β Decoders16 / 4 = \mathbf{4\text{ Decoders}} in the output stage.
  • To steer the enables of these 4 decoders, we need an additional 11 Decoder of size 2:4 in the input stage.
  • Total 2:4 Decoders required = 4+1=5Β Decoders4 + 1 = \mathbf{5\text{ Decoders}}.

Step 2: Wiring Architecture​

  • Input Stage Decoder (DEC0DEC_0):
    • Inputs: Connected to the most significant address bits A3,A2A_3, A_2.
    • Enable: Tied to VDDV_{DD} (or master chip enable).
    • Outputs: E0,E1,E2,E3E_0, E_1, E_2, E_3.
  • Output Stage Decoders (DEC1,DEC2,DEC3,DEC4DEC_1, DEC_2, DEC_3, DEC_4):
    • Inputs of all four decoders: Connected in parallel to the least significant address bits A1,A0A_1, A_0.
    • Enable lines:
      • DEC1DEC_1 Enable driven by E0E_0 β€…β€ŠβŸΉβ€…β€Š\implies decodes A3A2=00A_3 A_2 = 00 (outputs Y0…Y3Y_0 \dots Y_3).
      • DEC2DEC_2 Enable driven by E1E_1 β€…β€ŠβŸΉβ€…β€Š\implies decodes A3A2=01A_3 A_2 = 01 (outputs Y4…Y7Y_4 \dots Y_7).
      • DEC3DEC_3 Enable driven by E2E_2 β€…β€ŠβŸΉβ€…β€Š\implies decodes A3A2=10A_3 A_2 = 10 (outputs Y8…Y11Y_8 \dots Y_{11}).
      • DEC4DEC_4 Enable driven by E3E_3 β€…β€ŠβŸΉβ€…β€Š\implies decodes A3A2=11A_3 A_2 = 11 (outputs Y12…Y15Y_{12} \dots Y_{15}).

Step 3: Latency Calculation​

  • Signal propagation flows through DEC0DEC_0 (Stage 1) and then through the selected output decoder (Stage 2).
  • Total propagation delay: Ttotal=tDEC0+tDEC_out=2.2Β ns+2.2Β ns=4.4Β nsT_{total} = t_{DEC_0} + t_{DEC\_out} = 2.2\text{ ns} + 2.2\text{ ns} = \mathbf{4.4\text{ ns}}

Example 3: 8-to-3 Priority Encoder Analysis & Expansion​

Problem Statement:
An 8-to-3 Priority Encoder has inputs D7…D0D_7 \dots D_0 (D7D_7 highest priority) and outputs Y2,Y1,Y0Y_2, Y_1, Y_0 plus Valid flag VV.

  1. Derive the simplified Boolean equations for Y2,Y1,Y0Y_2, Y_1, Y_0, and VV.
  2. Determine the exact output code and flag status if the input vector applied is: D=[D7,D6,D5,D4,D3,D2,D1,D0]=[0,0,1,0,1,1,0,1]D = [D_7, D_6, D_5, D_4, D_3, D_2, D_1, D_0] = [0, 0, 1, 0, 1, 1, 0, 1]

Step 1: Derive Output Equations​

Following priority resolution rules where DkD_k masks all lower-order bits (DiD_i for i<ki < k):

  • Valid Bit (VV): V=D7+D6+D5+D4+D3+D2+D1+D0V = D_7 + D_6 + D_5 + D_4 + D_3 + D_2 + D_1 + D_0
  • Output Y2Y_2 (Asserted for inputs 4, 5, 6, 7): Y2=D7+D6+D5+D4Y_2 = D_7 + D_6 + D_5 + D_4
  • Output Y1Y_1 (Asserted for inputs 2, 3, 6, 7): Y1=D7+D6+DΛ‰5DΛ‰4(D3+D2)Y_1 = D_7 + D_6 + \bar{D}_5\bar{D}_4(D_3 + D_2)
  • Output Y0Y_0 (Asserted for inputs 1, 3, 5, 7): Y0=D7+DΛ‰6D5+DΛ‰6DΛ‰4D3+DΛ‰6DΛ‰4DΛ‰2D1Y_0 = D_7 + \bar{D}_6 D_5 + \bar{D}_6\bar{D}_4 D_3 + \bar{D}_6\bar{D}_4\bar{D}_2 D_1

Step 2: Evaluate Input Vector D=001011012D = 00101101_2​

Inspect the active input lines from highest to lowest index:

  • D7=0D_7 = 0
  • D6=0D_6 = 0
  • D5=1D_5 = 1 ←\leftarrow HIGHEST ACTIVE LINE!
  • D4=0D_4 = 0
  • D3=1D_3 = 1 (Masked by D5D_5)
  • D2=1D_2 = 1 (Masked by D5D_5)
  • D1=0D_1 = 0
  • D0=1D_0 = 1 (Masked by D5D_5)

Because D5D_5 is the highest active bit:

  • The circuit ignores lines D3,D2,D0D_3, D_2, D_0.
  • Binary output code corresponding to index 55: Y2Y1Y0=1012Y_2 Y_1 Y_0 = 101_2
  • Valid flag: At least one bit is active β€…β€ŠβŸΉβ€…β€ŠV=1\implies \mathbf{V = 1}.

Final Output: Y2Y1Y0=1012Y_2 Y_1 Y_0 = 101_2 with V=1V = 1.


🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions
  • Why can an active-low Decoder implement multi-output functions with fewer total transistors than an active-high Decoder?
    An active-high decoder requires OR gates to sum minterms (F=βˆ‘mkF = \sum m_k). An active-low decoder uses NAND gates (F=∏mΛ‰kβ€ΎF = \overline{\prod \bar{m}_k}). In CMOS silicon fabrication, a NAND gate requires series NMOS and parallel PMOS transistors, which have higher electron mobility and lower parasitic capacitance than the series PMOS transistors required by NOR/OR gates. Thus, active-low NAND logic is physically faster and more compact.

  • What is the purpose of the Cascade Input / Output pins (EI, EO, GS) on the 74148 8-to-3 Priority Encoder IC?
    They allow seamless expansion to 16-to-4 or 64-to-6 priority encoders without external logic gates! The Enable Input (EIˉ\bar{EI}) enables the chip. If no inputs on the high-order chip are active, its Enable Output (EOˉ\bar{EO}) goes low, which automatically activates the lower-order priority encoder chip. The Group Select (GSˉ\bar{GS}) pin serves as the Valid bit.

Common Interview Traps
  • Trap: Forgetting that a Demultiplexer cannot generate multiple outputs simultaneously.
    Beginners sometimes confuse a DEMUX with a broadcast splitter. A 1-to-2n2^n DEMUX connects its input line to only ONE selected output line at any time; all unselected outputs remain held at their inactive state.
  • Trap: Neglecting the Valid flag when interpreting Priority Encoder outputs.
    If Y1Y0=00Y_1 Y_0 = 00, you CANNOT declare that input D0D_0 is active without checking VV! If V=0V = 0, all inputs are completely inactive, and 0000 is simply a floating don't-care artifact.

πŸ’¬

Discussion & Doubts