Module 1
Module 1
Dr M Rambabu
Assistant Professor
GITAM School of Technology
Visakhapatnam
2
Lets start…
3
Various Number Systems
• There are basic four types of number systems.
6
Base-2
• 11010.11
• Base-r
9
Lets begin with a game!
https://learningcontent.cisco.com/games/binary/index.html
10
11
Number Base Conversion
Decimal to
Binary
12
Number Base Conversion
Decimal to
Binary
13
Number Base Conversion
Decimal to
Octal
14
Number Base Conversion
Decimal
fraction to
Binary fraction
15
Number Base Conversion
Decimal
fraction to
Octal fraction
16
Hexadecimal (base‐16) number system
• 0-9 … 10 elements! What can be the rest 6?
• The letters A, B, C, D, E, and F are used for the digits 10, 11, 12, 13, 14,
and 15, respectively.
• What will be decimal value of (B65F)16 ?
17
Hexadecimal (base‐16) number system
• The hexadecimal system is used commonly by designers to represent
long strings of bits in the addresses, instructions, and data in digital
systems.
• For example, B65F is used to represent 1011011001010000.
18
Octal and Hexa decimal Number System
20
Number system Conversion
Binary to
Hexadecimal
22
Number Base Conversion
Octal to
binary
Hexadecimal
to binary
23
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 24
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 25
Hexadecimal to Decimal Conversion
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 26
Decimal to Hexadecimal Conversion
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 27
Hexadecimal to Octal Conversion
Department of CSE, GIT Course Code and Course Title: CSEN1051 - DIGITAL LOGIC CIRCUITS
February 18, 2025 31
Decimal to BCD conversion
• Convert (17) 10 into BCD
(17) 10 It is a two decimal digit
1 7
0001 0111
00010111
• (156)10
1 5 6
0001 0101 0110
000101010110
Department of CSE, GIT Course Code and Course Title: CSEN1051 - DIGITAL LOGIC CIRCUITS
February 18, 2025 32
BCD to Decimal conversion
• 10100
• Make group of 4 bits from right side
• 0001 0100
• 1 4
• Therefore 10100 BCD = (14)10
Department of CSE, GIT Course Code and Course Title: CSEN1051 - DIGITAL LOGIC CIRCUITS
February 18, 2025 33
BCD Addition
Three cases 9- 1001
• Sum<=9, Final carry =0 ---- answer is correct
Department of CSE, GIT Course Code and Course Title: CSEN1051 - DIGITAL LOGIC CIRCUITS
February 18, 2025 34
• Sum<=9, Final carry =0 ---- answer is correct
• Example (2)10 +(6)10 . Perform BCD addition
0 0 1 0
0 1 1 0
1 0 00
• Sum is 8 in decimal which is less than 9. Hence answer is correct
Department of CSE, GIT Course Code and Course Title: CSEN1051 - DIGITAL LOGIC CIRCUITS
February 18, 2025 35
• Sum>9, Final carry =0 ---- answer is incorrect
• Example (3)10 +(7)10 . Perform BCD addition
0 011
0 111
1 0 1 0 = (10)10
Decimal digits are 0 to 9. We use 4 bit binary numbers to represent decimal digits.
For 4 bit we have 24=16 possible combinations.
Hence by using 4 bit binary numbers we can represent 16 i.e. 0 to 15. But in BCD 0-9 are valid .
The invalid cases 15-9=6. Hence we have to add 6 in BCD to the result obtained in this case. (6) 10 = 0110
1 0 1 0
0 1 1 0
Adding 6 i.e 0110 to the result to make the calculations correct
1 0 0 0 0
Example
(658)10 to excess -3 code
6 5 8
0110 0101 1000
+0011 0011 0011
0101 1000 1011
0 0000 0011
2 0010 0101
9 is complement of 0
3 0011 0110
8 is complement of 1 4 0100 0111
6 1100 1001
7 1101 1010
8 1110 1011
9 1111 1100
4 0100
5 1011
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 52
Worked out Example
In signed-1's-complement representation:11110110
In signed-2's-complement representation:11110111
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 55
Negative number representation
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 56
Complements
• Complements are used in digital computers to simplify
the subtraction operation and for logical manipulation
• They are two types of complements
• 1) Diminished radix complement
(rN -1)- N {r is the base of num system}
• 2) Radix Complement (rN -1)-N+1
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 62
Subtraction using 1’s Complement
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 63
Decimal Subtraction by 9’s Complement
method.
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 64
Decimal Subtraction by 10’s Complement
method.
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 65
Arithmetic Addition using 2’s Complement
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 68
Binary Division
Set quotient to 0
Align leftmost digits in dividend and divisor
Repeat
If that portion of the dividend above the divisor is greater than or equal to the divisor
Then subtract divisor from that portion of the dividend and
Concatentate 1 to the right hand end of the quotient
Else concatentate 0 to the right hand end of the quotient
Shift the divisor one place right
Until dividend is less than the divisor
quotient is correct, dividend is remainder
STOP
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 69
Session Quiz
1. The fraction (0.68)10 is equal to [ ]
a) (0.010101)2 b) (0.101)2 c) (0.10101)2 d) (0.10111)2
2. The Hexadecimal number A0 has the decimal value [ ]
a)80 b) 256 c) 100 d) 160
3. Given two numbers A & B in sign magnitude representation in an eight bit
format A=00011110 & B=10011100, A XOR B gives [ ]
a)10000010 b) 00011111 c) 10011101 d) 11100001
4. The value of binary 1111 is [ ]
a) 23-1 b) 24-1 c) 24 d) none of these
5. The minimum number of bits required to represent negative numbers in the
range of -1 to -11 using 2’s complement arithmetic is [ ]
(a) 2 (b) 3 (c) 4 (d) 5
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 70
Error Detection and Correction
Codes
0 0 1 0 P1 D3 D5 D7
? 0 1 0 Set P1=1 so that number of 1s become even
P2 D3 D6 D7
? 0 0 0 Set P2=0 so that number of 1s remain even
P4 D5 D6 D7
? 1 0 0 Set P4=1 so that number of 1s become even
0 0 1 1 0 0 1
P2 D3 D6 D7
1 0 0 1 Even 1s (Correct) => Set P2=0
P4 D5 D6 D7
1 1 0 1 Odd 1s (should have been Even) => Set
P1=1