Boolean Algebra and Gates
Total Page:16
File Type:pdf, Size:1020Kb
BOOLEAN ALGEBRA In mathematics and mathematical logic, Boolean algebra is the branch of algebra in which the values of the variables are the truth values true and false, usually denoted 1 and 0, respectively. A set of rules or Laws of Boolean Algebra expressions have been invented to help reduce the number of logic gates needed to perform a particular logic operation resulting in a list of functions or theorems known commonly as the Laws of Boolean Algebra. Boolean Algebra is the mathematics we use to analyse digital gates and circuits. We can use these “Laws of Boolean” to both reduce and simplify a complex Boolean expression in an attempt to reduce the number of logic gates required. Boolean Algebra is therefore a system of mathematics based on logic that has its own set of rules or laws which are used to define and reduce Boolean expressions. The variables used in Boolean Algebra only have one of two possible values, a logic “0” and a logic “1” but an expression can have an infinite number of variables all labelled individually to represent inputs to the expression, For example, variables A, B, C etc, giving us a logical expression of A + B = C, but each variable can ONLY be a 0 or a 1. • P1: X = 0 or X = 1 • P2: 0 . 0 = 0 • P3: 1 + 1 = 1 • P4: 0 + 0 = 0 • P5: 1 . 1 = 1 • P6: 1 . 0 = 0 . 1 = 0 • P7: 1 + 0 = 0 + 1 = 1 Table 1: Boolean Postulates Laws of Boolean Algebra Note that every law has two expressions, (a) and (b). This is known as duality. These are obtained by changing every AND(.) to OR(+), every OR(+) to AND(.) and all 1's to 0's and vice-versa. It has become conventional to drop the . (AND symbol) i.e. A.B is written as AB. T1 : Commutative Law (a) A + B = B + A (b) A B = B A T2 : Associate Law (a) (A + B) + C = A + (B + C) (b) (A B) C = A (B C) T3 : Distributive Law (a) A (B + C) = A B + A C (b) A + (B C) = (A + B) (A + C) T4 : Identity Law (a) A + A = A (b) A A = A T5 : (a) (b) T6 : Redundance Law (a) A + A B = A (b) A (A + B) = A T7 : (a) 0 + A = A (b) 0 A = 0 T8 : (a) 1 + A = 1 (b) 1 A = A T9 : (a) (b) T10 : (a) (b) T11 : De Morgan's Theorem (a) (b) Prove T10 : (a) (1) Algebraically: (2) Using the truth table: Logic Gates: logic gate (AND, OR, XOR, NOT, NAND, NOR and XNOR) A logic gate is a building block of a digital circuit. Most logic gates have two inputs and one output and are based on Boolean algebra. At any given moment, every terminal is in one of the two binary conditions false (high) or true (low). False represents 0, and true represents 1. Depending on the type of logic gate being used and the combination of inputs, the binary output will differ. A logic gate can be thought of like a light switch, wherein one position the output is off—0, and in another, it is on—1. Logic gates are commonly used in integrated circuits (IC). Basic logic gates There are seven basic logic gates: AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. AND gate The AND gate is an electronic circuit that gives a high output (1) only if all its inputs are high. A dot (.) is used to show the AND operation i.e. A.B. OR gate The OR gate is an electronic circuit that gives a high output (1) if one or more of its inputs are high. A plus (+) is used to show the OR operation. NOT gate The NOT gate is an electronic circuit that produces an inverted version of the input at its output. It is also known as an inverter. If the input variable is A, the inverted output is known as NOT A. This is also shown as A', or A with a bar over the top, as shown at the outputs. NAND gate This is a NOT-AND gate which is equal to an AND gate followed by a NOT gate. The outputs of all NAND gates are high if any of the inputs are low. The symbol is an AND gate with a small circle on the output. The small circle represents inversion. NOR gate This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all NOR gates are low if any of the inputs are high. EXOR gate The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of its two inputs are high. An encircled plus sign ( ) is used to show the EOR operation. Applications of EXOR gate There are many applications for XOR gate such as: 1. Arithmetic Operations: The XOR gate also called (Medulo Two Adder) , since it is used t give the sum of two binary numbers, it has been used in many arithmetic circuits (it will be explained in latter experiments). 2. Parity Checker: One of the advantages of using digital system, is it's capability of detecting and correction errors. This is used specially when digital information is transmitted or stored. One of the simplest form of error detecting is the parity checker, assume that, we have four bit word, to detect the occurrence of an odd number of errors in this word, a single bit will be added to the word that makes the number of "ones" in the word either even number "Even Parity" or odd number "Odd Parity", so, if an odd number of error occurred in the word then the total number of ones will not remain the same, it will change from odd to even or from even to odd. 3. Controlled Inverter: If one of the input of XOR gate is used as control signal, say B, it will give it's output either as Y=A or Y=A′ depending on control B. How, let's see. If B=0, Y=A′B+AB′==A′0+A1=AB=0,Y=A′B+AB′==A′0+A1=A If B=1,Y=A′B+AB′==A′1+A0=A′B=1,Y=A′B+AB′==A′1+A0=A′ It means if control input B=0 , output Y=A means output just follows input whereas when control input B=1, output Y=A′ means output invert it's input. Hence XOR gate is called as controlled inverter. 4. Binary to Gray / Gray to Binary Conversion: The gray code is widely used in many digital systems, specially in shaft register encoders and analog to digital conversion, but it is difficult to use the gray-code in arithmetic operations, since there are only one bit change between two consecutive gray code number, and it is unweighted code, and the XOR gate is the most suitable gate for this purpose. 5. Combinational Logic Circuit Minimization: Another useful application for XOR gate is, it's use in minimizing combinational circuit which will be dealt with in detail in other experiment. 6. Digital Comparator: Many practical applications require the comparator of two numbers A & B searching for either (a) quality or (b) non quality. EXNOR gate The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will give a low output if either, but not both, of its two inputs are high. The symbol is an EXOR gate with a small circle on the output. The small circle represents inversion. Figure 1: Logic gate symbols Table 1: Logic gates representation using the Truth table Using the AND and NOT Set Using just the AND and NOT set of logic gates we can create the following Boolean functions and equivalent gates. AND/NOT Set Equivalents Using the OR and NOT Set Using the OR and NOT set of logic gates we can create the following Boolean functions and equivalent gates. OR/NOT Set Equivalents Using the Full AND, OR and NOT Set Using the full AND, OR and NOT set of logic gates we can create the Boolean expressions for the Exclusive-OR (Ex-OR) and the NOT Exclusive-OR (Ex-NOR) gates as shown. Full AND/OR/NOT Set to Implement Ex-OR Full AND/OR/NOT Set to Implement Ex-NOR Note that neither the Exclusive-OR gate or the Exclusive-NOR gate can be classed as a universal logic gate as they can not be used on their own or together to produce any other Boolean function. Universal Gates: A universal gate is a gate which can implement any Boolean function without need to use any other gate type. The NAND and NOR gates are universal gates. Logic Gates using only NAND Gates Thus ALL other logic gate functions can be created using only NAND gates making it a universal logic gate. Logic Gates using only NOR Gates Thus ALL other logic gate functions can be created using only NOR gates making it also a universal logic gate. Note also that the implementation of the Exclusive-OR gate is more efficient using NAND gates compared to using NOR gates, while the implementation of the Exclusive-NOR gate is more efficient with NOR gates compared to using NAND gates as in each case only four individual logic gates are required. BOOLEAN FUNCTION A Boolean Function is described by an algebraic expression called Boolean expression which consists of binary variables, the constants 0 and 1, and the logic operation symbols.