logic introduction to logic gates that perform boolean operations … · 2006-09-26 · intro to...

28
CSC258 Lecture Slides © Steve Engels, 2006 Slide 1 of 20 Introduction to Logic Gates Using transistor technology, we can create basic logic gates that perform boolean operations on high (5V) and low (0V) signals. Example: NAND gate

Upload: others

Post on 25-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

1of

20

Intr

odu

ctio

n t

o Lo

gic

Gat

es

•U

sing

tra

nsis

tor

tech

nolo

gy, w

e ca

n cr

eate

bas

ic lo

gic

gate

sth

at p

erfo

rm b

oole

anop

erat

ions

on

high

(5V

) an

d lo

w (

0V)

sign

als.

•Ex

ampl

e: N

AND

gat

e

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

2of

20

Intr

o to

Log

ic G

ates

•D

igita

l log

ic g

ates

for

m t

he b

asis

for

all

impl

emen

ted

com

putin

g m

achi

nes.

•Ba

sic

gate

s:–

AND

: *,

∧–

OR

: +,

∨–

NO

T:

¬, ¯

–N

AND

–N

OR

–XO

R:

⊕–

XNO

R

•Re

latio

nshi

ps b

etw

een

inpu

ts a

nd o

utpu

ts a

re

outli

ned

in t

ruth

tab

les

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

3of

20

Tru

th T

able

s

•AN

D g

ate

C =

A

B

•O

R ga

te

C =

A+

B

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

4of

20

Tru

th T

able

s (c

ont’

d)

•Bu

ffer

•N

OT

Gat

e

B =

A

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

5of

20

Tru

th T

able

s (c

ont’

d)

•N

AND

Gat

e

•N

OR G

ate

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

6of

20

Tru

th T

able

s (c

ont’

d)

•XO

R G

ate

C =

A ⊕

B

•XN

OR

Gat

e

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

7of

20

Logi

c O

pera

tion

s•

Logi

c ga

tes

all f

ollo

w t

he s

ame

rule

s as

logi

c op

erat

ors

in p

rogr

amm

ing

lang

uage

s.

AND

:1

x =

x0

x =

0O

R:

1 +

x =

10

+ x

= x

NO

T:x

+ x

= 1

x x

= 0

XO

R:

x ⊕

y =

y ⊕

x

•O

rder

of

oper

atio

ns a

lso

appl

ies

to t

hese

ope

ratio

ns,

whe

n pu

ttin

g to

geth

er t

he d

igita

l circ

uit.

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

8of

20

Des

ign

ing

a C

ircu

it

•Ta

sk #

1:G

iven

a lo

gic

expr

essi

on, d

eter

min

e th

e eq

uiva

lent

gat

e re

pres

enta

tion.

–Ex

ampl

e:

f =

x1

x 2+

x1

x 2

•G

roup

ter

ms

acco

rdin

g to

ord

er o

f op

erat

ions

:–

NO

T te

rms

first

–AN

D t

erm

s ne

xt–

OR t

erm

s la

st

•Th

e ex

ampl

e ge

ts r

ewrit

ten

as:

f =

((x

1)

x 2)

+ (

x 1(x

2))

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

9of

20

Cir

cuit

Exa

mpl

e

•By

eva

luat

ing

the

term

s of

the

exp

ress

ion

from

the

in

side

-out

, we

cons

truc

t th

e di

agra

m a

bove

.•

Of

cour

se, t

his

can

also

be

repr

esen

ted

as a

sin

gle

gate

, but

the

und

erly

ing

com

plex

ity is

the

sam

e.

x 1 x 2

f

x 1 x 2f

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

10of

20

Mor

e C

ircu

it D

esig

n•

Task

#2:

Giv

en a

tru

th t

able

th

at s

peci

fies

a lo

gic

circ

uit’s

be

havi

our,

des

ign

the

equi

vale

nt c

ircui

t.–

Exam

ple:

thr

ee-in

put

circ

uit

•Su

m-o

f-pr

oduc

tte

chni

que:

–G

roup

all

row

s w

ith a

n ou

tput

of

f=1

into

a s

ingl

e AN

D t

erm

(pr

oduc

t)–

Com

bine

the

se A

ND

ter

ms

with

a s

ingl

e O

R g

ate

(sum

)

•N

ote:

All t

ruth

tab

les

can

be

conv

erte

d in

to g

ate

form

by

usin

g th

is t

echn

ique

.

fx 3

x 2x 1

01

11

10

11

01

01

00

01

11

10

10

10

11

00

00

00

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

11of

20

Sum

-of-

Pro

duct

s•

A m

inte

rmis

a p

rodu

ct t

erm

w

here

eac

h of

the

inpu

t va

riabl

es o

ccur

s ex

actly

on

ce.

