logic gates digital components - etihadaouetihadaou.com/wp-content/uploads/2015/12/chapter3.pdfdraw...

26

Upload: dinhdieu

Post on 22-Apr-2018

231 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:
Page 2: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Objectives: Chapter 3 :

1- Boolean Algebra Boolean Expressions Boolean Identities Simplification of Boolean Expressions Complements Representing Boolean Functions

2- Logic gates 3- Digital Components 4- Combinational circuits 5- Sequential circuits

1- Bolean Algebra Boolean algebra is an algebra for the manipulation of objects that can take on only two values,

typically true and false

Boolean variable: it is a variable that can take only two values : 0 (false) or 1 (true)

• Example: x, y, z, … Where, for instance, “x” could be 0 or 1

Boolean expressions: Combination of Boolean variables and operators (AND, OR, NOT, …)

• Example: x AND y, x OR y, …

Boolean function: typically has one or more input values and yields a result, based on these input values, in the range {0,1}

• Example: F(x, y, z) = (x AND y) OR z

Three common Boolean operators AND, OR and NOT

In Boolean expression/arithmetic

• (a AND b) is expressed as a Boolean product: a.b or simply ab

• (a OR b) is expressed as a Boolean sum: a+b

• (NOT a) is expressed as: 𝐚𝐚�

1

Page 3: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Truth Table A Boolean operator can be completely described using a truth table that lists:

• The inputs,

• All possible values for these inputs,

• The resulting values of the operation for all possible combinations of three inputs

Boolean function can also be described using a truth table

The following rules of precedence should be respected

• Parentheses first

• NOT next

• AND next

• OR finally

2

Page 4: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Draw the truth table to show all possible outputs of the following Boolean function: F(x,y,z) = x +𝐲𝐲�z

Sol. Logically we should calculate y�, y�z and then x + y�z

The truth table for F(x,y,z) is:

(MID-TERM Make Up Fall 2011) Show that x = xy + xy� Using truth tables Sol.

(MOCK MTA 2012) drawing the truth table of F(x,y,z) = x�+z. Sol.

3

Page 5: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Boolean Identities

Frequently, a Boolean expression is not in its simplest form Recall from algebra the expression 2x + 6x can be simplified to 8x Boolean expressions can also be simplified We need new identities, or laws, that apply to Boolean algebra instead of

regular algebra These laws are grouped in the following table

Simplification of Boolean Expressions

Simplify the function F(x,y,z) = xyz + xyz + xz Using Identities:

The simplest form for F(x,y,z) is F(x,y,z) =

F(x,y,z) = xyz + xyz + xz = xyz + xz = xz(y + 1) = xz(1) = xz

(idempotent) (Distributive) (Null) (Identity)

4

