Priority encoder: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Alter: title, template type. Add: s2cid, chapter, authors 1-1. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | #UCB_CommandLine
YogeshwarB (talk | contribs)
Revamped intro, colorized truth table
Line 1:
{{Short description|Digital electronic circuit}}
A '''priority encoder''' is a [[Electronic circuit|circuit]] or [[algorithm]] that compresses multiple [[Binary code|binary]] inputs into a smaller number of outputs. The output of a priority encoder is the binary representation of the index of the most significant activated line, starting from zero. They are often used to control [[interrupt request]]s by acting on the highest priority interrupt input.
A '''priority encoder''' is a [[Electronic circuit|circuit]] or [[algorithm]] that compresses multiple [[Binary code|binary]] inputs into a smaller number of outputs, similar to a [[Encoder (digital)|simple encoder]]. The output of a priority encoder is the binary representation of the [[Zero-based numbering|index]] of the [[Bit numbering|most significant]] activated line. In contrast to the simple encoder, if two or more inputs to the priority encoder are active at the same time, the input having the highest priority will take [[:wikt:precedence|precedence]]. It is an improvement on a simple encoder because it can handle all possible input combinations, but at the cost of extra logic.<ref>{{cite book |last1=Mano |first1=Moshe Morris |last2=Ciletti |first2=Michael D. |title=Digital Design |date=2007 |publisher=Pearson Prentice Hall |___location=Upper Saddle River, NJ |isbn=978-0-13-198924-5 |page=156 |edition=Fourth}}</ref>
[[File:A 4-2 Priority Encoder .jpg|alt=A 4:2 Priority Encoder|thumb|486x486px|A 4:2 Priority Encoder|center]]
If two or more inputs are given at the same time, the input having the highest priority will take [[:wikt:precedence|precedence]].<ref>M. Morris Mano, Michael D. Ciletti, "Digital Design", 4th Edition, Prentice Hall, 2006, {{ISBN|978-0-13-198924-5}}.</ref> An example of a single bit 4 to 2 encoder is shown, where highest-priority inputs are to the left and "x" indicates an irrelevant value - i.e. any input value there yields the same output since it is superseded by higher-priority input. The (usually-included{{efn|For instance, the [[List of 7400-series integrated circuits|74x147]] 10-to-4 [[BCD (character encoding)|BCD]] priority encoder does not have a dedicated output valid signal. However, invalid is indicated by all outputs simultaneously high. https://www.ti.com/lit/ds/symlink/sn74ls148.pdf}}) "v" output indicates if the input is valid.
 
Applications of priority encoders include their use in [[Programmable interrupt controller|interrupt controllers]] (to allow some [[interrupt request]]s to have higher priority than others), decimal or [[binary encoding]], and [[Analog-to-digital converter|analog-to-digital]] / [[Digital-to-analog converter|digital to-analog]] conversion.<ref>{{cite book |title=The TTL Applications Handbook |date=August 1973 |publisher=Fairchild Semiconductor |page=4-4}}</ref>
{| class="wikitable"
 
[[File:A 4-2 Priority Encoder .jpg|alt=Gate-level diagram of a single bit 4-to-2 Priority Encoder|thumb|486x486px|[[Logic gate|Gate-level]] diagram of a single bit 4-to-2 priority encoder. I(3) has the highest priority.|center]]
 
If two or more inputs are given at the same time, the input having the highest priority will takeA [[:wikt:precedence|precedencetruth table]].<ref>M. Morris Mano, Michael D. Ciletti, "Digital Design", 4th Edition, Prentice Hall, 2006, {{ISBN|978-0-13-198924-5}}.</ref> An example of a single bit 4 -to -2 priority encoder is shown, where highest-prioritythe inputs are toshown thein decreasing order of priority left-to-right, and "x" indicates ana irrelevant[[don't valuecare term]] - i.e. any input value there yields the same output since it is superseded by a higher-priority input. The (usually-included{{efn|For instance, the [[List of 7400-series integrated circuits|74x147]] 10-to-4 [[BCD (character encoding)|BCD]] priority encoder does not have a dedicated output valid signal. However, invalid is indicated by all outputs simultaneously high. https://www.ti.com/lit/ds/symlink/sn74ls148.pdf}}) "v" output indicates if the input is valid.
 
{| class="wikitable" style="margin:1em auto 1em auto; text-align:center;"
|+ 4 to 2 Priority Encoder
|- style="background:#def; font-weight:bold"
!style="border-bottom:2px solid #000;"|I<sub>3</sub>
!| colspan=4 | Input || colspan=3 style="border-bottomleft:2px solid #000;" |I<sub>2</sub> Output
!|- style="border-bottom:2px solid #000; background:#def; font-weight:bold"|I<sub>1</sub>
!style="border-bottom:2px solid #000;"|I<sub>3</sub>||I<sub>2</sub>||I<sub>1</sub>||I<sub>0</sub>
!|style="border-bottom:2px solid #000; border-left:2px solid #000;"| O<sub>1</sub> || O<sub>0</sub> || v
!style="border-bottom:2px solid #000;"|O<sub>0</sub>
!style="border-bottom:2px solid #000;"|v
|-
| 0 {{no|| 0}} || 0 {{no|| 0}} ||style="border-left:2px solid #000;"{{no| x0}} || x |{{no|0}} 0
|colspan=2 style="background: #ececec; color: #2C2C2C; border-left:2px solid #000;"|x || {{no|0}}
|-
| {{no|0}} || 0 {{no|| 0}} || 1 {{no||style="border-left:2px solid #000;"| 0}} || 0 |{{yes2|1}} 1
|style="background: #FFC7C7; color: black; border-left:2px solid #000;"|0 || {{no|0}} || {{yes2|1}}
|-
| 0 {{no|| 0}} || 1 {{no|| x0}} ||style="border-left:2px solid #000;"{{yes2| 01}} || 1 |{{n/a|x}} 1
|style="background: #FFC7C7; color: black; border-left:2px solid #000;"|0 || {{yes2|1}} || {{yes2|1}}
|-
| {{no|0}} || {{yes2|1}}
| 0 || 1 || x || x ||style="border-left:2px solid #000;"| 1 || 0 || 1
|colspan=2 {{n/a|x}}
| 0 || 1 || x || x ||style="background:#bfd; color:black; border-left:2px solid #000;"| 1 || {{no|0}} || {{yes2|1}}
|-
| {{yes2|1}}
| 1 || x || x || x ||style="border-left:2px solid #000;"| 1 || 1 || 1
|colspan=3 {{n/a|x}}
| 1 || x || x || x ||style="background:#bfd; color:black; border-left:2px solid #000;"| 1 || {{yes2|1}} || {{yes2|1}}
|}
 
Priority encoders can be easily connected in arrays to make larger encoders, such as one 16-to-4 encoder made from six 4-to-2 priority encoders - four 4-to-2 encoders having the signal source connected to their inputs, and the two remaining encoders take the output of the first four as input. The priority encoder is an improvement on a simple encoder circuit, in terms of handling all possible input [[Computer configuration|configurations]].
 
== Recursive construction of priority encoders<ref>{{Cite thesis|title=Architecture of block-RAM-based massively parallel memory structures : multi-ported memories and content-addressable memories|url=https://open.library.ubc.ca/cIRcle/collections/ubctheses/24/items/1.0314219|publisher=University of British Columbia|date=2016|first=Ameer M. S.|last=Abdelhadi}}</ref><ref>{{Cite book|last1=Abdelhadi|first1=Ameer M.S.|last2=Lemieux|first2=Guy G.F.|title=2015 IEEE 23rd Annual International Symposium on Field-Programmable Custom Computing Machines |chapter=Modular SRAM-Based Binary Content-Addressable Memories |date=May 2015|pages=207–214|doi=10.1109/FCCM.2015.69|isbn=978-1-4799-9969-9|s2cid=16985129 }}</ref><ref>{{Cite book|last1=Abdelhadi|first1=Ameer M. S.|last2=Lemieux|first2=Guy G. F.|title=2014 International Conference on Field-Programmable Technology (FPT) |chapter=Deep and narrow binary content-addressable memories using FPGA-based BRAMs |date=December 2014|pages=318–321|doi=10.1109/FPT.2014.7082808|isbn=978-1-4799-6245-7|s2cid=2074456 }}</ref> ==