190 likes | 489 Views
Discrete Structures Lecture 17 Applications of Propositional Logic Combinational Digital Logic. Digital Circuits. Inputs and Outputs are true and false . Low Voltage/Off = false High Voltage/On = true
E N D
Discrete Structures Lecture 17 Applications of Propositional Logic Combinational Digital Logic
Digital Circuits Inputs and Outputs are true and false. Low Voltage/Off = false High Voltage/On = true Data and programs all represented by sequences of bits 1 (true) and 0 (false).
Combinational Digital Circuits • The output is determined by the current values of the inputs. • The output is not history sensitive, i.e. it doesn’t matter what previous inputs or outputs were. • Examples of computer components using combinational digital circuits: ALU (Arithmetic Logical Unit) memory addressing circuits
Circuit Diagramsshow gates and their interconnections. and-gate (conjunction) z a1 a2 …. an or-gate (disjunction) z a1V a2V …. V an inverter (negation) z ¬a
Contructing Boolean Expressions from Circuits • Assign labels to each wire in the diagram. • Construct an expression according to the wires and the logic gates. • Remove the internal names (using substitution, (3.84)) • Construct a truth table for expression to determine behavior of the circuit. (The behavior of a circuit is a list of inputs and the associated outputs).
Example (problem 5.10 (i) ) a z b (a) Write a boolean expression for the above circuit: ( a b) (z ¬) (b) Remove internal names z ¬(a b) (c) Construct a truth table
Truth Table (b) z ¬(a b) construct a truth table (c)a b a b z T T T F F T F F T F F F F T T T
Example 2: Problem 5.10 (ii) a (a) Construct Boolean Expression: ( a b) ( b V c) (z ) (b) Remove internal names: z (a b) (b V c) (c) Construct a truth table z b c
Example 2: Truth table (b) z (a b) (b V c) construct a truth table (c)a b c a b b V c z T T T T T F T F T T F F F T T F T F F F T F F F T T F F F F F F T T T F T T T F T T F F F F F F
Construct a circuit from a logical expression Divide expression into subexpressions that use logical operators, AND, OR and NOT. Repeat 1 until each subexpression uses only a single operator. 3. Build the circuit using the appropriate gates, starting with the smallest subexpressions and working outward to the larger expressions.
Example 1: Problem 5.15(a) Draw a circuit for each expression, where a, b, and c are the inputs and z is the output. Use only inverters, 2-input-and (2-and) gates, and 2-input-or (2-or) gates. z a b c
a b z c 5.15 (a) (a) z a b c
Example 2: Problem 5.15(d) Draw a circuit for each expression, where a, b, and c are the inputs and z and s the outputs. Use only inverters, 2-and gates, and 2-or gates. (d)(z a ¬b) (s a b)
a s z b 5.15 (d) (d)(z a ¬b) (s a b)
Specification to Implementation • A Boolean expression, C, can be a specification of a combinational circuit, C. The circuit implements the specification,S. (5.8) Circuit C implements specification S exactly when C S is valid. NOTE: C and C are equivalent.
Specification for the Half-Adder (5.10) HA(a,b,s,c): s = (a b) c = (a b) a 1 1 0 0 + b + 1 + 0 + 1 + 0 c s a b c s T T T F F T F F 1 0 0 1 0 1 0 0 T F F T F T F F
Half-Adder HA(a,b,s,c) a b c a a b b s b a
Prove HA circuit implements the specification HA = <(5.5) is HA > c = (a b) = ¬b = (a ) = ¬a = (b ) s = ( V ) = <(3.84a) Substitution--for and > c = (a b) = ¬b = (a ¬b) = ¬a = (b ¬a) s = ( V ) <(3.76b)Weakening - lose and > c = (a b) = (a ¬b) = (b ¬a) s = ( V ) = <(3.84a) Substitution--for and > c = (a b) = (a ¬b) = (b ¬a) s = ((a ¬b) V (b ¬a)) <(3.76b)Weakening - lose and > c = (a b) s = ((a ¬b) V (b ¬a)) = <(3.53) Exclusive OR > c = (a b) s = (a b)