0% found this document useful (0 votes)
2 views

Module 1

The document provides an overview of various number systems, including decimal, binary, octal, and hexadecimal, along with their conversions and applications in digital logic circuits. It discusses Binary Coded Decimal (BCD) and other coding systems such as Excess-3 and Gray code, explaining their significance in representing and processing numerical data. Additionally, it touches on ASCII code for character representation in computers and the basics of binary arithmetic.

Uploaded by

ravihari767687
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Module 1

The document provides an overview of various number systems, including decimal, binary, octal, and hexadecimal, along with their conversions and applications in digital logic circuits. It discusses Binary Coded Decimal (BCD) and other coding systems such as Excess-3 and Gray code, explaining their significance in representing and processing numerical data. Additionally, it touches on ASCII code for character representation in computers and the basics of binary arithmetic.

Uploaded by

ravihari767687
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 83

Digital Logic Circuits

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.

February 18, 2025 4


Decimal Number System
• It consists of 0,1,2,3,4,5,6,7,8,9(10 digits).
• It is the oldest and most popular number system used
in our day to day life.
• In the positional number system, each decimal digit is
weighted relative to its position in the number.
• This means that each digit in the number is multiplied
by 10 raised to a power corresponding to that digit’s
position.
• Example:

February 18, 2025 5


Radix System
• 7392 … Which number system?
• In figures? 7000+300+90+2 or
• 7392
Series of coefficient

6
Base-2
• 11010.11

• Base-r

• EXERCISE: (4021.2)5 , (127.4)8


7
Binary Number System

• There are only two digits in the Binary system, namely, 0


and 1.
• The numbers in the binary system are represented to the
base 2 and the positional multipliers are the powers of 2.
• The left most bit in the binary number is called as
the Most Significant Bit (MSB) and it has the largest
positional weight.
• The right most bit is the Least Significant Bit (LSB) and
has the smallest positional weight.
• Example :

February 18, 2025 8


More on binary number system
• The digits in a binary number are called bits
• When a bit is equal to 0, it does not contribute to the sum during the
conversion.
• Therefore, the conversion from binary to decimal can be obtained by
adding only the numbers with powers of two corresponding to the
bits that are equal to 1.
• For example,

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

• Octal number system uses digits 0,1,2,3,4,5,6 and 7 (8 digits). Each


octal digit has its own positional value or weight as a power of 8.
• A hexadecimal number is represented using base 16. Hexadecimal
or Hex numbers are used as a shorthand form of binary sequence.
• This system is used to represent data in a more compact manner.
Since 16 symbols are used, 0 to F, the notation is called
hexadecimal.
• The first 10 symbols are the same as in the decimal system, 0 to 9
and the remaining 6 symbols are taken from the first 6 letters of the
alphabet sequence, A to F, where A represents 10, B is 11, C is 12, D
is 13, E is 14 and F is 15.

February 18, 2025 19


Octal and Hexadecimal Numbers

23 = 8 and 24 = 16, each octal digit


corresponds to three binary digits and
each hexadecimal digit corresponds to
four binary digits

20
Number system Conversion

February 18, 2025 21


Number Base Conversion
Binary to
Octal

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

February 18, 2025 28


BINARY CODES
• In the coding, when numbers or letters are represented by a specific group of symbols, it
is said to be that number or letter is being encoded. The group of symbols is called
as code.
• The digital data is represented, stored and transmitted as group of bits.
CLASSIFICATION OF CODES
Codes Error
Detecting
Non Sequentia Alphanu
Weighted Reflective &
weighted l meric
Correctin
g codes

February 18, 2025 29


BCD
• In this code each decimal digit is represented by a 4-bit binary number. BCD
is a way to express each of the decimal digits with a binary code.
• In the BCD, with four bits we can represent sixteen numbers (0000 to 1111).
But in BCD code only first ten of these are used (0000 to 1001).
• The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.

February 18, 2025 30


• 143 is a decimal number.
• In this number 1 , 4 , 3 are decimal digits.
• By using Binary Coded Decimal code we will represent 0 to 9 by 4-bit
binary numbers.
• Positional weights are 8 4 2 1 . Hence 8421 and BCD code are same.

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

• Sum>9, Final carry =1 ---- answer is incorrect

• Sum>9, Final carry =0 ---- answer is incorrect

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

1 0 0 0 0 can be written as 0001 0000 = (1 0)10

February 18, 2025 36


Sum>9, Final carry =1 ---- answer is incorrect
Example (8)10 +(9)10 . Perform BCD addition
1000
1001
10001
Adding 6 i.e 0110 to the result to make the calculations correct
10001
0110
1 0 1 1 1

February 18, 2025 37


Decimal 8421 2421 5211 5421 642-3 84-2-1
digit

0 0000 0000 0000 0000 0000 0000

1 0001 0001 0001 0001 0101 0111

2 0010 0010 0011 0010 0010 0110

3 0011 0011 0101 0011 1001 0101

4 0100 0100 0111 0100 0100 0100

5 0101 1011 1000 1000 1011 1011

6 0110 1100 1010 1001 0110 1010

