PPT UNIT 2

advertisement
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 (10110010)2
1’s complement (01001101)2
+
1
01001110
2’s complement of (10110010)2 is (01001110)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)
2)
3)
4)
Determine the 1’s complement of the smaller number.
Add this to the larger number.
There is always a carry.
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 Subtraction
1’s complement method
1111
1111
1010
1’s comp --+ 0 1 0 1
----------------------------0101
carry 1 0 1 0 0
Add carry
0100
+
1
------------------0101
1’S COMPLEMENT SUBTRACTION
B) Subtraction of larger number from smaller number
1)
2)
3)
4)
Determine the 1’s complement of the larger number.
Add this to the smaller number.
There is no carry.
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 Subtraction
1’s complement method
1000
1000
1010
1’s comp --+ 0 1 0 1
-----------------------------0010
1101
No Carry
True answer: 0 0 1 0 (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.
Magnitude
Ex: Numbers Sign
+13
0
000 1101
0
0
000 0000
-46
1
010 1110
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
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
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)
discarded
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)
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)
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
NOT gate
AND gate
OR gate
Universal gates
NAND gate
NOR gate
Special purpose gate
Ex-OR gate
Ex-NOR gate
NOT Gate


is a basic gate having only one input and only one output.
The Boolean expression for NOT gate is Y = A.
Truth Table
Symbol
A

Y= A
Input A
Output Y=A
0
1
1
0
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.
AND Gate

is a basic gate having two or more than two inputs and only one
output.
Truth Table
Symbol
A
B

Input
Y = A.B
Output
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
The output of AND gate is 1, when all the inputs are logic 1, otherwise
output of AND gate is logic 0.
OR Gate

is a basic gate having two or more than two inputs and only one
output.
Truth Table
Input
Symbol
A
B

Y= A+B
Output
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
1
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.
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.
Truth Table
Symbol
A
B
A
B


Input
Y= A.B
Y= A.B
Output
A
B
Y
0
0
1
0
1
1
1
0
1
1
1
0
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.
NOR Gate

is a universal gate having two or more than two inputs and only
one output.
Truth Table
Symbol
A
B
A
B


Input
Output
Y= A+B
Y= A+B
A
B
Y
0
0
1
0
1
0
1
0
0
1
1
0
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.
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
Input
B
AND gate using NAND gate

Boolean expression for AND gate is,
Y=A.B
=A.B
A
B
A.B
Y=A.B
OR gate using NAND gate

Boolean expression for OR gate is,
Y= ( A ).( B )
=A+B
=A+B
A
A
Y= A+B
B
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
=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.
Truth Table
Symbol
A
B

Input
Y= A + B
Output
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
0
When both the inputs are equal, the outputs is 0,
otherwise 1.
Ex-NOR Gate
 It is a special purpose gate having two or more than
two inputs and only one output.
Symbol
A
B
Truth Table
Input
Y= A + B
Output
A
B
Y
0
0
1
0
1
0
1
0
0
1
1
1
 When both the inputs are equal, output is 1,
otherwise 0.
Demorgan’s Theorems

Demorgan’s 1st 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)
Download