Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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 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 (10110010) 2 1’s complement  (01001101) 2 + 1 01001110 2’s complement of (10110010) 2 is (01001110) 2

3 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

4 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 1 1 1 1 - 1 0 1 0 1’s comp --+ 0 1 0 1--------------- 0 1 0 1carry 1 0 1 0 0 Add carry 0 1 0 0 + 1 ------------------- 0 1 0 1

5 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.

6 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 1 0 0 0 - 1 0 1 0 1’s comp --+ 0 1 0 1--------------- - 0 0 1 0 1 1 0 1 No Carry True answer: 0 0 1 0 (1’s comp

7 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 +130000 1101 0 0 000 0000 -46 1 010 1110

8 Signed no. addition using 2’s Complement Method Case 1: Two positive numbers +29 ---- 0 001 1101 (Augend) +19 ---- 0 001 0011 (Addend) 0 011 0000 (Sum = +48) Case 2: Positive augend & negative addend +39 ---- 0 010 0111 (Augend) - 22 ---- 1 110 1010 (Addend)-2’s comp. 1 0 001 0001 (Sum = +17) Discarded

9 Signed no. addition using 2’s Complement Method Case 3: Positive addend & negative augend - 47 ---- 1 101 0001 (Augend) +29 ---- 0 001 1101 (Addend) 1 110 1110 (Sum = -18)-2’s comp Case 4: Two negative numbers -32 ---- 1 110 0000 (Augend) -44 ---- 1 101 0100 (Addend) 1 1 011 0100 (Sum = -76)-2’s comp discarded

10 Signed no. Subtraction using 2’s Complement Method Case 1: Two positive numbers +28 ---- 0 001 1100 (Minuend) +19 ---- 1 110 1101 (Subtrahend)-2’s comp 1 000 1001 (Sum = +9) Case 2: Positive no. & smaller Negative no. +39 ---- 0 010 0111 (Minuend) -21 ---- 0 001 0101 (Subtrahend)-2’s comp 0 011 1100 (Sum = +60) discarded

11 Signed no. Subtraction using 2’s Complement Method Case 3: Positive No. & larger Negative No. +19 ---- 0 001 0011 (Minuend) -43 ---- 0 010 1011 (Subtrahend)-2’s comp 0 011 1110 (Sum = +62) Case 4: Two negative numbers -57 ---- 1 100 0111 (Minuend) -33 ---- 0 010 0001 (Subtrahend)-2’s comp 1 110 1000 (Sum = -24)

12 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

13 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 0 1 1 0 A Y = A Symbol Truth Table

14 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 000 010 100 111 A Y = A.B B Symbol Truth Table

15 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 000 011 101 111 A Y= A+B B Symbol Truth Table

16 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.

17 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 001 011 101 110 A Y= A.B B B A Symbol Truth Table

18 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 001 010 100 110 A Y= A+B B A B Symbol Truth Table

19 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

20 NOT gate using NAND gate Output is given by, Y= A.B = A. A = A A Y B Input

21 AND gate using NAND gate Boolean expression for AND gate is, Y=A.B =A.B Y=A.B A A.B B

22 OR gate using NAND gate Boolean expression for OR gate is, Y= ( A ).( B ) = A + B A A B B Y= A+B

23 NOT gate using NOR gate Boolean expression for NOT gate is, Y= A+B = A+A = A Input

24 AND gate using NOR gate Boolean expression for AND gate is, Y= ( A )+( B ) = A. B

25 OR gate using NOR gate Boolean expression for OR gate is, Y=A+B =A+B

26 Exclusive / Special Purpose Gate Ex-OR Gate Ex-NOR Gate

27 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 000 011 101 110 Symbol Truth Table

28 Ex-NOR Gate A B Y= A B + InputOutput ABY 001 010 100 111  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

29 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

30 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

31 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)


Download ppt "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."

Similar presentations


Ads by Google