7 0111 1101 1100 1010 1101 1001

8 1000 1110 1110 1011 1010 1000

9 1001 1111 1111 1100 1111 1111

February 18, 2025 38


Un-Weighted Codes
• Non-weighted or un-weighted codes are those codes in which the
digit value does not depend upon their position i.e., each digit
position within the number is not assigned fixed value.
• Examples of non-weighted codes are: Excess-3 code and gray code.
• Non weighted codes are used in:
a) To perform certain arithmetic operations.
b) Shift position encodes.
c) Used for error detecting purpose.

February 18, 2025 39


Excess -3 code
• Also known as XS-3
• This code derives its name from the fact that each binary code word is the
corresponding 8421 code word plus 0011 (3)
• It is self complementing code.
Decimal 8-4-2-1 code Excess -3
(BCD code)
5 0101 0101
+0011 1000
1000
February 18, 2025 40
Example
(24)10 to excess -3 code
2 4
0010 0100
+0011 0011
0101 0111

Example
(658)10 to excess -3 code
6 5 8
0110 0101 1000
+0011 0011 0011
0101 1000 1011

February 18, 2025 41


Four Different Binary Codes for the Decimal
Digits

February 18, 2025 42


Gray Code
• Also known as Reflected Binary Code.
• It is given by Frank Gray.
• **It is binary numeral system where two
successive values differ in only one bit.
• Binary numbers are converted to gray
code to reduce switching operations.
• Also Known as unit distance code,
minimum error code and cyclic code.

February 18, 2025 43


It is binary numeral system where two successive values differ in only one bit.

February 18, 2025 44


Binary and Gray Code conversion

February 18, 2025 45


Reflective Code Decimal
digit
2421 XS-3

0 0000 0011

• 2421 and 5211 ,excess -3 codes 1 0001 0100

2 0010 0101
9 is complement of 0
3 0011 0110
8 is complement of 1 4 0100 0111

7 is complement of 2 5 1011 1000

6 1100 1001

7 1101 1010

8 1110 1011

9 1111 1100

February 18, 2025 46


Reflective Code Example

February 18, 2025 47


Sequential Code
• Sequential codes are the codes in
which 2 subsequent numbers in
binary representation differ by only
one digit.
• The 8421 and Excess-3 codes are
examples of sequential codes.
• 2421 and 5211 codes do not
come under sequential codes.
Decimal digit 2421

4 0100
5 1011

February 18, 2025 48


ASCII Code
• ASCII, stands for American Standard Code for Information
Interchange.
• It's a 7-bit character code where every single bit represents a
unique character.

February 18, 2025 49


• It is used to interchange information.
• Computer doesn't understand English or Hindi or any language.
• But computer do understand only 0 and 1.
• 0 means False
• 1 means True
• ASCII codes represent text in computers, communications equipment, and
other devices that use text.
• If you press 4 from keyboard, then keyboard send the value 100(value
equivalent to 4) to the main memory which will further be evaluated
in secondary memory and then the output will be 4 in monitor.
• Note that 100 means true-false-false.
• Similarly if you press "a" the value will be 097 which is equivalent
to 01100001.
February 18, 2025 50
Binary Arithmetic

February 18, 2025 Department of CSE, GIT Course Code and 51


Course Title:csen1051- Digital Logic Circuits
Binary Arithmetic Rules

Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 52
Worked out Example

Binary Addition Binary Subtraction

February 18, 2025 Department of CSE, GIT Course Code and 53


Course Title:csen1051- Digital Logic Circuits
SIGNED BINARY NUMBERS
 Positive integers including zero can be represented as unsigned numbers.
However, to represent negative integers, we need a notation for negative values.
 Because of hardware limitations, computers must represent everything with
binary digits, commonly referred to as bits.
 It is important to realize that both signed and unsigned binary numbers consist
of a string of bits when represented in a computer.
For example,
 The string of bits 01001 can be considered as 9 (unsigned binary) or a +9 (signed
binary) because the leftmost bit is O.
 The string of bits 11001 represent the binary equivalent of 25 when considered as an
unsigned number or as – 9.
 when considered as a signed number because of the I in the leftmost position, which
designates negative, and the other four bits, which represent binary 9.
 Usually, there is no confusion in identifying the bits if the type of representation for the
number is known in advance.
Department of CSE, GIT Course Code and Course Title:csen1051- Digital Logic Circuits
February 18, 2025 54
SIGNED BINARY NUMBERS
 As an example, consider the number 9 represented in binary with eight bits.
+9 is represented with a sign bit of 0 in the leftmost position followed by the
binary equivalent of 9 to give 00001001.
 Note that all eight bits must have a value and, therefore, 0's are
inserted following the sign bit up to the first 1.
 Although there is only one way to represent +9, there are three
different ways to represent - 9 with eight bits:
In signed-magnitude representation: 10001001

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

February 18, 2025 Department of CSE, GIT Course Code and 57


Course Title:csen1051- Digital Logic Circuits
(r-1)’s complement
 If the base = 10
 The 9's complement of 546700 is
 999999 -546700 = 453299.
 If the base = 2
 The 1's complemcnt of 1011000 is 0100111.

