Priority Encoder in Logisim-evolution: 4-to-2, 8-to-3, and Interrupt Logic

Direct Answer: Designing Priority Encoders in Logisim-evolution

A Priority Encoder compresses $2^N$ input request lines into an $N$-bit binary code representing the highest-priority active input, safely resolving simultaneous assertions that corrupt standard encoders. For a 4-to-2 Priority Encoder (D3 highest priority, D0 lowest), the minimized Boolean equations are Y1 = D3 + D2, Y0 = D3 + (~D2 & D1), and a mandatory Valid Flag V = D3 + D2 + D1 + D0 that distinguishes an active D0 press (00, V=1) from an idle bus (00, V=0).

Recommended Hardware Starter Kits for Encoder Labs

Breadboard Kit

Elegoo Electronics Component Starter Kit

Includes tactile pushbuttons, DIP switches, and LEDs for building physical keypad encoders and 74LS148 interrupt controllers.

Check Starter Kit on Amazon →
Signal Verification

USB 8-Channel 24MHz Logic Analyzer

Probe all 8 interrupt lines simultaneously to confirm highest-priority arbitration timing in hardware.

Check Logic Analyzer on Amazon →

Complete 4-to-2 Priority Encoder Truth Table

D3 (Highest) D2 D1 D0 (Lowest) Y1 Y0 Valid (V / GS)
0000XX0
0001001
001X011
01XX101
1XXX111

Cascading Two 8-to-3 Encoders into a 16-to-4 Priority Encoder

  1. Instantiate two 8-to-3 Priority Encoders (Upper handling inputs 8–15, Lower handling 0–7).
  2. Route the Upper encoder’s Enable Out (EO, active only when inputs 8–15 are all zero) into the Lower encoder’s Enable In (EI).
  3. Set the 4th output bit Y3 = Upper.GS (asserts 1 whenever any input in 8–15 is active).
  4. OR the 3-bit outputs of both encoders together (Y[2:0] = Upper.Y[2:0] | Lower.Y[2:0]), and OR both GS pins for the combined Valid flag.

Frequent Traps in Priority Encoder Circuits

Trap 1: Ignoring the Valid (GS) Output Pin

Fix: Always monitor Logisim’s GS (Group Signal / Valid) pin so downstream circuits distinguish Button 0 pressed from No button pressed.

Trap 2: Active-Low Polarity on 74LS148 ICs

Fix: Physical 74LS148 8-to-3 encoders use active-low inputs and active-low binary outputs; add inverters when interfacing with active-high switches.

Trap 3: Leaving Enable In (EI) Unwired

Fix: On Logisim’s Priority Encoder, EI defaults to enabled if unconnected, but on physical 74LS148 chips $\overline{EI}$ must be grounded.

Trap 4: Using Standard Encoder Equations on Multi-Hot Inputs

Fix: Standard non-priority encoders output 11 if both D1 and D2 are high simultaneously; always include blocking ~D2 terms.

Curriculum Progression from Encoders to Hardware Arbitration

Frequently Asked Questions About Priority Encoders

Where is the built-in Priority Encoder in Logisim-evolution?

Open the Plexers library and select Priority Encoder, then configure Select Bits (2 for 4-to-2, 3 for 8-to-3, 4 for 16-to-4).

How do CPUs use priority encoders for Interrupt Requests (IRQ)?

Hardware peripherals assert IRQ lines 0–7; the priority encoder immediately outputs the vector address of the highest-priority peripheral for servicing.

What is the difference between a 74LS147 and a 74LS148?

The 74LS147 is a 10-line-to-4-line BCD priority encoder (for 0–9 decimal keypads), whereas the 74LS148 is an 8-line-to-3-line binary priority encoder with cascade pins.

How do floating-point units use priority encoders?

IEEE 754 normalization uses a Leading-Zero Counter (built from a priority encoder) to find the highest-order 1 bit in a mantissa in a single cycle.

Affiliate Disclosure: Logisim-evolution Community is an independent educational resource. Some links in this guide are affiliate links. If you purchase textbooks or electronics kits through these links, we may earn an affiliate commission at no extra cost to you.

Similar Posts