+ All Categories
Home > Documents > 04 Logic Gates1

04 Logic Gates1

Date post: 06-Apr-2018
Category:
Upload: murugesan-arumugam
View: 219 times
Download: 0 times
Share this document with a friend
36
 1 1 Logic Gates Logic Gates CS/APMA 202, Spring 2005 CS/APMA 202, Spring 2005 Rosen, section 10.3 Rosen, section 10.3  Aaron Bloomfield  Aaron Bloomfield
Transcript
Page 1: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 1/36

  11

Logic GatesLogic GatesCS/APMA 202, Spring 2005CS/APMA 202, Spring 2005

Rosen, section 10.3Rosen, section 10.3 Aaron Bloomfield Aaron Bloomfield

Page 2: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 2/36

Page 3: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 3/36

33

Review of Boolean algebraReview of Boolean algebra

Not is a horizontal bar above the number Not is a horizontal bar above the number  0 = 10 = 1 1 = 01 = 0

Or is a plusOr is a plus 0+0 = 00+0 = 0 0+1 = 10+1 = 1 1+0 = 11+0 = 1 1+1 = 11+1 = 1

 And is multiplication And is multiplication 0*0 = 00*0 = 0 0*1 = 00*1 = 0 1*0 = 01*0 = 0

1*1 = 11*1 = 1

_  _ 

  _  _ 

Page 4: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 4/36

Page 5: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 5/36

5

Quick surveyQuick survey

I understand the basics of BooleanI understand the basics of Boolean

algebraalgebra

a)a)

Absolutely!Absolutely!

b)b) More or lessMore or less

c)c) Not reallyNot really

d)d) Boolean what?Boolean what?

Page 6: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 6/36

66

Today’s demotivatorsToday’s demotivators

Page 7: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 7/36

77

Basic logic gatesBasic logic gates

NotNot

 And And

Or Or 

NandNand

Nor Nor 

Xor Xor 

 x x 

 x y 

 xy  x y 

xyz 

z  x +y  x y 

 x y 

x +y +z 

 x y 

 xy 

 x +y  x y 

 x ⊕y  x y 

Page 8: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 8/36

88

Rosen, §10.3 question 1Rosen, §10.3 question 1

Find the output of the following circuitFind the output of the following circuit

 Answer: ( Answer: ( x+y  x+y )y)y Or (Or ( x  x ∨∨y y ))∧¬∧¬yy

 x y  x +y 

( x +y )y 

 __  __ 

 x y 

Page 9: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 9/36

99

 x 

Rosen, §10.3 question 2Rosen, §10.3 question 2

Find the output of the following circuitFind the output of the following circuit

 Answer: xy Answer: xy Or Or ¬¬((¬¬ x  x ∧¬∧¬y y ) ≡) ≡ x  x ∨∨y y 

 x 

 x y x y 

 _ _  _ _   ___  ___ 

Page 10: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 10/36

10

Quick surveyQuick survey

I understand how to figure out whatI understand how to figure out what

a logic gate doesa logic gate does

a)a)

Absolutely!Absolutely!

b)b) More or lessMore or less

c)c) Not reallyNot really

d)d) Not at allNot at all

Page 11: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 11/36

1111

Rosen, §10.3 question 6Rosen, §10.3 question 6

Write the circuits for the followingWrite the circuits for the following

Boolean algebraic expressionsBoolean algebraic expressions

a)a)

  x  x 

++

y y 

 x 

 x 

 x 

__  __ 

 x  x +y 

Page 12: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 12/36

1212

 x 

 x 

 x 

Rosen, §10.3 question 6Rosen, §10.3 question 6

Write the circuits for the followingWrite the circuits for the following

Boolean algebraic expressionsBoolean algebraic expressions

b)b)

(( x  x 

++

y y )) x  x 

 _______  _______ 

 x 

 x +y  x +y  ( x +y ) x 

Page 13: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 13/36

1313

Writing xor using and/or/notWriting xor using and/or/not

 p p ⊕⊕ qq ≡≡ (( p p ∨∨ qq)) ∧∧¬(¬( p p ∧∧ qq))

 x  x ⊕⊕ yy ≡≡ (x + y)((x + y)( xy  xy ))

 x y x ⊕y

1 1 0

1 0 1

0 1 1

0 0 0

 x 

 x +y 

 xy xy 

( x +y )(xy)

 ____  ____ 

Page 14: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 14/36

14

Quick surveyQuick survey

I understand how to write a logicI understand how to write a logic

circuit for simple Boolean formulacircuit for simple Boolean formula