February 18, 2025 Department of CSE, GIT Course Code and 58


Course Title:csen1051- Digital Logic Circuits
r’scomplement

• The 10's complement of 012398 is 987602


• The 2's complement of 1101100 is 0010100

February 18, 2025 Department of CSE, GIT Course Code and 59


Course Title:csen1051- Digital Logic Circuits
Subtraction using complements
• Discard end carry for r‟scomplement
• Using 10's complement subtract 72532 -3250.
• M = 72532
• 10's complement of N = + 96750
• Sum = 169282
• Discard end carry for 10‟s complement
• Answer = 69282

February 18, 2025 Department of CSE, GIT Course Code and 60


Course Title:csen1051- Digital Logic Circuits
Subtraction using (r-1)’s complement
• X -Y = 1010100 -1000011
• X = 1010100
• 1's comp of Y =+ 0111100
• Sum = 1 0010000
• Add End-around carry = + 1
• X -Y = 0010001

February 18, 2025 Department of CSE, GIT Course Code and 61


Course Title:csen1051- Digital Logic Circuits
Subtraction using 2’s Complement

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

February 18, 2025 Department of CSE, GIT Course Code and 66


Course Title:csen1051- Digital Logic Circuits
Key point

February 18, 2025 Department of CSE, GIT Course Code and 67


Course Title:csen1051- Digital Logic Circuits
Binary Multiplication

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

February 18, 2025 Department of CSE, GIT Course Code and 71


Course Title:csen1051- Digital Logic Circuits
Error Detection and Correction Codes

February 18, 2025 Department of CSE, GIT Course Code and 72


Course Title:csen1051- Digital Logic Circuits
Types of Errors

February 18, 2025 Department of CSE, GIT Course Code and 73


Course Title:csen1051- Digital Logic Circuits
Error Detection and Correction

February 18, 2025 Department of CSE, GIT Course Code and 74


Course Title:csen1051- Digital Logic Circuits
Error‐Detecting Code
• To detect errors in data communication and processing, an eighth bit is
sometimes added to the ASCII character to indicate its parity.
• A parity bit is an extra bit included with a message to make the total number of
1’s either even or odd.
• Consider the following two characters and their even and odd parity: With
even parity With odd parity
ASCII A = 1000001 01000001 11000001
ASCII T = 1010100 11010100 01010100
• In each case, we insert an extra bit in the leftmost position of the code to
produce an even number of 1’s in the character for even parity or an odd number
of 1’s in the character for odd parity. In general, one or the other parity is
adopted, with even parity being more common.
February 18, 2025 Department of CSE, GIT Course Code and 75
Course Title:csen1051- Digital Logic Circuits
Parity Bit for Error Detection

February 18, 2025 Department of CSE, GIT Course Code and 76


Course Title:csen1051- Digital Logic Circuits
Odd and Even Parity Bit

February 18, 2025 Department of CSE, GIT Course Code and 77


Course Title:csen1051- Digital Logic Circuits
Hamming Code
• Hamming code is a block code that is capable of
detecting up to two simultaneous bit errors and
correcting single-bit errors.
• It was developed by R.W. Hamming for error
correction.
• In this coding method, the source encodes the
message by inserting redundant bits within the
message.
• These redundant bits are extra bits that are generated
and inserted at specific positions in the message itself
to enable error detection and correction.
February 18, 2025 Department of CSE, GIT Course Code and 78
Course Title:csen1051- Digital Logic Circuits
Parity Bits in Hamming Code

February 18, 2025 Department of CSE, GIT Course Code and 79


Course Title:csen1051- Digital Logic Circuits
Example

February 18, 2025 Department of CSE, GIT Course Code and 80


Course Title:csen1051- Digital Logic Circuits
Hamming Code Generation
• How will a message 0100 i.e. decimal 4 will be sent as a hamming
code?

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

February 18, 2025 Department of CSE, GIT Course Code and 81


Course Title:csen1051- Digital Logic Circuits
Hamming Code for Error Correction
• A 7 bit hamming code word received by a receiver is 1011011.
Assuming the even parity, state whether the received code word is
correct or not. If wrong, locate the bit having error.
P1 D3 D5 D7
1 0 1 1 Odd 1s (should have been Even) => Set P1=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

P4 P2 P1 = 1012 = Decimal 5 =>Error at 5th bit

February 18, 2025 Department of CSE, GIT Course Code and 82


Course Title:csen1051- Digital Logic Circuits
Check Sum
• For error detection by checksums, data is divided into fixed
sized frames or segments.
• Sender’s End − The sender adds the segments using 1’s
complement arithmetic to get the sum. It then
complements the sum to get the checksum and sends it
along with the data frames.
• Receiver’s End − The receiver adds the incoming
segments along with the checksum using 1’s complement
arithmetic to get the sum and then complements it.
• If the result is zero, the received frames are accepted;
otherwise they are discarded.
February 18, 2025 Department of CSE, GIT Course Code and 83
Course Title:csen1051- Digital Logic Circuits

You might also like