0% found this document useful (0 votes)
35 views47 pages

Lecture 2

Uploaded by

rishi prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views47 pages

Lecture 2

Uploaded by

rishi prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

CS5102: FOUNDATIONS OF COMPUTER SYSTEMS

LECTURE 2: LOGIC GATES


DR. ARIJIT ROY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
INDIAN INSTITUTE OF TECHNOLOGY PATNA

These slides are based on the book: David Money Harris and Sarah L. Harris, Computer Organization and Design
LOGIC GATES
➢ Perform logic functions:
➢ inversion (NOT), AND, OR, NAND, NOR, etc.
➢ Single-input:
➢ NOT gate, buffer
➢ Two-input:
➢ AND, OR, XOR, NAND, NOR, XNOR
➢ Multiple-input

1-<2>
Copyright © 2007 Elsevier
SINGLE-INPUT LOGIC GATES

NOT BUF
A Y A Y

Y=A Y=A

A Y A Y
0 1 0 0
1 0 1 1

1-<3>
Copyright © 2007 Elsevier
TWO-INPUT LOGIC GATES

AND OR
A A
Y Y
B B

Y = AB Y=A+B

A B Y A B Y
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1

1-<4>
Copyright © 2007 Elsevier
TWO-INPUT LOGIC GATES

AND OR
A A
Y Y
B B

Y = AB Y=A+B

A B Y A B Y
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1

1-<5>
Copyright © 2007 Elsevier
MORE TWO-INPUT LOGIC GATES

XOR NAND NOR XNOR


A A A A
Y Y Y Y
B B B B

Y=A+B Y = AB Y=A+B Y=A+B

A B Y A B Y A B Y A B Y
0 0 0 0 0 1 0 0 1 0 0
0 1 1 0 1 1 0 1 0 0 1
1 0 1 1 0 1 1 0 0 1 0
1 1 0 1 1 0 1 1 0 1 1

1-<6>
Copyright © 2007 Elsevier
MULTIPLE-INPUT LOGIC GATES

NOR3
A
B Y
C
Y = A+B+C

A B C Y
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

1-<7>
Copyright © 2007 Elsevier
MULTIPLE-INPUT LOGIC GATES

NOR3
A
B Y
C
Y = A+B+C

A B C Y
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 0

1-<8>
Copyright © 2007 Elsevier
RULES OF COMBINATIONAL COMPOSITION

 Every circuit element is itself combinational


 Every node of the circuit is either designated as an input to the circuit or connects
to exactly one output terminal of a circuit element
 The circuit contains no cyclic paths: every path through the circuit visits each
circuit node at most once
 Example:

2-<9>
COPYRIGHT © 2007 ELSEVIER
SOME DEFINITIONS

➢ Complement: variable with a bar over it


A, B, C
➢ Literal: variable or its complement
A, A, B, B, C, C
➢ Implicant: product of literals
ABC, AC, BC
➢ Minterm: product that includes all input variables
ABC, ABC, ABC
➢ Maxterm: sum that includes all input variables
(A+B+C), (A+B+C), (A+B+C)
2-<10>
Copyright © 2007 Elsevier
SUM-OF-PRODUCTS (SOP) FORM
• All Boolean equations can be written in SOP form
• Each row in a truth table has a minterm
• A minterm is a product (AND) of literals
• Each minterm is TRUE for that row (and only that row)
• The function is formed by ORing the minterms for which the output is TRUE
• Thus, a sum (OR) of products (AND terms)

A B Y minterm
0 0 0 A B
0 1 1 A B
1 0 0 A B
1 1 1 A B
2-<11>
Y = F(A, B) = Copyright © 2007 Elsevier
SUM-OF-PRODUCTS (SOP) FORM
• All Boolean equations can be written in SOP form
• Each row in a truth table has a minterm
• A minterm is a product (AND) of literals
• Each minterm is TRUE for that row (and only that row)
• The function is formed by ORing the minterms for which the output is TRUE
• Thus, a sum (OR) of products (AND terms)

