**8:3 Priority Encoder:** Explain how a Priority Encoder resolves the lim…
**8:3 Priority Encoder:** Explain how a Priority Encoder resolves the limitation of a standard binary encoder when multiple inputs are asserted simultaneously. Write synthesizable behavioral Verilog RTL code using casex and its testbench.
Model answer
### 1. Working Principle In a standard encoder, multiple active inputs cause an invalid output code. A **Priority Encoder** establishes a strict priority hierarchy ($D_7$ highest, $D_0$ lowest), encoding the binary index of the highest-priority asserted bit and ignoring all lower-priority bits ( don't cares ). ### 2. Behavioral Verilog RTL Implementation ### 3. Verilog Testbench