Logic circuits
Which circuit outputs, in binary, the number of the highest-priority input when several inputs are 1 at the same time?
- APriority encoder
- BDemultiplexer
- CComparator
Show answer and explanation
Answer: A. Priority encoder
An encoder converts which input is 1 into a binary code, and a plain encoder assumes only one input is active. A priority encoder outputs the index of the highest-priority active input even when several are 1, plus a valid flag indicating whether any input is active. It is used to select requests in interrupt controllers and to find the leading 1 when normalizing floating-point numbers (leading-zero detection).
- A. Correct. It outputs the number of the highest-priority input.
- B. A demultiplexer routes one input to a selected output.
- C. A comparator compares two values for size or equality.