Unit 1-1
Unit 1-1
Examples:
The position in the decimal number system specifies the power of the base (10). The 0 is the
minimum value of the digit, and 9 is the maximum value of the digit. For example, the decimal
number 2541 consist of the digit 1 in the unit position, 4 in the tens position, 5 in the hundreds
position, and 2 in the thousand positions and the value will be written as:
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Examples:
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
Examples:
As, we have four types of number systems so each one can be converted into the remaining three
systems. There are the following conversions possible in Number System
Let's take an example to understand how the conversion is done from binary to decimal.
Example 1: (10110.001)2
We multiplied each bit of (10110.001)2 with its respective positional weight, and last we add the
products of all the bits with its weight.
(10110.001)2=(1×24)+(0×23)+(1×22)+(1×21)+(0×20)+
(0×2-1)+(0×2-2)+(1×2-3)
(10110.001)2=(1×16)+(0×8)+(1×4)+(1×2)+(0×1)+
(0×1⁄2)+(0×1⁄4)+(1×1⁄8)
(10110.001)2=16+0+4+2+0+0+0+0.125
(10110.001)2=(22.125 )10
1. In the first step, we have to make the pairs of three bits on both sides of the binary point. If there will
be one or two bits left in a pair of three bits pair, we add the required number of zeros on extreme
sides.
2. In the second step, we write the octal digits corresponding to each pair.
Example 1: (111110101011.0011)2
1. Firstly, we make pairs of three bits on both sides of the binary point.
On the right side of the binary point, the last pair has only one bit. To make it a complete pair of
three bits, we added two zeros on the extreme side.
(111110101011.0011)2=(7653.14)8
1. In the first step, we have to make the pairs of four bits on both sides of the binary point. If there will
be one, two, or three bits left in a pair of four bits pair, we add the required number of zeros on
extreme sides.
2. In the second step, we write the hexadecimal digits corresponding to each pair.
Example 1: (10110101011.0011)2
1. Firstly, we make pairs of four bits on both sides of the binary point.
On the left side of the binary point, the first pair has three bits. To make it a complete pair of four
bits, add one zero on the extreme side.
(011110101011.0011)2=(7AB.3)16
1. In the first step, we perform the division operation on integer and successive part with base 'r'. We
will list down all the remainders till the quotient is zero. Then we find out the remainders in reverse
order for getting the integer part of the equivalent number of base 'r'. In this, the least and most
significant digits are denoted by the first and the last remainders.
2. In the next step, the multiplication operation is done with base 'r' of the fractional and successive
fraction. The carries are noted until the result is zero or when the required number of the equivalent
digit is obtained. For getting the fractional part of the equivalent number of base 'r', the normal
sequence of carrying is considered.
1. In the first step, we perform the division operation on the integer and the successive quotient with
the base of binary(2).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
binary(2).
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 2.
152/2 76 0 (LSB)
76/2 38 0
38/2 19 0
19/2 9 1
9/2 4 1
4/2 2 0
2/2 1 0
1/2 0 1(MSB)
(152)10=(10011000)2
Step 2:
Now, perform the multiplication of 0.27 and successive fraction with base 2.
0.50×2 0 1
(0.25)10=(.01)2
1. In the first step, we perform the division operation on the integer and the successive quotient with
the base of octal(8).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
octal(8).
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 8.
152/8 19 0
19/8 2 3
2/8 0 2
(152)10=(230)8
Step 2:
Now perform the multiplication of 0.25 and successive fraction with base 8.
Operation Result carry
0.25×8 0 2
(0.25)10=(2)8
1. In the first step, we perform the division operation on the integer and the successive quotient with
the base of hexadecimal (16).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
hexadecimal (16).
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 8.
152/16 9 8
9/16 0 9
(152)10=(98)16
Step 2:
Now perform the multiplication of 0.25 and successive fraction with base 16.
Operation Result carry
0.25×16 0 4
(0.25)10=(4)16
Let's take an example to understand how the conversion is done from octal to decimal.
Example 1: (152.25)8
Step 1:
We multiply each digit of 152.25 with its respective positional weight, and last we add the products
of all the bits with its weight.
(152.25)8=(1×82)+(5×81)+(2×80)+(2×8-1)+(5×8-2)
(152.25)8=64+40+2+(2×1⁄8)+(5×1⁄64)
(152.25)8=64+40+2+0.25+0.078125
(152.25)8=106.328125
Example 1: (152.25)8
(152.25)8=(001101010.010101)2
1. In the first step, we will find the binary equivalent of number 25.
2. Next, we have to make the pairs of four bits on both sides of the binary point. If there will be one,
two, or three bits left in a pair of four bits pair, we add the required number of zeros on extreme sides
and write the hexadecimal digits corresponding to each pair.
Example 1: (152.25)8
Step 1:
(152.25)8=(001101010.010101)2
Step 2:
1. Now, we make pairs of four bits on both sides of the binary point.
0 0110 1010.0101 01
On the left side of the binary point, the first pair has only one digit, and on the right side, the last
pair has only two-digit. To make them complete pairs of four bits, add zeros on extreme sides.
Let's take an example to understand how the conversion is done from hexadecimal to decimal.
Example 1: (152A.25)16
Step 1:
We multiply each digit of 152A.25 with its respective positional weight, and last we add the
products of all the bits with its weight.
(152A.25)16=(1×163)+(5×162)+(2×161)+(A×160)+(2×16-1)+(5×16-2)
(152A.25)16=(1×4096)+(5×256)+(2×16)+(10×1)+(2×16-1)+(5×16-2)
(152A.25)16=4096+1280+32+10+(2×1⁄16)+(5×1⁄256)
(152A.25)16=5418+0.125+0.125
(152A.25)16=5418.14453125
Example 1: (152A.25)16
We write the four-bit binary digit for 1, 5, A, 2, and 5.
For converting hexadecimal to octal, there are two steps required to perform, which are as follows:
1. In the first step, we will find the binary equivalent of the hexadecimal number.
2. Next, we have to make the pairs of three bits on both sides of the binary point. If there will be one or
two bits left in a pair of three bits pair, we add the required number of zeros on extreme sides and
write the octal digits corresponding to each pair.
Example 1: (152A.25)16
Step 1:
Step 2:
3. Then, we make pairs of three bits on both sides of the binary point.
(001010100101010.001001010)2=(12452.112)8
Example 1: (10110.001)2
We multiplied each bit of (10110.001)2 with its respective positional weight, and last we add the
products of all the bits with its weight.
(10110.001)2=(1×24)+(0×23)+(1×22)+(1×21)+(0×20)+
(0×2-1)+(0×2-2)+(1×2-3)
(10110.001)2=(1×16)+(0×8)+(1×4)+(1×2)+(0×1)+
(0×1⁄2)+(0×1⁄4)+(1×1⁄8)
(10110.001)2=16+0+4+2+0+0+0+0.125
(10110.001)2=(22.125 )10
1. In the first step, we have to make the pairs of three bits on both sides of the binary point.
If there will be one or two bits left in a pair of three bits pair, we add the required number
of zeros on extreme sides.
2. In the second step, we write the octal digits corresponding to each pair.
Example 1: (111110101011.0011)2
1. Firstly, we make pairs of three bits on both sides of the binary point.
On the right side of the binary point, the last pair has only one bit. To make it a complete
pair of three bits, we added two zeros on the extreme side.
(111110101011.0011)2=(7653.14)8
Example 1: (10110101011.0011)2
1. Firstly, we make pairs of four bits on both sides of the binary point.
On the left side of the binary point, the first pair has three bits. To make it a complete pair
of four bits, add one zero on the extreme side.
(011110101011.0011)2=(7AB.3)16
1. In the first step, we perform the division operation on integer and successive part
with base 'r'. We will list down all the remainders till the quotient is zero. Then we
find out the remainders in reverse order for getting the integer part of the
equivalent number of base 'r'. In this, the least and most significant digits are
denoted by the first and the last remainders.
2. In the next step, the multiplication operation is done with base 'r' of the fractional
and successive fraction. The carries are noted until the result is zero or when the
required number of the equivalent digit is obtained. For getting the fractional part
of the equivalent number of base 'r', the normal sequence of carrying is
considered.
Decimal to Binary Conversion
For converting decimal to binary, there are two steps required to perform, which are as
follows:
1. In the first step, we perform the division operation on the integer and the
successive quotient with the base of binary(2).
2. Next, we perform the multiplication on the integer and the successive quotient
with the base of binary(2).
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 2.
152/2 76 0 (LSB)
76/2 38 0
38/2 19 0
19/2 9 1
9/2 4 1
4/2 2 0
2/2 1 0
1/2 0 1(MSB)
(152)10=(10011000)2
Step 2:
Now, perform the multiplication of 0.27 and successive fraction with base 2.
Operation Result carry
0.25×2 0.50 0
0.50×2 0 1
(0.25)10=(.01)2
1. In the first step, we perform the division operation on the integer and the
successive quotient with the base of octal(8).
2. Next, we perform the multiplication on the integer and the successive quotient
with the base of octal(8).
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 8.
152/8 19 0
19/8 2 3
2/8 0 2
(152)10=(230)8
Step 2:
Now perform the multiplication of 0.25 and successive fraction with base 8.
Operation Result carry
0.25×8 0 2
(0.25)10=(2)8
1. In the first step, we perform the division operation on the integer and the
successive quotient with the base of hexadecimal (16).
2. Next, we perform the multiplication on the integer and the successive quotient
with the base of hexadecimal (16).
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 8.
152/16 9 8
9/16 0 9
(152)10=(98)16
Step 2:
Now perform the multiplication of 0.25 and successive fraction with base 16.
(0.25)10=(4)16
Let's take an example to understand how the conversion is done from octal to decimal.
Example 1: (152.25)8
Step 1:
We multiply each digit of 152.25 with its respective positional weight, and last we add
the products of all the bits with its weight.
(152.25)8=(1×82)+(5×81)+(2×80)+(2×8-1)+(5×8-2)
(152.25)8=64+40+2+(2×1⁄8)+(5×1⁄64)
(152.25)8=64+40+2+0.25+0.078125
(152.25)8=106.328125
Example 1: (152.25)8
We write the three-bit binary digit for 1, 5, 2, and 5.
(152.25)8=(001101010.010101)2
1. In the first step, we will find the binary equivalent of number 25.
2. Next, we have to make the pairs of four bits on both sides of the binary point. If there will
be one, two, or three bits left in a pair of four bits pair, we add the required number of
zeros on extreme sides and write the hexadecimal digits corresponding to each pair.
Example 1: (152.25)8
Step 1:
(152.25)8=(001101010.010101)2
Step 2:
1. Now, we make pairs of four bits on both sides of the binary point.
0 0110 1010.0101 01
On the left side of the binary point, the first pair has only one digit, and on the right side, the last
pair has only two-digit. To make them complete pairs of four bits, add zeros on extreme sides.
Let's take an example to understand how the conversion is done from hexadecimal to decimal.
Example 1: (152A.25)16
Step 1:
We multiply each digit of 152A.25 with its respective positional weight, and last we add the
products of all the bits with its weight.
(152A.25)16=(1×163)+(5×162)+(2×161)+(A×160)+(2×16-1)+(5×16-2)
(152A.25)16=(1×4096)+(5×256)+(2×16)+(10×1)+(2×16-1)+(5×16-2)
(152A.25)16=4096+1280+32+10+(2×1⁄16)+(5×1⁄256)
(152A.25)16=5418+0.125+0.125
(152A.25)16=5418.14453125
Example 1: (152A.25)16
Step 1:
3. Then, we make pairs of three bits on both sides of the binary point.
(001010100101010.001001010)2=(12452.112)8
Introduction:
Gate: A Gate is a simply an electronic circuit which operates on one or more
input signals and always produces an output signal.
Gates are digital (two state) circuits because the input and output signals are
either low voltage (0) or high voltage (1).
Gates are often called logic circuits because they can be analyzed with
Boolean algebra.
Gates are classified into two types:
logic gate is an elementary building block of a digital circuit. Most logic
gates
have two inputs and one output. At any given moment, every terminal is in
one of
the two binary conditions low (0) or high (1), represented by different
voltage
levels.
Digital systems are said to be constructed by using logic gates. These gates
are the
AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic
operations
are described below with the aid of truth tables.
Logic Gates
AND gate
OR gate
NOT gate
NAND gate
NOR gate
Ex-OR gate
Ex-NOR gate
Truth Tables
Truth tables are used to help show the function of a logic gate. If you are
unsure about truth tables and need guidance on how go about drawning them
for individual gates or logic circuits then use the truth table.
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.
The NAND and NOR gates are called universal functions since with either
one the AND and OR functions and NOT can be generated.
Laws of Boolean Algebra
There are six types of Boolean algebra laws. They are:
Commutative law
Associative law
Distributive law
AND law
OR law
Associative Law
It states that the order in which the logic operations are
performed is irrelevant as their effect is the same.
( A. B ). C = A . ( B . C )
( A + B ) + C = A + ( B + C)
Distributive Law
Distributive law states the following conditions:
A. ( B + C) = (A. B) + (A. C)
A + (B. C) = (A + B) . ( A + C)
AND Law
These laws use the AND operation. Therefore they are called
AND laws.
A .0 = 0
A.1=A
A. A = A
OR Law
These laws use the OR operation. Therefore they are called OR
laws.
A +0=A
A+1=1
A+A=A
A B A’ B’ (A.B)’ A’+B’
0 0 1 1 1 1
0 1 1 0 1 1
1 0 0 1 1 1
1 1 0 0 0 0
Half Adder
So, coming to the scenario of half adder, it adds two binary digits where the
input bits are termed as augend and addend and the result will be two outputs
one is the sum and the other is carry. To perform the sum operation, XOR is
applied to both the inputs, and AND gate is applied to both inputs to produce
carry.
Whereas in the full adder circuit, it adds 3 one-bit numbers, where two of the
three bits can be referred to as operands and the other is termed as bit carried
in. The produced output is 2-bit output and these can be referred to as output
carry and sum.
By using a half adder, you can design simple addition with the help of logic
gates.
0+0 = 0
0+1 = 1
1+0 = 1
1+1 = 10
These are the least possible single-bit combinations. But the result for 1+1 is
10, the sum result must be re-written as a 2-bit output. Thus, the equations
can be written as
0+0 = 00
0+1 = 01
1+0 = 01
1+1 = 10
The output ‘1’of ‘10’ is carry-out. ‘SUM’ is the normal output and ‘CARRY’ is
the carry-out.
Now it has been cleared that a 1-bit adder can be easily implemented with the
help of the XOR Gate for the output ‘SUM’ and an AND Gate for the ‘Carry’.
For instance, when we need to add, two 8-bit bytes together, then it can be
implemented by using a full-adder logic circuit. The half-adder is useful when
you want to add one binary digit quantities.
A way to develop two-binary digit adders would be to make a truth table and
reduce it. When you want to make a three binary digit adder, the half adder
addition operation is performed twice. In a similar way, when you decide to
make a four-digit adder, the operation is performed one more time. With this
theory, it was clear that the implementation is simple, but development is a time
taking process.
Sum= A XOR B
Carry = A AND B
Full Adder
This adder is difficult to implement when compared to half-adder.
The difference between a half-adder and a full-adder is that the full-adder has
three inputs and two outputs, whereas half adder has only two inputs and two
outputs. The first two inputs are A and B and the third input is an input carry as
C-IN. When a full-adder logic is designed, you string eight of them together to
create a byte-wide adder and cascade the carry bit from one adder to the next.
The output carry is designated as C-OUT and the normal output is represented
as S which is ‘SUM’.
With the above full adder truth-table, the implementation of a full adder circuit
can be understood easily. The SUM ‘S’ is produced in two steps:
1. By XORing the provided inputs ‘A’ and ‘B’
2. The result of A XOR B is then XORed with the C-IN
This generates SUM and C-OUT is true only when either two of three inputs
are HIGH, then the C-OUT will be HIGH. So, we can implement a full adder
circuit with the help of two half adder circuits. Initially, the half adder will be
used to add A and B to produce a partial Sum and a second-half adder logic
can be used to add C-IN to the Sum produced by the first half adder to get the
final S output.
If any of the half adder logic produces a carry, there will be an output carry. So,
C-OUT will be an OR function of the half-adder Carry outputs. Take a look at
the implementation of the full adder circuit shown below.
The implementation of larger logic diagrams is possible with the above full
adder logic a simpler symbol is mostly used to represent the operation. Given
below is a simpler schematic representation of a one-bit full adder.