Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter4: Combinational Logic Part 3

Similar presentations


Presentation on theme: "Chapter4: Combinational Logic Part 3"— Presentation transcript:

1 Chapter4: Combinational Logic Part 3
Originally By Reham S. Al-Majed Imam Muhammad Bin Saud University

2 Outline Decoder: Encoder: Definition Examples
Decoders with enable input. Expansion of decoders Decoder’s NAND implementation. Implementing circuits by decoders Encoder: Definition. Example. Encoder limitations. Priority encoder.

3 Decoder Definition In digital systems binary codes are used to represent discrete information. A binary code of n bits can represent 2n distinct elements of coded information. A decoder is a combinational circuit that converts binary information from n input lines to 2n output lines.

4 Decoder Definition Decoder has n inputs and up to 2n outputs.
Decoder selects one of the 2n outputs by decoding the corresponding binary value on the n inputs. Exactly one output will be active. Output i equals 1 if input binary code has a value of i. Output line equals 1 at only one input combination but is equal to 0 at all other combinations. 3 n inputs 2n outputs n-to-2n Decoder 1 2 2n-1 .

5 Decoder Definition They are called n-to-m line decoders, where m ≤ 2n
If there are unused input combinations  may have fewer output than 2n Decoders generates minterms of n input variables. Example: consider a 2-to-4 decoder Applications: Binary to octal converter. Instruction decoders. Memory address decoder. d0 d1 d2 d3 1

6 Example 1 Design a 2-to-4 decoder 2-to-4 decoder D1 = x’y y x
Decimal Minterm x y D0 D1 D2 D3 D0 = x’y’ 1 D1 = x’y 2 D2 = xy’ 3 D3 = xy

7 Example 2 3-to-8 decoder x y z D0 D1 D2 D3 D4 D5 D6 D7 1

8 Decoders with Enable Input
Usually decoders have an “enable” input. The enable input performs no logical operation. It is only responsible for making the decoder ACTIVE or INACTIVE. If it is active-high then: If is zero, then all outputs are zero regardless of the input values. If is one, then the decoder performs its normal operation. If it is active-low then: If is one, then all outputs are zero regardless of the input values. If is zero, then the decoder performs its normal operation.

9 Decoders with Enable Input
Example: D1 = x’y 2-to-4 decoder y x D0 = x’y’ D2 = xy’ D3 = xy Enable input E x y D0 D1 D2 D3 × 1

10 Decoder Expansion It is possible to build larger decoders using two or more smaller ones. Use decoders with enable inputs to form a larger decoder Example: two 2-to-4-line decoders with enable input form a 3-to-8-line decoder. E x y D0 D1 D2 D3 D4 D5 D6 D7 1 D1 2-to-4 decoder y x D0 D2 D3 E D5 2-to-4 decoder D4 D6 D7

11 Decoder’s NAND Implementation
Some decoders are constructed with NAND rather than AND gates. All outputs will be 1’s except the one corresponding to the input code which will be 0.

12 Implementing Circuits by Decoders
An n-to-2n-line decoder provides the 2n minterms of n input variables Any Boolean functions of n variables can be expressed as a sum of minterms  decoders can be used. The decoder is used to generate the 2n minterms Along with an additional OR Decoder implements a function using the minterms, not product terms .

13 Example Full adder circuit: S(x,y,z)=∑(1,2,4,7) C(x,y,z)=∑(3,5,6,7)

14 Think questions ! You may use minterms of F’ to express the function but what should be the external gates? If the decoder is implemented with NAND gates, what should be the external gates ?

15 Encoders An encoder performs the inverse operation of a decoder
It has 2n inputs, and n output lines. Only one input must be active input (1), the others must be 0’s. Output lines generate the binary code corresponding to the input value 2n inputs n outputs 2n-to-n Encoder . E0 E1 E2 . E2n-1

16 Example Example: octal-to-binary encoder 𝑧 = 𝐷 1 + 𝐷 3 + 𝐷 5 + 𝐷 7
𝑧 = 𝐷 1 + 𝐷 3 + 𝐷 5 + 𝐷 7 y = 𝐷 2 + 𝐷 3 + 𝐷 6 + 𝐷 7 x = 𝐷 4 + 𝐷 5 + 𝐷 6 + 𝐷 7

17 Encoder limitations Only one input can be active at a time.
If two inputs are active, the output produces unspecified combination Solution: priority encoder. Output with all 0’s can be when all inputs are zeros or when D0=1. Solution: add extra output to indicate whether at least one input is 1. V = 0 if none of the inputs equals 1, otherwise it is 1

18 Priority Encoder It is an encoder that includes the priority function.
If two or more inputs are equal to 1  the output should correspond to the input with higher priority. higher index is higher priority

19 Priority Encoder

20 Priority Encoder


Download ppt "Chapter4: Combinational Logic Part 3"

Similar presentations


Ads by Google