–Th

e su

m-o

f-pr

oduc

ts t

echn

ique

is

als

o re

ferr

ed t

o as

a

disj

uctio

nof

min

term

s

•G

roup

ing

toge

ther

the

m

inte

rms

for

all r

ows

whe

re

f=1

yiel

ds t

he f

ollo

win

g ex

pres

sion

:

x 1 x 2 x 3 x 1 x 2 x 3 x 1 x 2 x 3 x 1 x 2 x 3

f

f = x

1x2x

3+

x 1x 2

x 3+

x 1x 2

x 3+

x 1x 2

x 3

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

12of

20

Red

uci

ng

Min

term

s•

This

is a

n ug

ly e

xpre

ssio

n.Ca

n w

e fin

d so

me

way

to

min

imiz

eth

e ex

pres

sion

, to

mak

e it

mor

e co

mpa

ct?

•W

e ca

n, b

y em

ploy

ing

a se

t of

bin

ary

logi

c ru

les:

f = x

1x2x

3+

x 1x 2

x 3+

x 1x 2

x 3+

x 1x 2

x 3

xy=

x +

yx

+ y

= x

y

de M

orga

n

xx=

0x

+ x

= 1

Com

plem

ent

x =

xIn

volu

tion

xx=

xx

+ x

= x

Idem

pote

nt

x(y

+ z

) =

xy

+ x

zx

+ y

z=

(x

+ y

)(x

+ z

)D

istr

ibut

ive

(xy)

z =

x(y

z)(x

+ y

) +

z =

x +

(y

+ z

)As

soci

ativ

e

xy=

yx

x +

y =

y +

xCo

mm

utat

ive

Alge

brai

c Id

entit

yRul

e N

ame

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

13of

20

Sim

plif

icat

ion

Exa

mpl

e•

Redu

ce t

he f

ollo

win

g su

m o

f pr

oduc

ts:

•St

eps:

–D

istr

ibut

ive:

–Co

mpl

emen

t:–

Iden

tity:

–Id

empo

tent

:–

Asso

ciat

ive:

–D

istr

ibut

ive:

–Co

mpl

emen

t:–

Iden

tity:

f = x

1x2x

3+

x 1x 2

x 3+

x 1x 2

x 3+

x 1x 2

x 3+

x 1x 2

x 3

f = x

1x3(x

2+

x 2) +

x1x

2x3

+ x 1

x 2x 3

+ x 1

x 2x 3

f = x

1x3

1+

x 1x 2

x 3+

x 1x 2

x 3+

x 1x 2

x 3

f = x

1x3

+ x 1

x 2x 3

+ x 1

x 2x 3

+ x 1

x 2x 3

f = x

1x3

+ x 1

x 2x 3

+ x 1

x 2x 3

+ (x

1x2x

3+

x 1x 2

x 3)

f = x

1x3

+ (x

1x2x

3+

x 1x 2

x 3)+

(x1x

2x3

+ x 1

x 2x 3

)f =

x1x

3+

x 1x 3

(x2

+ x 2

)+ x

1x2 (x

3+

x 3)

f = x

1x3

+ x 1

x 31

+ x 1

x 21

f = x

1x3

+ x 1

x 3+

x 1x 2

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

14of

20

Sim

plif

icat

ion

Exa

mpl

e

•St

eps

(con

t’d):

–(f

rom

pre

viou

s sl

ide)

:–

Dis

trib

utiv

e:–

Com

plem

ent:

–Id

entit

y:

•So

lutio

n is

:

f = x

1x3

+ x 1

x 3+

x 1x 2

f = x

3(x1

+ x 1

) + x

1x2

f = x

31

+ x 1

x 2f =

x3

+ x 1

x 2

f = x

3+

x 1x 2

f

x 1 x 2 x 3

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

15of

20

Mor

e de

Mor

gan

•Im

plic

atio

ns o

f de

Mor

gan’

s La

w:

x 1 x 2x 1

+ x 2

x 1 x 2x 1

x 2

x +

y =

x y

x 1 x 2x 1

x 2x 1 x 2

x 1+

x 2

x y

= x

+ y

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

16of

20

Kar

nau

ghM

aps

•A

Karn

augh

map

is a

noth

er w

ay o

f re

pres

entin

g a

circ

uit’s

tru

th t

able

–Pr

esen

ted

as a

tw

o-di

men

sion

al g

rid o

f 2n

squa

res.

–Ea

ch a

xis

repr

esen

ts t

he d

iffer

ent

inpu

t va

lues

to

the

circ

uit,

an

d th

e co

nten

ts o

f ea

ch s

quar

e re

pres

ents

the

out

put

valu

e fo

r th

e in

ters

ectin

g in

put

valu

es.

•H

oriz

onta

lly a