A B Y minterm
0 0 0 A B
0 1 1 A B
1 0 0 A B
1 1 1 A B
2-<12>
Y = F(A, B) = Copyright © 2007 Elsevier
SUM-OF-PRODUCTS (SOP) FORM
• All Boolean equations can be written in SOP form
• Each row in a truth table has a minterm
• A minterm is a product (AND) of literals
• Each minterm is TRUE for that row (and only that row)
• The function is formed by ORing the minterms for which the output is TRUE
• Thus, a sum (OR) of products (AND terms)

A B Y minterm
0 0 0 A B
0 1 1 A B
1 0 0 A B
1 1 1 A B
2-<13>
Y = F(A, B) = AB + AB Copyright © 2007 Elsevier
PRODUCT-OF-SUM (POS) FORM
• All Boolean equations can be written in POS form
• Each row in a truth table has a maxterm
• A maxterm is a sum (OR) of literals
• Each maxterm is FALSE for that row (and only that row)
• The function is formed by ANDing the maxterms for which the output is FALSE
• Thus, a product (AND) of sums (OR terms)

A B Y maxterm
0 0 0 A + B
0 1 1 A + B
1 0 0 A + B
1 1 1 A + B
2-<14>
Y = F(A, B) = (A + B)(A + B)
Copyright © 2007 Elsevier
BOOLEAN EQUATIONS EXAMPLE
➢ You are going to the cafeteria for lunch and you won’t eat corndogs (C)
➢ You won’t eat lunch (E)
➢ If it’s not open (O) or
➢ If they only serve corndogs (C)
➢ Write a truth table for determining if you will eat lunch (E).

O C E
0 0
0 1
1 0
1 1 2-<15>
COPYRIGHT © 2007 ELSEVIER
BOOLEAN EQUATIONS EXAMPLE
➢ You are going to the cafeteria for lunch
➢ You won’t eat lunch (E)
➢ If it’s not open (O) or
➢ If they only serve corndogs (C)
➢ Write a truth table for determining if you will eat lunch (E).

O C E
0 0 0
0 1 0
1 0 1
1 1 0 2-<16>
COPYRIGHT © 2007 ELSEVIER
SOP & POS FORM

➢ SOP – sum-of-products
O C E minterm
0 0 O C
0 1 O C
1 0 O C
1 1 O C
➢ POS – product-of-sums

O C Y maxterm
0 0 O + C
0 1 O + C
1 0 O + C
1 1 O + C
2-<17>
COPYRIGHT © 2007 ELSEVIER
SOP & POS FORM

➢ SOP – sum-of-products
O C E minterm
0 0 0 O C
0 1 0 O C Y = OC
1 0 1 O C
1 1 0 O C
➢ POS – product-of-sums

O C E maxterm
0 0 0 O + C Y = (O + C)(O + C)(O + C)
0 1 0 O + C
1 0 1 O + C
1 1 0 O + C
2-<18>
COPYRIGHT © 2007 ELSEVIER
BOOLEAN ALGEBRA

➢ Set of axioms and theorems to simplify Boolean equations


➢ Like regular algebra, but in some cases simpler because variables can have only two
values (1 or 0)
➢ Axioms and theorems obey the principles of duality:
➢ ANDs and ORs interchanged, 0’s and 1’s interchanged

2-<19>
Copyright © 2007 Elsevier
BOOLEAN AXIOMS

2-<20>
Copyright © 2007 Elsevier
T1: IDENTITY THEOREM
➢ B 1=
➢ B+0=

2-<21>
Copyright © 2007 Elsevier
T1: IDENTITY THEOREM
➢ B 1=B
➢ B+0=B

B
1 = B

B
0 = B

2-<22>
Copyright © 2007 Elsevier
T2: NULL ELEMENT THEOREM
➢ B 0=
➢ B+1=

2-<23>
Copyright © 2007 Elsevier
T2: NULL ELEMENT THEOREM
➢ B 0=0
➢ B+1=1

B
0 = 0

B
1 = 1

2-<24>
Copyright © 2007 Elsevier
T3: IDEMPOTENCY THEOREM
➢ B B=
➢ B+B=

2-<25>
Copyright © 2007 Elsevier
T3: IDEMPOTENCY THEOREM
➢ B B=B
➢ B+B=B

