and, or, not gates...gates • gates can have more than 2 inputs but the functions stay the same –...

39

Upload: others

Post on 15-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 2: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

AND, OR, NOT Gates

NOT (Inverter) AND OR

X ZX

YZ Z

X

Y

X Y Z

0 0 0

0 1 0

1 0 0

1 1 1

X Y Z

0 0 0

0 1 1

1 0 1

1 1 1

X Z

0 1

1 0

YXZ YXZ ~XXXZ or or '

AND = ‘ALL’

(true when ALL

inputs are true)

OR = ‘ANY’

(true when ANY

input is true)

Page 3: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 4: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 5: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

Gates

• Gates can have more than 2 inputs but the functions stay the same– AND = output = 1 if ALL inputs are 1

• Outputs 1 for only 1 input combination

– OR = output = 1 if ANY input is 1

• Outputs 0 for only 1 input combination

X Y Z F

0 0 0 0

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 1

X Y Z F

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

3-input AND 3-input OR

Fx

y

z

Fx

y

z

Page 6: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 7: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

NAND and NOR Gates

NAND NOR

ZX

YZ

X Y Z

0 0 1

0 1 0

1 0 0

1 1 0

X

Y

X Y Z

0 0 1

0 1 1

1 0 1

1 1 0

YXZ YXZ

X Y Z

0 0 0

0 1 0

1 0 0

1 1 1

X Y Z

0 0 0

0 1 1

1 0 1

1 1 1

AND NAND OR NOR

True if NOT ANY

input is true

True if NOT ALL

inputs are true

Page 8: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

XOR and XNOR Gates

XOR

ZX

Y

X Y Z

0 0 0

0 1 1

1 0 1

1 1 0

XNOR

ZX

Y

X Y Z

0 0 1

0 1 0

1 0 0

1 1 1

YXZ YXZ

True if an odd # of inputs are true

2 input case: True if inputs are different

True if an even # of inputs are true

2 input case: True if inputs are same

Page 9: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

LOGIC FUNCTIONS INTRO

Page 10: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

Logic Function Domain

x

y

z

0 1

0 1

0 1

X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

z

yx

Truth Table

Binary Decision Tree

Venn Diagram

if(x,y,z == 000) then

else if (x,y,z == 001) then

else if (x,y,z == 010) then

If or Case statement

Page 11: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

3-bit Prime Number Function

x

y

z

0 1

0 1

0 1

X Y Z P

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 0

1 1 1 1

X Y Z P

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 0

1 1 1 1

Truth Table

ON-set

OFF-set

0 0 1 1 0 1 0 1

z

yx

Primes between

0-7

Venn Diagram

if(x,y,z == 000) then

P = 0

else if (x,y,z == 001) then

P = 0

else if (x,y,z == 010) then

P = 1

If or Case statement

Page 12: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination

© Mark Redekopp, All rights reserved

Multi-output Functions• N-inputs, m-outputs

– Rather than simply T/F output, may want to produce a

set of signals (i.e. a multi-bit number, etc.)

• Write out all combos, interpret combos, then

write in answer

I3 I2 I1 C1 C0

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

I3 I2 I1 C1 C0

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 1

I3 I2 I1 M1 M0

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

I3 I2 I1 M1 M0

0 0 0 0 0

0 0 1 0 1

0 1 0 1 0

0 1 1 1 0

1 0 0 1 1

1 0 1 1 1

1 1 0 1 1

1 1 1 1 1

1’s Count of Input Max ON-input’s ID

Page 13: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 14: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 15: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 16: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 17: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 18: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 19: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 20: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 21: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 22: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 23: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 24: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 25: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 26: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 27: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 28: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 29: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 30: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 31: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 32: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 33: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 34: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 35: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 36: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 37: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 38: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination
Page 39: AND, OR, NOT Gates...Gates • Gates can have more than 2 inputs but the functions stay the same – AND = output = 1 if ALL inputs are 1 • Outputs 1 for only 1 input combination