nd v

ertic

ally

adj

acen

t sq

uare

s on

ly d

iffer

by

a si

ngle

inpu

t va

riabl

e•

Num

ber

of r

ows

and

colu

mns

mus

t be

a p

ower

of

2•

Not

e:ro

w a

nd c

olum

n la

bels

mus

t al

so d

iffer

by

a si

ngle

dig

it.

–Si

mpl

ified

circ

uit

is f

ound

by

circ

ling

grou

ps o

f ad

jace

nt 1

’s

on t

he g

rid.

–Res

ult:

The

min

imal

exp

ress

ion

for

the

circ

uit.

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

17of

20

Kar

nau

ghM

aps

•Ex

ampl

e:f =

x1x

2x3

+ x 1

x 2x 3

+ x 1

x 2x 3

+ x 1

x 2x 3

+ x 1

x 2x 3

11

10

01

10

x 1x 2

x 300

0111

10

0 1

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

18of

20

Kar

nau

ghM

aps

•N

ext

step

: ci

rcle

blo

cks

of 1

’s–

Cann

ot c

onta

in a

ny 0

’s in

the

blo

ck–

Hei

ght

and

wid

th o

f bl

ock

mus

t be

a p

ower

of

2–

Bloc

ks a

re a

llow

ed t

o ov

erla

p

•Ci

rcle

d bl

ocks

cor

resp

ond

to x

3an

d x 1

x 2

11

10

01

10

x 1x 2

x 300

0111

10

0 1

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

19of

20

Kar

nau

ghEx

ampl

e

11

11

1

00

11

1

11

01

1

10

01

1

11

10

1

00

10

1

11

00

1

10

00

1

11

11

0

10

11

0

11

01

0

00

01

0

11

10

0

00

10

0

11

00

0

00

00

0

XD

CB

A

Out

put

Inpu

ts•

Task

:G

iven

the

tru

th t

able

on

the

right

, det

erm

ine

the

sim

ples

t eq

uiva

lent

gat

e ar

rang

emen

t.

01

11

01

11

11

10

01

10

CD

AB

0001

1110

00 01 11 10

X =

AC

+ D

+ A

BC

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

20of

20

“Don

’t C

are”

Con

diti

ons

•So

met

imes

cer

tain

out

puts

are

not

def

ined

–Ex

ampl

e:A

thre

e-in

put

circ

uit

whe

re t

he o

utpu

t is

1 if

any

of

the

inpu

ts is

1, a

nd 0

if a

ll of

the

inpu

ts a

re 0

.–

The

outp

ut c

an b

e an

ythi

ng in

the

cas

e w

here

tw

o or

mor

e in

puts

ar

e 1,

sin

ce w

e do

n’t

cons

ider

tho

se c

ases

.–

In t

hose

cas

es, l

abel

the

out

put

as “

don’

t ca

re”

(or

“X”)

.

XX

X1

1X

10

x 1x 2

x 300

0111

10

0 1

•“D

on’t

care

” co

nditi

ons

are

usef

ul b

ecau

se t

hey

can

be t

reat

ed a

s ei

ther

1

or 0

, dep

endi

ng o

n w

hich

mak

es t

hing

s ea

sier

.–

In r

eal l

ife, y

ou u

sual

ly

have

to

set

it to

som

e se

nsib

le v

alue

.

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

21of

20

“Don

’t C

are”

Exa

mpl

e

•Ad

ding

milk

to

beve

rage

s:–

If a

pat

ron

orde

rs c

offe

e (C

), a

dd m

ilk. I

f th

e pa

tron

ord

ers

tea

(T),

onl

y ad

d m

ilk if

lem

on (

L) h

asn’

t al

read

y be

en a

dded

.

–Th

e “d

on’t

care

” co

nditi

ons

are

som

etim

es w

ritte

n as

“d”

(as

in

the

tex

tboo

k, f

or e

xam

ple)

. In

indu

stry

tho

ugh,

“X”

is m

ore

com

mon

ly u

sed,

as

in t

he p

hras

e “X

-pro

paga

tion”

.

1X

0X

1X

1X

LC

T00

0111

10

0 1

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

22of

20

The

Impo

rtan

ce o

f N

AN

D

•N

AND

gat

es a

re c

onsi

dere

d to

be

the

“uni

vers

al”

gate

, bec

ause

any

oth

er g

ate

can

be s

ynth

esiz

ed

usin

g N

AND

.•

In f

act,

mos

t ga

tes

are

impl

emen

ted

in s

olid

-sta

te

TTL

chip

s (T

rans

isto

r-Tr

ansi

stor

Log

ic)

–e.

g. 7

4LS0

0 in

tegr

ated

circ

uit

(IC)

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

23of

20

Get

tin

g to

NA

ND

