Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson
2 Logic Design Objective: To provide an important application of propositional logic to the design and simplification of logic circuits.
3 Topics Logic gates and, or, inverter nand Logic circuits Encoder, decoder, multiplexor Simplification of logic circuits Full adder
4 Logic Circuits A single line labeled x is a logic circuit. One end is the input and the other is the output. If A and B are logic circuits so are: and gate or gate inverter (not) A B A A B
5 Logic Circuits Given a boolean expression it is easy to write down the corresponding logic circuit Here is the circuit for the original multiplexor expression x0x0 x1x1 s
6 Logic Circuits Here is the circuit for the simplified multiplexor expression x0x0 x1x1 s
7 Nand Nand – negation of the conjunction operation: A nand gate is an inverted and gate: x y x | y
Nand is functionally complete All boolean functions can be implemented using nand gates (and, or and not can be implemented using nand) not: and: or:
9 Implementing Logic Gates with Transistors output gate +V ground A Transistor NOT Gate A NAND B A +V ground A Transistor NAND Gate B
10 Decoder A decoder is a logic circuit that has n inputs (think of this as a binary number) and 2 n outputs. The output corresponding to the binary input is set to 1 and all other outputs are set to 0. d0d0 d1d1 d2d2 d3d3 b0b0 b1b1
11 Encoder An encoder is the opposite of a decoder. It is a logic circuit that has 2 n inputs and n outputs. The output equal to the input line (in binary) that is set to 1 is set to 1. d0d0 d1d1 d2d2 d3d3 b0b0 b1b1
12 Multiplexor A multiplexor is a switch which routes n inputs to one output. The input is selected using a decoder. d0d0 d1d1 d2d2 d3d3 s0s0 s1s1
XOR “One or the other, but not both” Notation for circuits: x y x y x y
14 Full Adder Used to add to binary numbers stored as an array of bits using carry ripple addition Three binary inputs a, b and CarryIn Two binary outputs Sum and CarryOut such that a + b + CarryIn = 2*CarryOut + Sum Carry 110 A 101 B 111 A+B = 1100
15 Exercise Derive a truth table for the output bits (Sum and CarryOut) of a full adder. Using the truth table derive a sum of products expression for Sum and CarryOut. Draw a circuit for these expressions. Using properties of Boolean algebra simplify your expressions. Draw the simplified circuits.
16 Solution
17 Solution
18 Solution
19 Full Adder Sum = parity(a,b,CarryIn) a b c + a b c a b c CarryOut = majority(a,b,CarryIn) b CarryIn + a CarryIn + a b + a b CarryIn b CarryIn + a CarryIn + a b b a CarryIn Sum