Recitation Session 6 CSE341 Computer Organization University at Buffalo radhakri@buffalo.edu March 11, 2016 CSE341 Computer Organization Recitation Session 6 1/26 Recitation Session Outline 1 Overview of Digital Logic and Design 2 Gates, Truth Tables and Logic Equations 3 Combinational and Sequential Logic CSE341 Computer Organization Recitation Session 6 2/26 Introduction to Digital Logic 1 Digital electronics operate with only two voltage levels of interest - a high and a low voltage 2 Different systems use different voltages. Hence logically 1 represents high and 0 represents low voltage 3 Combinational Logic - No memory. The output of a combinational block depends only on the current input 4 Sequential Logic - Output can depend on both the input and the value stored in memory, which is called the state of the logic block CSE341 Computer Organization Recitation Session 6 3/26 Truth Tables 1 Combinational logic block contains no memory, it can be completely specified by defining the values of the outputs for each possible set of input values 2 Such a description is normally given as a truth table 3 For a logic block with n inputs, there are 2n entries in the truth table, since there are that many possible combinations of input values CSE341 Computer Organization Recitation Session 6 4/26 Truth Tables Consider a logic function with three inputs, A, B, and C, and three outputs, D, E, and F. The function is defined as follows 1 D is true if at least one input is true 2 E is true if exactly two inputs are true 3 F is true only if all three inputs are true CSE341 Computer Organization Recitation Session 6 5/26 Truth Tables The truth table will contain 23 = 8 entries Truth tables can completely describe any combinational logic function; how ever, they grow in size quickly and may not be easy to understand. What can we do? - Use Boolean Algebra CSE341 Computer Organization Recitation Session 6 6/26 Boolean Algebra All the variables have the values 0 or 1 and, in typical formulations, there are three operators - AND, OR & NOT 1 D can be formulated as: D = A + B + C 2 F can be formulated as: F = A.B.C 3 How about E? CSE341 Computer Organization Recitation Session 6 7/26 Boolean Algebra E is true if exactly two inputs are true. Think of it in two parts: what must be true for E to be true (two of the three inputs must be true), and what cannot be true (all three cannot be true). Thus we can write E as ((A.B) + (B.C ) + (A.C )).(A.B.C ) We can also derive E by realizing that E is true only if exactly two of the inputs are true. Then we can write E as an OR of the three possible terms that have two true inputs and one false input (A.B.C̄ ) + (B.C .Ā) + (A.C .B̄) CSE341 Computer Organization Recitation Session 6 8/26 Logic Gates CSE341 Computer Organization Recitation Session 6 9/26 3-Bit Decoder Can you build a logic-gate implementation for this decoder? CSE341 Computer Organization Recitation Session 6 10/26 Sum of Products Representation CSE341 Computer Organization Recitation Session 6 11/26 Sum of Products Representation CSE341 Computer Organization Recitation Session 6 12/26 ALU - 1 bit Adder CSE341 Computer Organization Recitation Session 6 13/26 ALU - 1 bit Adder CSE341 Computer Organization Recitation Session 6 14/26 ALU - 1 bit Adder CSE341 Computer Organization Recitation Session 6 15/26 ALU - 32 bit Adder CSE341 Computer Organization Recitation Session 6 16/26 FSM - Finite State Machine CSE341 Computer Organization Recitation Session 6 17/26 FSM - Finite State Machine CSE341 Computer Organization Recitation Session 6 18/26 How to Build a Finite State Machine CSE341 Computer Organization Recitation Session 6 19/26 Traffic Lights Example CSE341 Computer Organization Recitation Session 6 20/26 Traffic Lights Example CSE341 Computer Organization Recitation Session 6 21/26 Traffic Lights Example - State Transition Table CSE341 Computer Organization Recitation Session 6 22/26 Traffic Lights Example - State Diagram CSE341 Computer Organization Recitation Session 6 23/26 Traffic Lights Example - State Equations CSE341 Computer Organization Recitation Session 6 24/26 Synchronous and Asynchronous FSM CSE341 Computer Organization Recitation Session 6 25/26 Flip Flops CSE341 Computer Organization Recitation Session 6 26/26