Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor.

Similar presentations


Presentation on theme: "Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor."— Presentation transcript:

1 Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor

2 Items for Today Last week –Digitization –Graphic, audio and video data sizes This time –Digital logic, Boolean algebra, and circuits –Logic gates and truth tables

3 A Fundamental Unity Set Theory &Logic Union Intersection Complement Boolean Algebra OR AND NOT Electric Circuits Parallel Series Inversion Binary Arithmetic Addition Multiplication Twos Complement

4 Electric Circuits +offon off on  offon off onoffon Parallel Series

5 Binary Arithmetic +01 00001 1 10  01 000 101 Means zero, carry 1 (two distinct outputs)

6 Boolean Algebra +01 001 111  01 000 101 OR AND  01 001 110 Exclusive OR Binary addition: ExOR (for one’s place) plus AND (for carry)

7 A Fundamental Unity Any logical or mathematical problem may be formulated in set theoretic terms Boolean logic may be used to represent any set- theoretic operation The fundamental elements of Boolean logic may be implemented in electric circuits Therefore, any logical or mathematical problem may be implemented in electrical circuits!

8 Logic Gates

9 What are Logic Gates? Logic gates are conventional arrangements of switches that are treated as units They abstract away from the details of individual switches –They may be implemented in any number of ways –Only their function is important

10 Symbols for Logic Gates AND ORXOR NotBuff

11 Functions of Logic Gates and01 000 101 or01 001 111 xor01 001 110 nand01 011 110 nor01 010 100 xnor01 010 101 A¬A 01 10 ABuff 11 00

12 Boolean Logic Hints AND: if you know that one input is 0, it doesn’t matter what the other input is, the output will be 0 OR: if you know that one input is 1, it doesn’t matter what the other input is, the output will always be 1 XOR: if you know that the inputs are the same, then the output will always be 0

13 Some Example Circuits

14 XOR E A0101A0101 B0011B0011 C0111C0111 D1110D1110 E0110E0110 D A C B

15 De Morgan’s Law (1) E A0101A0101 B0011B0011 C1010C1010 D1100D1100 E0111E0111 A C B D

16 De Morgan’s Law (2) A0101A0101 B0011B0011 C1010C1010 D1100D1100 E0001E0001 E B D A C

17 Encoding Position in a 2-by-2 Board 0111 0010 r1 r2 c1c2 row col black red

18 0111 0010 r1 r2 c1c2 col row Decoding Position to a 2-by-2 Board

19 4-line multiplexer d c b a C A0101A0101 B0011B0011 CabcdCabcd AB

20 4-line demultiplexer AB A0101A0101 B0011B0011 a IN 0 b 0 IN 0 c 0 IN 0 d 0 IN d c b a

21 Other Applications of Boolean Logic

22 Graphic Paint/Copy Modes COPYORXOR

23 Database Search Queries A keyword represents the set of documents containing it Boolean AND represents the intersection of the sets corresponding to two (or more) search terms Boolean OR represents the union of the sets corresponding to two (or more) search terms

24 Addition: Half Adder +0001 00 01 10 S A B xor01 0 0 1 1 1 0 and01 000 101 C The half adder sends a carry, but can’t accept one +

25 Addition: Truth Tables CI 0 1 A01010101A01010101 B00110011B00110011 SCO S01101001S01101001 0 1 0 1

26 Addition: Full Adder A B S CO CI

27 More Digits Full Adder ci co s abab a0 s0 b0 Full Adder ci co s abab a1 s1 b1 Full Adder ci co s abab a2 s2 b2 Full Adder ci co s abab a3 s3 b3 Full adders can be cascaded

28 Subtraction Complement Representations

29 Subtraction –0001 00 01 –0100 Subtraction is asymmetrical That makes it harder We have to borrow sometimes

30 Solution: “Easy Subtraction” 456 –123 333 999 –123 876 Subtraction is easy if you don’t have to borrow i.e. if all the digits of the minuend are greater than (or equal to) all those of the subtrahend This will always be true if the minuend is all 9’s: 999, or 999999, or 9999999999 etc.

31 How can we use easy subtraction? Subtract the subtrahend from 999 (or whatever we need) (easy) Add the result to the minuend (easy enough) Add 1 (easy) Subtract 1000 (not too hard) Difference = Minuend + 999 – Subtrahend + 1 – 1000 This works for binary as well as decimal

32 Subtraction Example 10010101 –01101110 ????????? 11111111 –01101110 10010001 This is the same as inverting each bit + 10010101 100100110 +1 100100111 –100000000 00100111 Regular addition Add one Now drop the highest bit (easy: it’s out of range) 00100111

33 Subtraction Procedure Invert each bit Regular addition Add one Now drop the highest bit (easy: it’s out of range) Each of these steps is a simple operation we can perform using our logic circuits Bitwise XOR Cascaded Adders Add carry bit Drop the highest bit (overflows)

34 Negative Numbers Invert each bit Add one These steps make the negative of a number in twos-complement notation Twos complements can be added to other numbers normally Positive numbers cannot use the highest bit (the sign bit) This is the normal representation of negative numbers in binary

35 Counting 000000000 000000011 000000102 000000113 000001004 000001015 000001106 000001117 000010008 000010019 etc. 11111111–1 11111110–2 11111101–3 11111100–4 11111011–5 11111010–6 11111001–7 11111000–8 11110111–9 11110110–10 etc.

36 Representations The number representation you use (encoding) affects the way you need to do arithmetic (procedure) This is true of all codes: encoding (representation) affects procedure (algorithm) Good binary codes make use of properties of binary numbers and digital logic

37


Download ppt "Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor."

Similar presentations


Ads by Google