1’S COMPLEMENT REPRESENTATION 1’s complement of a number (binary) is obtained by changing all 1’s to 0 and all 0’s to 1. If one of these numbers is positive then the other number will be negative. Ex := Binary number is (1001) 2 1’s complement is (0110) 2
2’s Complement Representation 2’s complement of a binary number is obtained by adding 1 to the LSB of 1’s complement of that number. Ex:= Binary number is ( ) 2 1’s complement ( ) ’s complement of ( ) 2 is ( ) 2
1’S COMPLEMENT SUBTRACTION Subtraction of binary numbers using 1’s complement allows subtraction only by addition. A) Subtraction of smaller number from larger number 1) Determine the 1’s complement of the smaller number. 2) Add this to the larger number. 3) There is always a carry. 4) Remove the carry and add it to the result
1’S COMPLEMENT SUBTRACTION Example: Subtract 1010 from 1111 using 1’s complement. Also subtract using direct method and compare. Soln: Direct Subtraction1’s complement method ’s comp carry Add carry
1’S COMPLEMENT SUBTRACTION B) Subtraction of larger number from smaller number 1) Determine the 1’s complement of the larger number. 2) Add this to the smaller number. 3) There is no carry. 4) To get an answer in true form, take the 1’s complement and change the sign.
1’S COMPLEMENT SUBTRACTION Example: Subtract 1010 from 1000 using 1’s complement. Also subtract using direct method and compare. Soln: Direct Subtraction1’s complement method ’s comp No Carry True answer: (1’s comp
Signed Binary Number Representation Binary numbers are represented with a separate sign bit along with the magnitude. In 8 bit binary number, the MSB is the sign bit and remaining 7 bits is the magnitude. The magnitude part contains binary equivalent for +ve numbers, while 2’s complement form for negative numbers. Ex: NumbersSignMagnitude
Signed no. addition using 2’s Complement Method Case 1: Two positive numbers (Augend) (Addend) (Sum = +48) Case 2: Positive augend & negative addend (Augend) (Addend)-2’s comp (Sum = +17) Discarded
Signed no. addition using 2’s Complement Method Case 3: Positive addend & negative augend (Augend) (Addend) (Sum = -18)-2’s comp Case 4: Two negative numbers (Augend) (Addend) (Sum = -76)-2’s comp discarded
Signed no. Subtraction using 2’s Complement Method Case 1: Two positive numbers (Minuend) (Subtrahend)-2’s comp (Sum = +9) Case 2: Positive no. & smaller Negative no (Minuend) (Subtrahend)-2’s comp (Sum = +60) discarded
Signed no. Subtraction using 2’s Complement Method Case 3: Positive No. & larger Negative No (Minuend) (Subtrahend)-2’s comp (Sum = +62) Case 4: Two negative numbers (Minuend) (Subtrahend)-2’s comp (Sum = -24)
Digital Principle Digital Signals A signal is called as digital signals if it has only finite number of predetermined distinct magnitudes. Logic Gates : Logic gates are decision making electronic circuit, which will check particular decision for input signal. LOGIC GATES Basic gates Universal gates Special purpose gate NOT gate NAND gate Ex-OR gate AND gate NOR gate Ex-NOR gate OR gate
NOT Gate is a basic gate having only one input and only one output. The Boolean expression for NOT gate is Y = A. From the truth table, when input is 1, output is 0 and when input is 0, output is 1. Hence the NOT gate is also called as inverter or complementary gate. Input AOutput Y=A A Y = A Symbol Truth Table
AND Gate is a basic gate having two or more than two inputs and only one output. The output of AND gate is 1, when all the inputs are logic 1, otherwise output of AND gate is logic 0. InputOutput ABY A Y = A.B B Symbol Truth Table
OR Gate is a basic gate having two or more than two inputs and only one output. The output of OR gate is 1 when any one input or all the inputs are logic 1 otherwise output of OR gate is logic 0. InputOutput ABY A Y= A+B B Symbol Truth Table
Universal Gates Universal gates are of two types, NAND gate NOR gate They are called as universal gates because with the help of these gates, we can derive any basic gate such as AND, OR & NOT gate or any combination of these basic gates.
NAND Gate is a universal gate which has two or more than two inputs and only one output. NAND gate is a combination of AND gate and NOT gate. When any one input or all the inputs of NAND gate are 0, then output of NAND gate is logic 1, otherwise output of NAND gate is logic 0. InputOutput ABY A Y= A.B B B A Symbol Truth Table
NOR Gate is a universal gate having two or more than two inputs and only one output. NOR gate is a combination of OR gate and NOT gate. The output of NOR gate is 1 when any one input or all the inputs are logic 1 otherwise output of NOR gate is logic 0. InputOutput ABY A Y= A+B B A B Symbol Truth Table
Implementation of Basic Gates Using Universal Gates NAND gate as a Universal gate 1) NOT gate using NAND gate 2) AND gate using NAND gate 3) OR gate using NAND gate NOR gate as a Universal gate 1) NOT gate using NOR gate 2) AND gate using NOR gate 3) OR gate using NOR gate
NOT gate using NAND gate Output is given by, Y= A.B = A. A = A A Y B Input
AND gate using NAND gate Boolean expression for AND gate is, Y=A.B =A.B Y=A.B A A.B B
OR gate using NAND gate Boolean expression for OR gate is, Y= ( A ).( B ) = A + B A A B B Y= A+B
NOT gate using NOR gate Boolean expression for NOT gate is, Y= A+B = A+A = A Input
AND gate using NOR gate Boolean expression for AND gate is, Y= ( A )+( B ) = A. B
OR gate using NOR gate Boolean expression for OR gate is, Y=A+B =A+B
Exclusive / Special Purpose Gate Ex-OR Gate Ex-NOR Gate
Ex-OR Gate It is a special purpose gate having two or more than two inputs and only one output. When both the inputs are equal, the outputs is 0, otherwise 1. A B Y= A B + InputOutput ABY Symbol Truth Table
Ex-NOR Gate A B Y= A B + InputOutput ABY It is a special purpose gate having two or more than two inputs and only one output. When both the inputs are equal, output is 1, otherwise 0. Symbol Truth Table
Demorgan’s Theorems Demorgan’s 1 st Theorems: It state that compliment of product is equal to sum of the compliment. A.B=A+B Demorgan’s 2nd Theorems: It state that compliment of sum is equal to product of the compliment. A+B=A.B
Sum of Product The logical sum of two or more logical product term is called as sum of product expression. It is basically an OR operation of AND operated variables such as Y=AB+BC+AC
Product of Sum The logical product of two or more logical sum term is called as product of sum expression. It is basically an AND operation of OR operated variables such as Y=(A+B+C).(A+B+C)