a)a) Absolutely!Absolutely!

b)b) More or lessMore or less

c)c) Not reallyNot really

d)d) Not at allNot at all

Page 15: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 15/36

1515

Converting decimal numbers toConverting decimal numbers to

binarybinary

5353 = 32 + 16 + 4 + 1= 32 + 16 + 4 + 1

= 2= 255 + 2+ 244 + 2+ 222 + 2+ 200

= 1*2= 1*255 + 1*2+ 1*244 + 0*2+ 0*233 + 1*2+ 1*222 + 0*2+ 0*211 + 1*2+ 1*200

= 110101 in binary= 110101 in binary= 00110101 as a full byte in binary= 00110101 as a full byte in binary

211= 128 + 64 + 16 + 2 + 1211= 128 + 64 + 16 + 2 + 1

= 2= 277 + 2+ 266 + 2+ 244 + 2+ 211 + 2+ 200

= 1*2= 1*277 + 1*2+ 1*266 + 0*2+ 0*255 + 1*2+ 1*244 + 0*2+ 0*233 + 0*2+ 0*222 ++

1*21*211 + 1*2+ 1*200

= 11010011 in binary= 11010011 in binary

Page 16: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 16/36

1616

Converting binary numbers toConverting binary numbers to

decimaldecimalWhat is 10011010 in decimal?What is 10011010 in decimal?1001101010011010 = 1*2= 1*277 + 0*2+ 0*266 + 0*2+ 0*255 + 1*2+ 1*244 + 1*2+ 1*233 ++

0*20*222 + 1*2+ 1*211 + 0*2+ 0*200

= 2= 277 + 2+ 244 + 2+ 233 + 2+ 211

= 128 + 16 + 8 + 2= 128 + 16 + 8 + 2= 154= 154

What is 00101001 in decimal?What is 00101001 in decimal?

00101001 = 0*200101001 = 0*277 + 0*2+ 0*266 + 1*2+ 1*255 + 0*2+ 0*244 + 1*2+ 1*233 ++0*20*222 + 0*2+ 0*211 + 1*2+ 1*200

= 2= 255 + 2+ 233 + 2+ 200

= 32 + 8 + 1= 32 + 8 + 1

= 41= 41

Page 17: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 17/36

1717

 A bit of binary humor A bit of binary humor

 Available for $15 at Available for $15 athttp://www.thinkgeek.com/http://www.thinkgeek.com/tshirts/frustrations/5aa9/tshirts/frustrations/5aa9/

Page 18: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 18/36

18

Quick surveyQuick survey

I understand the basics of I understand the basics of 

converting numbers betweenconverting numbers between

decimal and binarydecimal and binary

a)a) Absolutely!Absolutely!

b)b) More or lessMore or less

c)c) Not reallyNot reallyd)d) Not at allNot at all

Page 19: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 19/36

1919

How to add binary numbersHow to add binary numbers

Consider adding two 1-bit binary numbersConsider adding two 1-bit binary numbers x  x andand y y  0+0 = 00+0 = 0

0+1 = 10+1 = 1

1+0 = 11+0 = 1

1+1 = 101+1 = 10

Carry isCarry is x  x AND AND y y 

Sum isSum is x  x XORXOR y y 

The circuit to compute this is called a half-adder The circuit to compute this is called a half-adder 

 x y  Carry Sum

0 0 0 00 1 0 1

1 0 0 1

1 1 1 0

Page 20: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 20/36

2020

The half-adder The half-adder 

Sum =Sum = x  x XORXOR y y 

Carry =Carry = x  x AND AND y y 

 x y  Sum

Carry

 x y  Sum

Carry

Page 21: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 21/36

2121

Using half addersUsing half adders

We can then use a half-adder to computeWe can then use a half-adder to compute

the sum of two Boolean numbersthe sum of two Boolean numbers

1 1 0 0

+ 1 1 1 0

010?

001

Page 22: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 22/36

22

Quick surveyQuick survey

I understand half addersI understand half adders

a)a) Absolutely!Absolutely!

b)b) More or lessMore or lessc)c) Not reallyNot really

d)d) Not at allNot at all

Page 23: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 23/36

Page 24: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 24/36

2424

The full adder The full adder 

The “HA” boxes are half-addersThe “HA” boxes are half-adders

HAX

Y

S

C

HAX

Y

S

C

 x 

s

HAX

Y

S

C

HAX

Y

S

C

 x 

Page 25: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 25/36

2525

The full adder The full adder 

The full circuitry of the full adder The full circuitry of the full adder 

 x 

s

