Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science 210 Computer Organization Introduction to Boolean Algebra.

Similar presentations


Presentation on theme: "Computer Science 210 Computer Organization Introduction to Boolean Algebra."— Presentation transcript:

1 Computer Science 210 Computer Organization Introduction to Boolean Algebra

2 George Boole English mathematician (1815-1864) Boolean algebra – Logic – Set Theory – Digital circuits – Programming: Conditions in while and if statements

3 Boolean Constants In Boolean algebra, there are only two constants, true and false Boolean constant Binary digit State of a switch Voltage level true1On+5V false0Off0V

4 Boolean Variables Boolean variables are variables that store values that are Boolean constants. Let A be true Let B be false Etc.

5 Boolean Operator AND If A and B are Boolean variables (or expressions) then A AND B is true if and only if both A and B are true.

6 Boolean Operator AND If A and B are Boolean variables (or expressions) then A AND B is false if and only if either A or B are false or they ’ re both false.

7 Boolean Operator AND We denote the AND operation like multiplication in ordinary algebra: AB or A. B

8 Boolean Operator OR If A and B are Boolean variables (or expressions) then A OR B is true if and only if at least one of A and B is true.

9 Boolean Operator OR If A and B are Boolean variables (or expressions) then A OR B is false if and only if both A and B are false.

10 Boolean Operator OR We denote the OR operation like addition in ordinary algebra: A+B

11 Boolean Operator NOT If A is a Boolean variable (or expression) then NOT A has the opposite value from A.

12 Boolean Operator NOT We denote the NOT operation by putting a bar over the variable (or expression) _ A

13 Boolean Expressions As with ordinary algebra, a Boolean expression is a well-formed expression made from – Boolean constants – Boolean variables – Operators AND, OR and NOT –Parentheses Example: __ ____ AB + (A+C)B

14 Evaluating a Boolean expression At any time, the value of a BE can be computed using the current values of the variables. __ AB + (CD) Let A = true Let B = false Let C = true Let D = false Then the resulting value is true

15 Operator precedence NOT comes first, then AND, and finally OR (Like arithmetic negation, product, and addition) A + BC is not the same as (A + B)C

16 Evaluating a Boolean expression Unlike ordinary algebra, for a BE, there are only finitely many possible assignments of values to the variables; so, theoretically, we can make a table, called a truth table, that shows the value of the BE for every possible set of values of the variables. For convenience, use 0 = false 1 = true

17 Truth Table for AND ABAB 000 010 100 111

18 Truth Table for OR ABA+B 000 011 101 111

19 Truth Table for NOT A _A_A 01 10

20 Filling in a Truth Table If there are N variables, there are 2 N possible combinations of values Thus, there are 2 N rows in the truth table Fill in the values by counting up from 0 in binary

21 Construct a truth table for _ ___ E = AB + (A+C)B Example

22 ABC 000 001 010 011 100 101 110 111 _ ___ E = AB + (A+C)B Assign the values of the variables first

23 ABC 000 001 010 011 100 101 110 111 _B_B 1 1 0 0 1 1 0 0 _ ___ E = AB + (A+C)B Then add columns for each operation

24 ABC 000 001 010 011 100 101 110 111 _B_B 1 1 0 0 1 1 0 0 _ ___ E = AB + (A+C)B _ AB 0 0 0 0 1 1 0 0

25 ABC 000 001 010 011 100 101 110 111 _B_B 1 1 0 0 1 1 0 0 _ ___ E = AB + (A+C)B _ AB 0 0 0 0 1 1 0 0 A+C 0 1 0 1 1 1 1 1

26 ABC 000 001 010 011 100 101 110 111 _B_B 1 1 0 0 1 1 0 0 _ ___ E = AB + (A+C)B _ AB 0 0 0 0 1 1 0 0 A+C 0 1 0 1 1 1 1 1 ___ (A+C) 1 0 1 0 0 0 0 0

27 ABC 000 001 010 011 100 101 110 111 _B_B 1 1 0 0 1 1 0 0 _ ___ E = AB + (A+C)B _ AB 0 0 0 0 1 1 0 0 A+C 0 1 0 1 1 1 1 1 ___ (A+C) 1 0 1 0 0 0 0 0 ___ (A+C)B 0 0 1 0 0 0 0 0

28 ABC 000 001 010 011 100 101 110 111 _B_B 1 1 0 0 1 1 0 0 _ ___ E = AB + (A+C)B _ AB 0 0 0 0 1 1 0 0 A+C 0 1 0 1 1 1 1 1 ___ (A+C) 1 0 1 0 0 0 0 0 ___ (A+C)B 0 0 1 0 0 0 0 0 E 0 0 1 0 1 1 0 0

29 Laws of Boolean Algebra

30

31 Boolean Expression Simplification

32


Download ppt "Computer Science 210 Computer Organization Introduction to Boolean Algebra."

Similar presentations


Ads by Google