B
B = B

B
B = B

2-<26>
Copyright © 2007 Elsevier
T4: IDENTITY THEOREM
➢ B=

2-<27>
Copyright © 2007 Elsevier
T4: IDENTITY THEOREM
➢ B=B

B = B

2-<28>
Copyright © 2007 Elsevier
T5: COMPLEMENT THEOREM
➢ B B=
➢ B+B=

2-<29>
Copyright © 2007 Elsevier
T5: COMPLEMENT THEOREM
➢ B B=0
➢ B+B=1

B
B = 0

B
B = 1

2-<30>
Copyright © 2007 Elsevier
BOOLEAN THEOREMS: SUMMARY

2-<31>
Copyright © 2007 Elsevier
BOOLEAN THEOREMS OF SEVERAL VARIABLES

2-<32>
Copyright © 2007 Elsevier
SIMPLIFYING BOOLEAN EXPRESSIONS: EXAMPLE 1

Y = AB + AB

2-<33>
Copyright © 2007 Elsevier
SIMPLIFYING BOOLEAN EXPRESSIONS: EXAMPLE 1

Y = AB + AB
= B(A + A) T8
= B(1) T5’
=B T1

2-<34>
Copyright © 2007 Elsevier
SIMPLIFYING BOOLEAN EXPRESSIONS: EXAMPLE 2

Y = A(AB + ABC)

2-<35>
Copyright © 2007 Elsevier
SIMPLIFYING BOOLEAN EXPRESSIONS: EXAMPLE 2

Y = A(AB + ABC)
= A(AB(1 + C)) T8
= A(AB(1)) T2’
= A(AB) T1
= (AA)B T7
= AB T3

2-<36>
Copyright © 2007 Elsevier
DEMORGAN’S THEOREM

A
Y
B
Y = AB = A + B
A
Y
B

A
Y
B
Y=A+B=A B
A
Y
B

2-<37>
COPYRIGHT © 2007 ELSEVIER
BUBBLE PUSHING
➢ Pushing bubbles backward (from the output) or forward (from the inputs) changes
the body of the gate from AND to OR or vice versa.
➢ Pushing a bubble from the output back to the inputs puts bubbles on all gate inputs.

A A
Y Y
B B

➢ Pushing bubbles on all gate inputs forward toward the output puts a bubble on the
output and changes the gate body.

A A
Y Y
B B
2-<38>
COPYRIGHT © 2007 ELSEVIER
BUBBLE PUSHING
➢ What is the Boolean expression for this circuit?

A
B
Y
C
D

2-<39>
Copyright © 2007 Elsevier
BUBBLE PUSHING
➢ What is the Boolean expression for this circuit?

A
B
Y
C
D

Y = AB + CD

2-<40>
Copyright © 2007 Elsevier
BUBBLE PUSHING RULES
• Begin at the output of the circuit and work toward the inputs.
• Push any bubbles on the final output back toward the inputs.
• Draw each gate in a form so that bubbles cancel.

A
B

C Y
D

2-<41>
Copyright © 2007 Elsevier
BUBBLE PUSHING EXAMPLE

A
B

C Y
D

2-<42>
Copyright © 2007 Elsevier
BUBBLE PUSHING EXAMPLE

no output
A bubble
B

C Y
D

2-<43>
Copyright © 2007 Elsevier
BUBBLE PUSHING EXAMPLE

no output
A bubble
B

C Y
D

bubble on
A input and output
B

C Y
D

2-<44>
Copyright © 2007 Elsevier
BUBBLE PUSHING EXAMPLE
no output
A bubble
B

C Y
D

bubble on
A input and output
B

C Y
D
no bubble on
input and output
A
B

C Y
D
2-<45>
Y = ABC + D Copyright © 2007 Elsevier
FROM LOGIC TO GATES
➢ Two-level logic: ANDs followed by ORs
➢ Example: Y = ABC + ABC + ABC

A B C

A B C
minterm: ABC

minterm: ABC

minterm: ABC

Y
2-<46>
COPYRIGHT © 2007 ELSEVIER
THANK YOU!

47

You might also like