Department of AI&DS Engg.
B.Tech. 1st Year (Sem: 2nd)
Sub: Digital Electronics
(Code: AIDS24204)
Q.1 Perform the following conversion
i) (101101 ⋅ 01010)2 = ( ? )10
=> (1 0 1 1 0 1 ⋅ 0 1 0 1 0)2
= 1x25 + 0x24 + 1x23 + 1x22 + 0x21 + 1x20 + 0x2-1 + 1x2-2 + 0x2-3 + 1x2-4+ 0x2-5
= 32 + 0 + 8 + 4 + 0 + 1 + 0 + 0.25 + 0 + 0. 0625 + 0
= (45.3125)10
Therefore (101101 ⋅ 01010)2 = ( 45.3125 )10
ii) (123 ⋅ 45)8 = ( ? )16
= (123 ⋅ 45)8
= 001 010 011 ⋅ 100 101
= 0000 0101 0011 ⋅ 1001 0100
= 0 5 3 ⋅ 9 4
= ( 53.94 )16
Therefore (123 ⋅ 45)8 = ( 53.94 )16
iii) (101101001)2 = ( ? )Gray
Therefore (101101001)2 = (111011101)Gray
iv) (ABC ⋅ DEF)H = ( ? )O
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
= (A B C ⋅ D E F)H
= 1010 1011 1100 ⋅ 1101 1110 1111
= 101 010 111 100 ⋅ 110 111 101 111
=5 2 7 4 ⋅ 6 7 5 7
Therefore (ABC ⋅ DEF)H = ( 5274 ⋅ 6757 )O
Q.2 Discuss the following code with suitable examples
i) BCD code
Binary Coded Decimal, or BCD, is another process for converting decimal numbers into their
binary equivalents.
• It is a form of binary encoding where each digit in a decimal number is represented in the
form of bits.
• It is a fast and efficient system that converts the decimal numbers into binary numbers as
compared to the existing binary system.
➢ The BCD equivalent of a decimal number is written by replacing each decimal digit in the integer
and fractional parts with its four-bit binary equivalent.
➢ The BCD code is more precisely known as 8421 BCD code, with 8,4,2 and 1 representing the
weights of different bits in the four-bit groups, Starting from MSB and proceeding towards LSB.
➢ This feature makes it a weighted code, which means that each bit in the four-bit group representing
a given decimal digit has an assigned weight.
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
Example 1. Convert (123)10 in BCD
= 1 2 3
= 0001 0010 0011
thus, BCD becomes -> 0001 0010 0011
ii) Ex-3 code / Excess-3 code
The excess-3 code (or XS3) is a non-weighted code used to express code used to express
decimal numbers.
Excess-3 codes are unweighted and can be obtained by adding 3 to each decimal digit then it can
be represented by using 4-bit binary number for each digit.
An Excess-3 equivalent of a given binary number is obtained using the following steps:
• Find the decimal equivalent of the given binary number.
• Add +3 to each digit of decimal number.
• Convert the newly obtained decimal number back to binary number to get required
excess-3 equivalent.
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
Decimal Digit BCD Code Excess-3 Code
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100
Example-1 −Convert decimal number 23 to Excess-3 code.
So, according to excess-3 code we need to add 3 to both digit in the decimal number then convert
into 4-bit binary number for result of each digit. Therefore,
= 23+33=56
Excess-3 code of 23 = 0101 0110
Example-2 −Convert decimal number 15.46 into Excess-3 code.
According to excess-3 code we need to add 3 to both digit in the decimal number then convert into
4-bit binary number for result of each digit. Therefore,
= 15.46+33.33=48.79 Excess-3 code of 15.46 =0100 1000⋅0111 1001
iii) Gray code
The reflected binary code or Gray code is an ordering of the binary numeral system such that two
successive values differ in only one bit (binary digit). Gray codes are very useful in the normal
sequence of binary numbers generated by the hardware that may cause an error or ambiguity
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
during the transition from one number to the next. So, the Gray code can eliminate this problem
easily since only one bit changes its value during any transition between two numbers.
Gray code is not weighted that means it does not depend on positional value of digit. This cyclic
variable code that means every transition from one value to the next value involves only one bit
change.
Gray codes are as following below
Q.3 perform following binary addition and subtractions
Carry 1 1 Carry 1 1 1
i) 1 0 1 0 (10) ii) 1 1 0 0 (12) iii) 0 0 1 1 1 (7)
+1110 (14) -0111 (7) + 1 0 1 0 1 (21)
----------- Borrow 1 1 1 -----------
11000 (24) ------------ 1 1 1 0 0 (28)
0101 (5)
Q.5 Discuss the following representation with suitable examples
i) Sign-Magnitude Representation
The sign-magnitude binary format is the simplest conceptual format. In this method of
representing signed numbers, the most significant digit (MSD) takes on extra meaning.
• If the MSD is a 0, this indicates that the number as a positive one.
• If the MSD is a 1, this indicates that the number is negative.
• Positive Signed Binary Numbers
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
•
• Negative Signed Binary Numbers
Signed decimal sign-magnitude
+6 0110
-6 1110
+0 0000
-0 1000
+7 0111
-7 1111
Range
From the above table, it is obvious that if the word size is n bits, the range of numbers that can be
represented is from -(2n-1 -1) to +(2n-1 -1). A table of word size and the range of sign magnitude
(SM) numbers that can be represented as shown in the following.
Word size The range for SM numbers
4 -7 to +7
8 -127 to +127
16 -32767 to +32767
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
Notice that the bit sequence 1101corresponds to the unsigned number 13, as well as the number
–5 in Sign Magnitude notation.
ii) One’s complement Representation
one’s complement is toggling or exchanging all the 0’s into 1 and all the 1’s into 0 of any
number. Suppose there is a binary number 11001001, then its one’s complement will be
00110110.
To find one’s complement of any number, follow the below steps:
1. Convert the number of any number system to a binary number system, i.e. if the
number is in octal, decimal, hexadecimal, or any other number system; so convert it
into a binary number system. If there is a number 10 and we need to find its one
complement convert it into a binary number system, i.e. 1010.
2. After, having the number in binary form. Now, invert or exchange all the 0’s to 1 and
all the 1’s to 0. Like, 1010 will be 0101.
3. The resulting binary number is the 1’s complement of the given number.
Example-1: Find 1’s complement of binary number 10101110.
Simply invert each bit of given binary number, so 1’s complement of given number will be
01010001.
Example-2: Find 1’s complement of binary number 10001.001.
Simply invert each bit of given binary number, so 1’s complement of given number will be
01110.110.
iii) Two’s complement Representation
Two's complement is the most common method of representing signed (positive, negative, and
zero) integers on computers, and more generally, fixed point binary values. Two's complement
uses the binary digit with the greatest place value as the sign to indicate whether the binary
number is positive or negative. When the most significant bit is 1, the number is signed as
negative; and when the most significant bit is 0 the number is signed as positive.
To find one’s complement of any number, follow the below steps:
1: Write the absolute value of the given number in binary form. Prefix this number with 0
indicate that it is positive and 1 indicated it is negative.
2: Take the complement of each bit by changing zeroes to ones and ones to zero.
3: Add 1 to your result. This is the two’s complement representation of the negative integer.
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
EXAMPLE: Find the two’s complement of −17
Step 1: 1710 = 0001 00012
Step 2: Take the complement: 1110 1110
Step 3: Add 1: 1110 1110 + 1
Two’s compliment of -17 is = 1110 1111.
Q.5 Realize the basic logic gates using universal gates.
A) Basic gates realization using NAND Gate
NOT Gate
OR Gate
AND Gate
B) Basic gates realization using NOR Gate
NOT Gate
OR Gate
AND Gate
Q.6 Simplify following Boolean expressions
i) (A+B) ⋅ ( A +B) ⋅ B = (A+B) ⋅ ( A B +B B )
=> LHS = (A+B) ⋅ ( A +B) ⋅ B
= (A+B) ⋅ ( A B +B B ) => RHS
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
ii) A + ( A B) = (A+B)
=> LHS = A + ( A B)
= (A + A ) . (A + B)
= 1 . (A + B)
=. (A + B) => RHS
iii) A ⋅ ( A + B) = A
=> LHS = A ⋅ ( A + B)
=A⋅A +A⋅B
=A+A⋅B
= A (1 + B)
= A => RHS
iv) 𝐴 𝐵 + 𝐴 𝐵̅ ∙ ̅̅̅̅̅
𝐴̅ 𝐶̅ = 𝐴
=> LHS = 𝐴 𝐵 + 𝐴 𝐵̅ ∙ ̅̅̅̅̅
𝐴̅ 𝐶̅
= 𝐴 𝐵 + 𝐴 𝐵̅ ∙ (𝐴̅ + 𝐶̅ )
= 𝐴 𝐵 + 𝐴 𝐵̅ ∙ (𝐴 + 𝐶)
= 𝐴 𝐵 + 𝐴 𝐵̅ ∙ 𝐴 + 𝐴 𝐵̅ ∙ 𝐶
= 𝐴 𝐵 + 𝐴 𝐵̅ + 𝐴 𝐵̅ 𝐶
= 𝐴 (𝐵 + 𝐵̅) + 𝐴 𝐵̅ 𝐶
= 𝐴 ∙ 1 + 𝐴 𝐵̅ 𝐶
= 𝐴 (1 + 𝐵̅ 𝐶)
=𝐴 ∙1
= A => RHS
Q.8 Perform the following operations using 2’s complement method:
(i) 48 – 23
(ii) 23 – 48
(iii) 48 – (–23)
(iv) – 48 – 23
Use 8-bit representation of numbers.
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM
Prof. S. P. Bhonge/E&TC Engg. Dept/PRPCEM