Page 26: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 26/36

2626

 Adding bigger binary numbers Adding bigger binary numbers

Just chain full adders together Just chain full adders together 

HAX

Y

S

C

FAC

Y

X

S

C

FAC

Y

X

S

C

FAC

Y

X

S

C

 x 1y 1

 x 2 y 2  x 3y 3

 x 0 

y 0 s0 

s1

s2 

s3c 

Page 27: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 27/36

2727

 Adding bigger binary numbers Adding bigger binary numbers

 A half adder has 4 logic gates A half adder has 4 logic gates

 A full adder has two half adders plus a OR gate A full adder has two half adders plus a OR gate Total of 9 logic gatesTotal of 9 logic gates

To addTo add nn bit binary numbers, you need 1 HA andbit binary numbers, you need 1 HA andnn-1 FAs-1 FAs

To add 32 bit binary numbers, you need 1 HATo add 32 bit binary numbers, you need 1 HAand 31 FAsand 31 FAs Total of 4+9*31 = 283 logic gatesTotal of 4+9*31 = 283 logic gatesTo add 64 bit binary numbers, you need 1 HATo add 64 bit binary numbers, you need 1 HAand 63 FAsand 63 FAs Total of 4+9*63 = 571 logic gatesTotal of 4+9*63 = 571 logic gates

Page 28: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 28/36

28

Quick surveyQuick survey

I understand (more or less) aboutI understand (more or less) about

adding binary numbers using logicadding binary numbers using logic

gatesgates

a)a) Absolutely!Absolutely!

b)b) More or lessMore or less

c)c)

Not reallyNot reallyd)d) Not at allNot at all

Page 29: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 29/36

2929

More about logic gatesMore about logic gates

To implement a logic gate in hardware,To implement a logic gate in hardware,

you use a transistor you use a transistor 

Transistors are all enclosed in an “IC”, or Transistors are all enclosed in an “IC”, or 

integrated circuitintegrated circuit

The current Intel Pentium IV processorsThe current Intel Pentium IV processors

have 55 million transistors!have 55 million transistors!

Page 30: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 30/36

3030

Pentium math error 1Pentium math error 1

Intel’s PentiumsIntel’s Pentiums(60Mhz – 100 Mhz)(60Mhz – 100 Mhz)had a floating pointhad a floating pointerrorerror

Graph of z = y/xGraph of z = y/x

Intel reluctantlyIntel reluctantly

agreed to replaceagreed to replacethem in 1994them in 1994

Graph from http://kuhttp.cc.ukans.edu/cwis/units/IPPBR/pentium_fdiv/pentgrph.htmlGraph from http://kuhttp.cc.ukans.edu/cwis/units/IPPBR/pentium_fdiv/pentgrph.html

Page 31: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 31/36

Page 32: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 32/36

3232

Flip-flopsFlip-flops

Consider the following circuit:Consider the following circuit:

What does it do?What does it do?

Page 33: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 33/36

3333

MemoryMemory

 A flip-flop holds a single bit of memory A flip-flop holds a single bit of memory The bit “flip-flops” between the two NANDThe bit “flip-flops” between the two NAND

gatesgates

In reality, flip-flops are a bit moreIn reality, flip-flops are a bit more

complicatedcomplicated Have 5 (or so) logic gates (transistors) per flip-Have 5 (or so) logic gates (transistors) per flip-

flopflop

Consider a 1 Gb memory chipConsider a 1 Gb memory chip

1 Gb = 8,589,934,592 bits of memory1 Gb = 8,589,934,592 bits of memory That’s about 43 million transistors!That’s about 43 million transistors!

In reality, those transistors are split into 9In reality, those transistors are split into 9

ICs of about 5 million transistors eachICs of about 5 million transistors each

Page 34: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 34/36

34

Quick surveyQuick survey

I felt I understood the material in thisI felt I understood the material in this

slide set…slide set…

a)a) Very wellVery well

b)b) With some review, I’ll be goodWith some review, I’ll be good

c)c) Not reallyNot really

d)d) Not at allNot at all

Page 35: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 35/36

35

Quick surveyQuick survey

 The pace of the lecture for this slide The pace of the lecture for this slide

set was…set was…

a)a) FastFast

b)b) About rightAbout right

c)c) A little slowA little slow

d)d)  Too slow Too slow

Page 36: 04 Logic Gates1

8/3/2019 04 Logic Gates1

http://slidepdf.com/reader/full/04-logic-gates1 36/36

3636

End of lecture on 27 January 2005End of lecture on 27 January 2005


Recommended