Page 6: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Exercises Simplify the following functional expressions using Boolean Algebra a. xy + xy' b. F(x,y,z) = x'y + xyz' + xyz c. F(w,x,y,z) = (xy' + w'z)(wx' + yz') ans. a. xy + x'y = x(y + y') = x(1) = x b. x'y + xyz' + xyz = x'y + xy(z' + z) = x'y + xy(1) = x'y + xy = (x' + x)y = (1)y = y c. (xy' + w'z)(wx' + yz') = xy'wx' + xy'yz' + w'zwx' + w'zyz' = (xx')y'w + (y'y)xz' + (w'w)zx' + (zz')w'y = (0)y'w + (0)xz' + (0)zx' + 0(w'y) = 0 + 0 + 0 + 0 = 0 (MTA - 2nd Semester – 2012/2013) Use Boolean algebra and Boolean identities to prove that F1 is really a simplified version of F (found in part a). a�bc + a�bc� + c = a�b + c a�bc + a�bc� + c =a�b(c+c�) + c = a�b + c (you should use identities) (Final 1st Semester 2011) Simplify the following expressions in sum of products: x�z�+y�z�+yz�+xy Sol. x�z�+z�(y�+y)+xy = x�z�+z�+xy= z�(x+1)+xy TMA Spring 2013

5

Page 7: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Using the basic identities of Boolean algebra, show that: x + x' y = x + y. Ans. x + x'y = x(y + y') + x'y = xy + xy' + x'y = xy + xy' +x'y +xy = x(y + y') + y(x' + x) = x(1) + y(1) = x + y Simplify the following functional expressions using Boolean Algebra xy'z + x'y'z + xyz Ans. = (xy'z + xy'z) + x'y'z + xyz = (xy'z + x'y'z) + (xy'z + xyz) = (x + x')y'z + (y' + y)xz = y'z + xz Using the basic identities of Boolean algebra, show that: xy + x'z + yz = xy + x' z Ans. xy + x'z + yz = xy + x'z + (1)yz = xy + x'z + (x + x')yz = xy + x'z + xyz + x'yz = (xy + xyz) + (x'z + x'yz) = xy(1 + z)+x'z(1 + y) = xy + x'z (MOCK MTA 2012, TMA Spring 2013) Use Boolean identities and Boolean algebra to simplify F to its simplest form. Show your simplification steps clearly x�y�z� + xyz + xy�z + x�yz + x�y�z + x�yz�. Sol. x�y�z� + xyz + xy�z + x�yz + x�y�z + x�yz� =( x�y�z� + x�y�z) + (x�yz + x�yz�) + (xyz + xy�z) = x�y� + x�y + xz = (x�y� + x�y) + xz = x� + xz = x�(1+z) + xz = x� + x�z + xz = x�+z (Final Exam 1st Semester – 2012/2013) Use Boolean algebra and identities to simplify F to its simplest form. x�y�z� + x�y+xy�z� + x�y�z+ x�yz� + y�

- The equality between two Boolean expressions can also be proved by drawing and comparing their truth tables.

- Exercise: prove the following equality by drawing the truth tables of its Boolean Expressions: (x + y)(x� + y) = y

6

Page 8: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Complements Quite often, it is cheaper and less complicated to implement the complement of a fuction rather than the function itself

To find the compelmet of a Boolean function, we use DeMorgan's Law

𝐱𝐱. 𝐲𝐲����� = 𝐱𝐱� + 𝐲𝐲�

𝐱𝐱 + 𝐲𝐲 ���������= 𝐱𝐱.� 𝐲𝐲� The complement of a function F is expressed as F�

Example1: Find the complement F� of the function, Use truth table to prove your solution:

F(x,y) = x+y F(x,y) = x.y

Sol.

F(x, y)�������� = x + y�������� = x�y�

(OR form of the DeMorgans Law)

F(x,y) = x. y���� = x� + y�

(AND form of the DeMorgans Law)

Example: Find the complement F� of the function F(x,y,z) = x+y+z

Solution:

F(x, y, z)����������� = x + y + z��������������

= (x + y) + z�����������������

=(x + y)����������� z�

= (x�y�)z�

= x�y�z�

So 𝐱𝐱 + 𝐲𝐲 + 𝐳𝐳 �������������= 𝐱𝐱�𝐲𝐲�𝐳𝐳�

Applying the principle of duality, we see that xyz����� = 𝐱𝐱� + 𝐲𝐲� + 𝐳𝐳�

7

Page 9: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

We can clearly see that to find the complement of a Boolean expression

We simply replace each variable by its complement (x is replaced by x) And interchange ANDs and ORs

Example: Find the complement of x� + yz�

First Step: Replacing Variable

- x� is replaced by x - y is replaced by y� - 𝐳𝐳� is replaced by z

Second Step: Replacing Operands

- The "+" between x� and yz� is preplaced by "." - The "." between y and z� is replaced by "+"

The result is : x ̅ + yz����������� = x(y�+ z)

Example: Prove that the complement of x� + yz� is x(x� + y) Using truth Table.

8

Page 10: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

(MTA –2nd Semester – 2012/2013) If F1 is the simplified version of F and F1��� = c�. (a + b�), what would be the Boolean expression of F1?

F1 = F1 = c ̅. (a + b ̅)�������������� = c + a�b

(MTA 3 –2nd Semester – 2012/2013)

(MTA (Makeup)1st Semester – 2013/2014)

Consider the following Boolean function: F(a,b,c)=a�b�c� + ab�.

a. Use DeMorgan’s law, other Boolean identities and Boolean algebra to find the complement F� of the function F. You should also represent F� in its simplest sum of products form. (5 Marks) F(a, b, c)����������� = a�b�c� + ab������������ = �a�b�c�������. �ab����� = (a + b + c). (a� + b) (2 Mark) = aa� + ab + ba� + bb + ca� + cb = 0 + ab + ba� + b + ca� + cb = b + ca�

(MTA 1 –1st Semester – 2013/2014)

Consider the following Boolean function: F(a,b,c) = (a�+c).(a+b�+c)

a. Find the complement function F� of F. (1 Mark)

The student can use the initial F expression or the simplest expression he/she calculated in “a”. Method 1:

F(a, b, c)����������� = (a� + c). (a + b� + c)������������������������ = (a� + c)��������� + (a + b� + c)�������������� = ac� + a�bc� No need for further simplifications

F(a, b, c)����������� = c + a�b��������� = c�. (a + b) = ac� + bc�

(FINAL - 2nd Semester – 2012/2013)

9

Page 11: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

(TMA 2013)

Q. Using DeMorgan's Law, write an expression for the complement of F if F(x,y,z) = x(y' + z). Ans. F(x,y,z) = x(y' + z) F'(x,y,z) = (x(y' + z))' = x'+(y' + z)' = x' + yz' Q. Simplify the following functional expressions using Boolean algebra and its identities. List the identity used at each step (𝐱𝐱 + 𝐲𝐲)����������� (𝐱𝐱 ̅ + 𝐲𝐲 ̅)����������� = (x + y)����������� (x�y�) = (x�y�) (x�y�) = (x�y�) (xy) = (x�x)(yy�) = (0)(0) = 0

DeMorgan DeMorgan Double Complement Associative Inverse Idempotent

(x + y) (x ̅ + y ̅)����������������������

= (x + y)����������� + (x�y�) = (x�y�) + (x�y�) = x�y� + xy

DeMorgan DeMorgan Double Complement

Given the Boolean function: F(x,y,z)=x' y + xyz' a. Derive an algebraic expression for the complement of F. Express in sum-of-products form.

a. (x'y + xyz')' = xy' + xz + x'y' + y' + y'z (not simplified)

10

Page 12: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

• To help eliminate potential confusion, logic canonical, or standardized, form of Boolean functions are used:

• The sum-of-products

• The product-of-sums • The sum of products: consitst of ANDed variables (or product terms) that

Ored together. • Example: f(x,y,z) = xy + yz� + xyz

• The product of sums: consist of ORed variables (sum terms) that are ANDed together

• Example: f(x,y,z) = (x + y)(x + z�)(y + z�)

Note, We will study Sum of Products

Any Boolean expression can be represented in sum-of-products form.

Any Boolean expression can also be represented as a truth table

So any truth table can also be represented in sum-of-products form

How to generate a sum of product expression using truth table For any Boolean expression?

1- Search for the lines where the function outputs a "1" 2- Fir each of these lines, generate a product term of the input variables

a. If a (for instance "x") variable is set to 1, take it as it is ("x") b. If a variable (for instance "y") is set to 0, take its complement ("y�")

3- Sum these products.

Example: Give the sum of products form of the following truth table:

F(x,y,z) =

�̅�𝑥yz + x𝑦𝑦�z + xy𝑧𝑧̅ + xyz

11

Page 13: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Logic Gates The logical operators, functions and expressions have been represented thus far in an abstract sense

What is a Gate?

• It is a group of physical components, or digital circuits, that perform arithmetic operations or make choices in a computer.

• A gate is a small, electronic device that computes various functions of two-valued signals (or more)

• Each gate requires from one to six or more transistors

• If the basic physical component of a computer is the transistor; the basic logic element is the gate

12

Page 14: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

(MTA 2nd Semester – 2012/2013) Draw the combinational circuit that directly implements the Boolean expression: F(x,y,z)= xz + (xy + z')

Give the Boolean expression of the following logical diagram’s output function F(a,b,c).

Sol. F = a�bc + a�bc �+ c

(MTA- 1st Semester – 2013/2014)

Draw a logical diagram for the following function: F1=abc����� + (b ⊕ c�) Hint: Keep F1’s expression intact. Do NOT simplify.

13

Page 15: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Find the output function F2 of the following logical diagram. Hint: Copy the logical diagram to your answer sheet and fill the empty boxes.

Final 2nd Semester – 2012/2013

(FALL – 2011 MTA– MOCK MTA 2012 - Final Summer – 2011) Give the Boolean expression of the following logical diagram’s output function.

(A + B)’(C + D)C’ 14

Page 16: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Universal Gates

The NAND gate is commonly referred to as a universal gate

• Any electronic circuit can be constructed using only NAND gates

(MTA -Fall-2012) Construct an AND gate using only NAND gates. Put labels on your logical circuit to explain how you have obtained the output “xy” from the inputs “x” and “y”.

SOL.

15

Page 17: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

(Final 1st Semester – 2012/2013 ) Consider the function: F(x,y,z) = xy𝑧𝑧̅. Use only two-inputs gates to draw the logical

diagram of F. Draw a second logical diagram that uses only two-inputs NAND gates.

(MTA 2nd Semester – 2012/2013) Construct the XOR operator using only NAND gates. Hint: x XOR y = ((x ' y)' (xy' )' )'

Use only NAND gates to draw the logical diagram of the simplified F= c� + b

16

Page 18: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Why not simply use the AND, OR, and NOT gates we already know exist?

For two reasons:

- NAND gates are cheaper to build than the other gates - complex integrated circuits are often much easier to build using the

same building

• Applying the duality principle, NOR is also a universal gate • In practice, NAND are used for implementing an expression in sum of-

products form • In practice, NOR is used for implementing an expression in product-of-sums

form

• Gates could have multiple inputs:

• Also, sometimes it is useful to depict the output of a gat as Q along with its

Complement Q�

17

Page 19: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Digital Components Every computer is built using collections of gates that are all connected by way of wires

These collections of gates are often quite standard, resulting in a set of building blocks

These building blocks are all constructed using the basic AND, OR, and NOT operations.

building blocks could be:

- Combinational logic

- Sequential logic

Any Boolean expression can be represented as a Logical Digram

Logical Diagram is a combinations of AND, OR, and NOT gates that describes a Boolean expression.

Example: F(x,y,z) = x + y�z

Gates are sold in units called integrated circuits (ICs)

First ICs were SSI (small scale integration – See Lecture 1) chips and contained very few transistors (up to 100 transistors)

We now have ULSI (ultra large-scale integration) with more than 1 million electronic components per chip

18

Page 20: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Combinational circuits - Adder (half adder, full adder, ripple carry adder)

- Decoder

- Multiplexer

Combinational logic is used to build circuits that contain basic Boolean operators, inputs, and outputs.

Half Adder

A half-adder is a very simple combinational circuit

Consider the problem of adding two binary digits together, three cases are possible:

0 + 0 = 0

1 + 0 = 0 + 1 = 1

1 + 1 = 10 (the result is “0” with a carry of “1”)

We have two inputs (the bits to add) and two outputs (the “sum” and the “carry”)

Drawing the truth table lead us to the Boolean function of a half-adder

Note that each output has a Boolean Function

19

Page 21: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Full Adder

A half adder could be extended to a circuit that allows the addition of larger binary numbers: A full adder

Remember how we added binary numbers? We add each column without forgetting the carry from the nearest right column

A full adder have three inputs: The two bits to add (x and y) The carry from the nearest right column (carry-in)

A full adder has two outputs (the “sum” and the “carry”)

Think of how this logic diagram is obtained.

Note that a full-adder is composed of two half-adders and an OR gate.

ripple-carry adder

A full-adder can only add two bits and a carry (three bits)

The simplest way to add large binary numbers is to use a ripple-carry adder

A ripple-carry is a succession of full-adders but it is slow

Faster methods are nowadays implemented in computers (40% to 90% faster than the ripple-carry adder)

(MOCK MTA- October 2012)

Draw the logic diagram of a full adder.

20

Page 22: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Decoder

A decoder decodes binary information from a set of n inputs to a maximum of 2n outputs

A decoder uses the inputs and their respective values to select one specific output line

• For a given input, only one output is set to “1” and all others are set to “0”

Example:

Chip selection application: Selecting one of several memory chips for a given address in a decoder

21

Page 23: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Multiplexer

A multiplexer selects binary information from one of many input lines and directs it to a single output line.

Selection of a particular input line is controlled by a set of selection variables or control lines

22

Page 24: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

A 4-to-1 multiplexer

• We have 4=22 input lines

• To select one of the 4 inputs we need 2 selection bits: S0, S1

A 8-to-1 multiplexer

• We have 8=23 input lines

• To select one of the 8 inputs we need 3 selection bits: S0, S1, S2

A 16-to-1 multiplexer?

A 64-to-1 multiplexer?

23

Page 25: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

Questions:

(MTA 1st Semester – 2012/2013)

a) Copy the following 2-to-4 decoder to your answer sheet with the outputs fulfilled.

b) Consider the following 4-to-1 multiplexer. What are the possible values of the control lines S0S1 in binary?

S1S0 = 01 or S1S0 = 10 (2x0.5 = 1 Mark)

(MTA 1st Semester – 2013/2014)

1. List three examples of combinational circuits and define only one of them. Examples: Adder, Decoder, Multiplexer (1.5 Mark) One correct definition is enough (1 Mark) Adder: Used to add binary numbers.

Decoder: decodes binary information from a set of n inputs to a maximum of 2n outputs.

Multiplexer: selects binary information from one of many input lines and directs it to a single output line.

(MTA 2nd Semester – 2012/2013)

a) Copy the following 2-to-4 decoder to your answer sheet with the inputs fulfilled.

2-to-4 decoder2-to-

4 decoder

1

1

0

1

2

3

0 0 0 1

0

1 4-to-1 multiplexer

I0

I1

I2

I3

S0 S1

1

0

1

24

Page 26: Logic gates Digital Components - etihadaouetihadaou.com/wp-content/uploads/2015/12/Chapter3.pdfDraw the truth table to show all possible outputs of the following Boolean function:

Eng. Ayman Metwali – 966592867601 – [email protected]

More Questions:

a) half adder b) ripple carry adder

c) full adder d) None of the above Describe how each of the following circuits works and indicate typical inputs and outputs. Also provide a carefully labeled "black box" diagram for each. a) Decoder b) Multiplexer Ans. a. A decoder takes n inputs and uses those inputs to select exactly one of (typically) 2n

outputs.

b. A multiplexer uses n control lines to select one of its input lines to route through to the output.

25