Logic • Formal logic is a branch of mathematics that deals with true and false values instead of numbers. • In 1840’s, George Boole developed many Logic ideas. • A logic gate performs a logical operation on one or more logic inputs and produces a single logic output.
The logic normally performed is Boolean logic and is most commonly found in digital circuits . Logic gates are primarily implemented electronically using diodes or transistors , but can also be constructed using electromagnetic relays ( relay logic ), fluidic logic , pneumatic logic , optics , molecules , or even mechanical elements. In electronic logic, a logic level is represented by a voltage or current, depending on the type of electronic logic in use.
Logic Signals There are a number of different systems for representing binary information in physical systems. Here are a few. A voltage signal with zero (0) corresponding to 0 volts and one (1) corresponding to five or three volts. A sinusoidal signal with zero corresponding to some frequency, and one corresponding to some other frequency. A current signal with zero corresponding to 4 milliamps and one corresponding to 20 milliamps. And one last way is to use switches, OPEN for "0" and CLOSED for "1". (And there are more ways!)
Boolean algebra is the algebra of two values. These are usually taken to be 0 and 1, as we shall do here, although F and T, false and true, etc. are also in common use. Whereas elementary algebra is based on numeric operations multiplication xy , addition x + y , and negation − x , Boolean algebra is customarily based on logical counterparts to those operations, namely : (1) conjunction x ∧ y ( AND ) (2) disjunction x ∨ y ( OR ) (3) complement or negation ¬ x ( NOT ). In electronics: AND is represented as a multiplication OR is represented as an addition NOT is represented with an overbar
Truth Table A truth table is a good way to show the function of a logic gate. It shows the output states for every possible combination of input states. The symbols 0 (false) and 1 (true) are usually used in truth tables.
A Truth Table: A The output A is true when the input a is NOT true, the output is the inverse of the input: a = NOT A A NOT gate can only have one input. A NOT gate is also called an inverter. NOT a A 0 1 1 0
AND A B A*B Logic Gate: Series Circuit: A B Truth Table: A*B "If A AND B are both 1, then Q should be 1.“ (All or nothing.) A B A*B 0 0 0 0 1 0 1 0 0 1 1 1
Three Input AND Gate A B C ABC 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1
A B A+B Logic Gate: Parallel Circuit: A B Truth Table: A+B OR "If A is 1 OR B is 1 (or both are 1), then Q is 1." A B A+B 0 0 0 0 1 1 1 0 1 1 1 1
<ul><li>Because + and * are binary operations, they can be cascaded together to OR or AND multiple inputs. </li></ul>A B C A B C A+B+C A+B+C A B A B C ABC ABC
NAND and NOR Gates <ul><li>NAND and NOR gates can greatly simplify circuit diagrams. NAND inverts the output of AND. </li></ul><ul><li>NOR inverts the output of OR. </li></ul>NAND NOR A B A B 0 0 1 0 1 1 1 0 1 1 1 0 A B A B 0 0 1 0 1 0 1 0 0 1 1 0
XOR and XNOR Gates XOR XNOR XOR (exclusive OR) :"If either A OR B is 1, but NOT both, Q is 1." XNOR (exclusive NOR) : invert output of XOR A B A B 0 0 0 0 1 1 1 0 1 1 1 0 A B A B 0 0 1 0 1 0 1 0 0 1 1 1
<ul><li>Find the output of the following circuit </li></ul><ul><li>Answer: ( x+y )y </li></ul>x + y __ y ( x + y ) y
<ul><li>Find the output of the following circuit </li></ul><ul><li>Answer: xy </li></ul>x y x y x y _ _ ___
Give the Boolean expression of the given circuit x + y xy xy ( x + y )(xy) Answer: ( x + y )(xy)
<ul><li>Write the circuits for the following Boolean algebraic expressions </li></ul><ul><li>x + y </li></ul>__ x x + y
<ul><li>Write the circuits for the following Boolean algebraic expressions </li></ul><ul><li>( x + y ) x </li></ul>_______ x + y x + y ( x + y ) x
More about logic gates <ul><li>To implement a logic gate in hardware, you use a transistor </li></ul><ul><li>Transistors are all enclosed in an “IC”, or integrated circuit </li></ul><ul><li>The current Intel Pentium IV processors have 55 million transistors! </li></ul>
Flip-flops <ul><li>Consider the following circuit: </li></ul><ul><li>What does it do? </li></ul>
<ul><li>A flip-flop holds a single bit of memory </li></ul><ul><li>In reality, flip-flops are a bit more complicated </li></ul><ul><ul><li>Have 5 (or so) logic gates (transistors) per flip-flop </li></ul></ul><ul><li>Consider a 1 Gb memory chip </li></ul><ul><ul><li>1 Gb = 8,589,934,592 bits of memory </li></ul></ul><ul><ul><li>That’s about 43 million transistors! </li></ul></ul><ul><li>In reality, those transistors are split into 9 ICs of about 5 million transistors each </li></ul>If you arrange the gates correctly, they will remember an input value. MEMORY This simple concept is the basis of RAM (random access memory) in computers, and also makes it possible to create a wide variety of other useful circuits. Memory relies on a concept called feedback . That is, the output of a gate is fed back into the input.
Exercises: 1.Give the Boolean expression of the given gate. 3.Draw a logic circuit for AB + AC. 2.Give the Boolean expression of the given gate. Answer: (A + B)C Answer: A + BC + D
Exercises: 4.Draw a logic circuit for (A + B)(C + D) C. 5. Give the truth table for a 3-input (A,B & C) OR gate. 6. What type of logic gate's behavior does this truth table represent? 7.Give the Boolean expression of the given gate.
8.Give the output expressions of the given gates. Exercises: a . b . c . d . e . f .
Answers to Exercises: 3. AB + AC. 4. (A + B)(C + D)C. 5 . 3-input OR gate ABC 6 . 3-input OR gate 7 .
Answers to Exercises: 8 . a.) (ABC)(DE). b.) (ABC)+(DE). c.) (R+S+T) (X+Y+Z). d.) (R+S+T)+(X+Y+Z). e.) (JK)(M + N). f.) (AB) (M + N) (X + Y).