Professional Documents
Culture Documents
Digital Circuits
Arun Tej M.
EE213M Digital Circuits
𝐼0 0
𝑓0 0 1
. 0
. 8-to-3 0 8-to-3
𝑓1 0
. Encoder 0 Encoder
𝑓2 1
0 1
𝐼7 0
𝐼7 𝐼6 𝐼5 𝐼4 𝐼3 𝐼2 𝐼1 𝐼0 𝑓2 𝑓1 𝑓0
𝐼0 0 0 0 0 0 0 0 1 0 0 0
𝑓0 0 0 0 0 0 0 1 0 0 0 1
.
8-to-3 0 0 0 0 0 1 0 0 0 1 0
. 𝑓1
Encoder 0 0 0 0 1 0 0 0 0 1 1
. 0 0 0 1 0 0 0 0 1 0 0
𝑓2 0 0 1 0 0 0 0 0 1 0 1
𝐼7 0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
𝑓0 = 𝐷1 + 𝐷3 + 𝐷5 + 𝐷7
𝑓2 = 𝐷4 + 𝐷5 + 𝐷6 + 𝐷7
What if, say, more than one of the inputs equal 1?
Encoder
𝐼7 𝐼6 𝐼5 𝐼4 𝐼3 𝐼2 𝐼1 𝐼0 𝑓2 𝑓1 𝑓0
𝐼0 0 0 0 0 0 0 0 1 0 0 0
𝑓0 0 0 0 0 0 0 1 0 0 0 1
.
8-to-3 0 0 0 0 0 1 0 0 0 1 0
. 𝑓1
Encoder 0 0 0 0 1 0 0 0 0 1 1
. 0 0 0 1 0 0 0 0 1 0 0
𝑓2 0 0 1 0 0 0 0 0 1 0 1
𝐼7 0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
Other than these 8 input combinations, for all others there will be ambiguity.
To resolve this, priority encoders are used where each of the input lines are given certain priority.
For ex., suppose both 𝐼5 and 𝐼2 are 1, then this encoder might give higher priority to 𝐼5 and consider it.
Also, if all inputs are 0s, all outputs will also be 0s. This is conflicting with the output with only 𝐼0 = 1.
To resolve this, a separate output is provided which indicates whether or not at least one input is 1.
Priority Encoder
• A priority encoder is a combinational circuit that implements a priority function.
• Input lines are assumed to represent units that request some service.
• When two inputs 𝐼𝑖 and 𝐼𝑗 (𝑗 > 𝑖) request service simultaneously, line 𝐼𝑗 will be given higher priority.
• The outputs of the encoder give the binary code indicating which one of the input lines is given highest
priority.
𝐷0 𝐷3 𝐷2 𝐷1 𝐷0 𝐴1 𝐴0 𝑉
𝐴0 0 0
4 – to – 2 0 0 𝑋 𝑋 0
𝐷1 0 0 0 1
Priority 𝐴1 0 0 1 𝑉 = 1 if any input is 1.
𝐷2 0 0 1 𝑋 0 1 1
Encoder 0 1 𝑋 𝑉 = 0 if all inputs are 0s.
𝑋 1 0 1
𝐷3 𝑉 1 𝑋 𝑋 𝑋 1 1 1
Xs in this condensed truth table are used to represent product terms that are not minterms
The number of rows of a full truth table represented by a row in the condensed table is 2𝑝 where 𝑝 is the
number of Xs in the row.
For example, 01XX represents 22 = 4 rows – 0100, 0101, 0110, and 0100, all having the same value for
outputs.
𝐷0 𝐷3 𝐷2 𝐷1 𝐷0 𝐴1 𝐴0 𝑉
𝐴0
𝐷1 4 – to – 2 0 0 0 0 𝑋 𝑋 0
Priority 𝐴1 0 0 0 1 0 0 1
𝐷2 Encoder 0 0 1 𝑋 0 1 1
0 1 𝑋 𝑋 1 0 1
𝐷3 𝑉 1 𝑋 𝑋 𝑋 1 1 1
Priority Encoder
𝐷3 𝐷2 𝐷1 𝐷0 𝐴1 𝐴0 𝑉
0 0 0 0 𝑋 𝑋 0
0 0 0 1 0 0 1
𝑉 = 𝐷0 + 𝐷1 + 𝐷2 + 𝐷3 0 0 1 𝑋 0 1 1
0 1 𝑋 𝑋 1 0 1
𝐷1 𝐷0
1 𝑋 𝑋 𝑋 1 1 1
𝐷3 𝐷2 00 01 11 10
00 𝑋 0 1 1
01 0 0 0 0
11 1 1 1 1
10 1 1 1 1
𝐴0 = 𝐷3 + 𝐷1 𝐷2′
𝐴1 = 𝐷2 + 𝐷3
Priority Encoder
𝑑 = 1 if any input is 1.
𝑑 = 0 if all inputs are 0s.
Comparator
• An 𝑛 bit comparator compares the magnitude of two numbers 𝐴 and 𝐵 and produces three outputs
𝐺𝑇, 𝐿𝑇, and 𝐸𝑄 as:
𝐺𝑇 = 1 iff 𝐴 > 𝐵
𝐿𝑇 = 1 iff 𝐴 < 𝐵
𝐸𝑄 = 1 iff 𝐴 = 𝐵
• Consider a 1-bit comparator.
𝐺𝑇 = 1 only for 𝐴 = 1, 𝐵 = 0 𝐺𝑇
𝐴
𝐿𝑇 = 1 only for 𝐴 = 0, 𝐵 = 1 Comparator 𝐿𝑇
𝐵
𝐸𝑄 = 1 for either 𝐴 = 0, 𝐵 = 0 or for 𝐴 = 1, 𝐵 = 1 𝐸𝑄
𝐴1 𝐴2
𝐵1 𝐵2 00 01 11 10 𝐴1 𝐴2 𝐵1 𝐵2
00 𝐸𝑄 𝐺𝑇 𝐺𝑇 𝐺𝑇
01 𝐿𝑇 𝐸𝑄 𝐺𝑇 𝐺𝑇
Comparator
11 𝐿𝑇 𝐿𝑇 𝐸𝑄 𝐿𝑇
10 𝐿𝑇 𝐿𝑇 𝐺𝑇 𝐸𝑄
𝐺𝑇 𝐿𝑇 𝐸𝑄
𝐸𝑄 = ?
4-bit Comparator
𝐴 = 𝐴3 𝐴2 𝐴1 𝐴0 𝐵 = 𝐵3 𝐵2 𝐵1 𝐵0
Thus, 𝐸𝑄 = 𝑥3 . 𝑥2 . 𝑥1 . 𝑥0
AND gate
AND gates