•H

ow d

o w

e cr

eate

a N

AND

-bas

ed c

ircui

t, if

our

ap

proa

ch s

o fa

r ha

s be

en t

o fin

d su

m-o

f-pr

oduc

ts?

–An

swer

:By

usi

ng d

e M

orga

n’s

rule

!

•Ac

cord

ing

to d

e M

orga

n (s

ee s

lide

15),

•Th

eref

ore,

the

fol

low

ing

are

equi

vale

nt a

s w

ell:

equi

vale

nt to

f

x 1 x 2 x 3f

x 1 x 2 x 3

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

24of

20

Nei

ther

…N

OR

•N

AND

and

NO

R g

ates

are

the

che

apes

t to

mak

e,

and

the

mos

t co

mm

only

fou

nd in

IC

chip

s•

Typi

cal p

roce

ss f

or c

reat

ing

a N

AND

-bas

ed c

ircui

t is

:1.

repr

esen

t tr

uth

tabl

e in

Kar

naug

h m

ap2.

isol

ate

smal

lest

ter

ms

that

pro

duce

hig

h ou

tput

3.pr

oduc

e su

m-o

f-pr

oduc

t m

odel

with

AN

D &

OR g

ates

4.co

nver

t m

odel

to

NAN

D r

epre

sent

atio

n

•W

hat

abou

t cr

eatin

g an

equ

ival

ent

circ

uit

out

of

NO

R g

ates

? Is

tha

t po

ssib

le?

–Req

uire

s ob

tain

ing

max

term

sof

the

tru

th t

able

, and

pr

oduc

ing

a pr

oduc

t-of

-sum

sm

odel

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

25of

20

Max

term

s•

A m

axte

rmis

a s

um o

f in

put

valu

es w

here

eve

ry in

put

valu

e oc

curs

exa

ctly

onc

e.•

Whe

n ex

pres

sing

a t

ruth

tab

le,

each

max

term

rep

rese

nts

a ro

w

whe

re t

he o

utpu

t is

0, s

uch

that

th

e m

axte

rm w

ill g

ive

a tr

ue

valu

e in

all

case

s ex

cept

for

tha

t ro

w.

–M

axte

rms

for

exam

ple

tabl

e:•

(x1

+ x

2+

x3)

•(x

1+

x2

+ x

3)•

(x1

+ x

2+

x3)

•(x

1+

x2

+ x

3)

fx 3

x 2x 1

01

11

10

11

01

01

00

01

11

10

10

10

11

00

00

00

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

26of

20

PO

S (P

rodu

ct o

f Su

ms)

•In

stea

d of

cre

atin

g a

disj

unct

ion

of c

ases

whe

re t

he

outp

ut o

f th

e ci

rcui

t is

1, t

he p

rodu

ct-o

f-su

ms

tech

niqu

e cr

eate

s a

conj

unct

ion

of t

he c

ases

whe

re

the

outp

ut is

0.

–Fr

om p

revi

ous

exam

ple:

(x1

+ x

2+

x3)

(x

1+

x2

+ x

3)

(x1

+ x

2+

x3)

(x

1+

x2

+ x

3)

•Th

ese

equa

tions

can

be

redu

ced

usin

g th

e sa

me

tech

niqu

es u

sed

on m

inte

rms.

–bo

olea

n lo

gic

rule

s–

Karn

augh

map

s

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

27of

20

NO

R C

ircu

it•

A pr

oduc

t-of

-sum

circ

uit

will

res

ult

in s

ever

al O

R

gate

s, u

nite

d by

a s

ingl

e AN

D g

ate.

•Th

roug

h de

Mor

gan’

s ru

le, t

his

conv

erts

to

a ci

rcui

t m

ade

up e

ntire

ly o

f N

OR g

ates

.•

Des

ign

deci

sion

:of

the

max

term

and

min

term

re

pres

enta

tions

, whi

ch h

as t

he f

ewes

t re

duce

d te

rms?

10

00

11

10

x 1x 2

x 300

0111

10

0 1x 1

f

x 3x 2 x 3

CSC

258

Lect

ure

Slid

es ©

Ste

ve E

ngel

s, 20

06Sl

ide

28of

20

Oth

er T

TL L

ogic

•In

add

ition

to

NAN

D c

ircui

ts, i

nver

ter

circ

uits

are

co

mm

only

use

d as

wel

l (e.

g. 7

4LS0

4).

•W

hen

usin

g th

ese

chip

s, m

ake

sure

you

hav

e th

e pi

ns a

nd t

he o

rient

atio

n co

rrec

t. F

or e

xam

ple,

ap

plyi

ng t

he v

olta

ge s

ourc

e to

the

gro

und

pin

can

have

som

e ve

ry u

nple

asan

t re

sults

.