Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 22: 11/19/2002CS170 Fall 20021 CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.

Similar presentations


Presentation on theme: "Lecture 22: 11/19/2002CS170 Fall 20021 CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University."— Presentation transcript:

1 Lecture 22: 11/19/2002CS170 Fall 20021 CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 22: 11/19/2002

2 CS170 Fall 20022 Outline Appendix B Basic definitions truth tables logic equations gates

3 Lecture 22: 11/19/2002CS170 Fall 20023 Logic Blocks (Logic Functions) Electronics inside a modern computer are digital Two voltage levels: High and Low correspond to 1 and 0 (On/Off)  1Logically true (asserted)  0Logically false (deasserted) Logic blocks(Logic Functions) Black box which has some set of inputs (logic variables-independent variables) and some other set of outputs (logic variables-dependent variables) Classes of Logic Functions Without memory (Combinatorial) Output depends only on the current input With memory (Sequential) Output can depend on both inputs and value stored in memory (memory is called the state of the logic block)

4 Lecture 22: 11/19/2002CS170 Fall 20024 Combinatorial Logic Functions Defining Combinatorial logic Functions 1. Truth tables2. Boolean Algebra3. Logic Gates Truth Tables With N inputs and each input having the value 1 or 0, there are precisely 2 N possible combinations of inputs (How do we list the input combinations?) For each of the possible combinations specify the output (1 or 0) of each output variable Example Three inputs A, B, and C, and three outputs D, E, and F. The function is defined as follows. D is true if at least one input is true. E is true if exactly two inputs are true. F is true only if all three inputs are true.  (D,E,F) = (1,0,0) means one and only one input of (A,B,C) is true (Why?)  (D,E,F) = (1,1,0) means exactly two of (A,B,C) are true

5 Lecture 22: 11/19/2002CS170 Fall 20025 Truth Table Example InputsOutputs ABCDEF 000000 001100 010100 011110 100100 101110 110110 111101 D is true if at least one input is true. E is true if exactly two inputs are true. F is true only if all three inputs are true. Truth table completely defines the logic function Given an input (A,B,C) we can lookup the output (D,E,F) Problems?

6 Lecture 22: 11/19/2002CS170 Fall 20026 Boolean Algebra 1/2 Express Logic functions using logic equations (named after Boole, a 19 th century British mathematician) Rules All variables are either 1 or 0 Basic operators which act on variables. The common operators are  OR operator denoted by “+”. A OR B = A+B = 1 if either A or B or both are true (logical sum)  AND operator denoted by “.”. A AND B = A.B = 1 if both A and B are true (logical product)  Unary operator NOT written as (complement or inversion operator)

7 Lecture 22: 11/19/2002CS170 Fall 20027 Boolean Algebra 2/2 Identity Law Zero and One Laws Inverse Laws Commutative Laws Associative Laws Distributive Laws DeMorgan’s Laws Boolean Algebra Laws

8 Lecture 22: 11/19/2002CS170 Fall 20028 Generating Logic Equations from Truth Tables Two methods which can be used to systematically generate the logical function from a truth table Method A: Sum of Products(a logical sum of products (terms using AND operator)) Find all rows of the truth table for which the function is TRUE (1) For each such row, AND the variables or the complement of the variables. If the variable is true, use the variable in the AND. If the variable is False, use the complement of the variable in the AND Take the OR of all these terms. This is the desired function Method B: Product of Sums (a logical AND of sums (terms using the OR operator)) Find all rows of the truth table for which the function is FALSE (0) For each such row, OR the variables or the complement of the variables. If the variable is TRUE, use the complement of the variable in the OR. If the variable is False, use the variable in the OR Take the AND of all of these terms. This is the desired function

9 Lecture 22: 11/19/2002CS170 Fall 20029 Example InputsOutputs ABCDEF 000000 001100 010100 011110 100100 101110 110110 111101 Output D Use method B (Why?) D = A+B+C Output F Use method A (Why?) F = A.B.C Output E Use method A (Why?) Equivalent to

10 Lecture 22: 11/19/2002CS170 Fall 200210 Logic Gates 1/2 Devices which implement basic logic functions  AND gate implements AND function  OR gate implements OR function  NOT function implemented with an inverter A B A.B A B A+B A Logic diagram of C A B A+B A+B+C

11 Lecture 22: 11/19/2002CS170 Fall 200211 Logic Gates 2/2 Can we simplify Using DeMorgan’s Theorem ABAB Can you express output E in the previous example as a gates diagram. Use only 2 input AND, OR, or inverters?

12 Lecture 22: 11/19/2002CS170 Fall 200212 Logic Gates Diagram or Circuit The process of obtaining a combinatorial logic circuit 1.Define the logic function 2.Translate the function to a truth table 3.Generate the logic equation using either sum of products or product of sums 4.Generate the logic circuit by replacing the logic operators by corresponding logic gates Between steps 3 and 4 we can simplify the resulting logic expression before obtaining the logic circuit, but we ignore this for now

13 Lecture 22: 11/19/2002CS170 Fall 200213 NAND and NOR Gates Universal gates. (AND, OR, NOT can be expressed in terms of NAND and NOR) NOR (An OR gate followed by an inverter) defined as X NOR Y = NOT (X OR B) = NAND (An AND gate followed by an inverter) defined as X NAND Y = NOT (X AND Y) = Can we show that NOR gate is universal? X NOR X = NOT X = X NOR X X + Y = NOT (X NOR Y) = (X NOR Y) NOR (X NOR Y) X.Y = (NOT X) NOR (NOT Y) = (X NOR X) NOR (Y NOR Y) Problem B.4 requests proving that NAND is universal?


Download ppt "Lecture 22: 11/19/2002CS170 Fall 20021 CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University."

Similar presentations


Ads by Google