A VERY
GOOD
MORNING TO
ALL
OF
U
BINARY SYSTEMS
CHAPTER 1
DIGITAL LOGIC DESIGN
TOPICS
• DIGITAL SYSTEMS• NUMBER SYSTEMS• NUMBER BASE CONVERSIONS• OCTAL AND HEXADECIMAL NUMBERS• COMPLEMENTS• SIGNED BINARY NUMBERS• BINARY CODES• BINARY STORAGE AND REGISTERS• BINARY LOGIC
DIGITAL SYTEMS
• SYSTEM• TYPES OF SYSTEMS• CLASSIFICATION OF SYSTEMS• APPLICATIONS OF DIGITAL SYSTEMS• ADVANTAGES OF DIGITAL SYSTEMS• DISADVANTAGES OF DIGITAL SYSTEMS• DIGITAL COMPUTER• DESIGN OF DIGITAL SYSTEMS• SWITCHING CIRCUITS• WHY BINARY IN DIGITAL SYSTEMS?
SYSTEM
Accepts various Inputs Performs a particular task Generates output
Classification of SystemsAnalog Systems
(Continuous)Digital Systems(Discrete step
by step)
Physical quantities or signals may vary continuously over a specified range.
Physical quantities or signals can assume only discrete values .
Hence represented by continuously variable indicator
Represented by symbols called digits
Thermometer Digital Clock
Applications of Digital Systems
• Communication
Applications of Digital Systems
• Business Transactions
Applications of Digital Systems
• Traffic Control
Applications of Digital Systems
• Space Guidance• Weather
Monitoring
Applications of Digital Systems
• Medicine
Applications of Digital Systems
• Internet
Applications of Digital Systems
• Commercial
Applications of Digital Systems
• Commercial
Applications of Digital Systems
• Commercial
Applications of Digital Systems
Commercial
Applications of Digital Systems
Industry
Applications of Digital Systems
• Scientific Enterprises
Applications of Digital Systems
• Military
Advantages of Digital Systems
• Easier to Design• Information storage is easy• Accuracy and Precision
through out the system• Operations can be
programmed• Digital Circuits are less prone
to noise
Disadvantages of Digital Systems
• Real world is analog• Digitization of information is a
time consuming process.
Digital Computer• It can follow a sequence of instructions
called a program, that operates on given data.
• Program and data can be varied according to the user’s needs.
• Hence, it can perform various information processing tasks that fulfill several applications.
Digital Computer
• One important characteristic of digital computer is the ability to manipulate discrete elements of information.
• Discrete information must contain finite number of elements.
• Eg: 10 Decimal digits, 26 alphabets, 52 playing cards, 64 chess squares
Digital Computer• The name Digital Computer emerged
from an application.• Early computers are used for numeric
computations in which discrete elements are digits.
• Physical quantities used to represent discrete information are signals.
• Some of the signals are voltage and current signals (Implemented by transistors)
Digital Computer• But signals used in digital systems have 2
discrete values 0 & 1 ( binary)• Binary Digit- Bit 0 or 1• Group of bits – Binary Codes• Hence using various techniques, groups of bits
can represent discrete symbols.• These symbols are again used to develop
system in digital format.• So, we can say that digital system manipulates
discrete elements of information which is again represented internally in binary form
Design of Digital SystemsSystem Design
Logic Design
Circuit Design
System Design •Breaking overall system into subsystems & specifying chcs. of each sub-systems
Logic Design •Determines how to interconnect and control these sub-systems
Circuit Design •Specifying the interconnection of specific components like resistors, diodes and transistors to form gates, flip flops, or other logic building blocks
Switching Circuits
• Many of sub systems of digital systems take form of a switching circuit.
• It consists of one or more inputs and outputs having discrete values.
Switching Circuit
x₁
x₂..
xm
Z₁
Z₂..
Zm
Classification of Switching Circuits
Combinational Circuits Sequential Circuits
Output depends on present on input only
Output depends on both past and present inputs
Building blocks are logic gates
Building blocks are logic gates and flip flops
No memory is required as no storage is necessary
Memory is required as past inputs are to be stored
Eg: Multiplexers, Decoders, Encoders, PLDs, PLAs, PALs, CPLDs, FPGAs etc.
Eg: Ring Counter, Synchronous Counter, Ripple Counter
Why binary in Digital Systems
• In general, switching devices used in digital systems are generally two-state devices.
• So, output can assume only two discrete values.
Switching devices
Relay
On
Diode Transistor
Number Systems
• Decimal Number System (10)• Binary Number System ( 2 )• Octal Number System ( 8 )• Hexadecimal Number System (16)
Decimal Number System
Representation
=5*10^2 + 0*10^1 + 1*10^0 + 6*10^-1 + 8*10^-2
(501.68)10
Decimal Number System
• Numbers have positional importance• 349.2510
In the binary system, positional importance follows powers of 2
3 x 102 = 3 x 100 = 300
4 x 101 = 4 x 10 = 40
9 x 100 = 9 x 1 = 9 2 x 10-1 = 2/10
5 x 10-2 = 5/100
Conversion from Binary to Decimal
• (11001.11)₂
= 1*2^4 + 1*2^3 + 0*2^2 + 0* 2^1 + 1*2^0 + 1*2^-1 + 1*2^-2 = 16 + 8 + 0 + 0 + 1 + 0.5 + 0.25
= ( 25.75 )10
Conversion from Octal to Decimal
( 347.205)₈
= 3 * 8^2 + 4 * 8^1 + 7 * 8^0 + 2 * 8^-1 + 0 * 8^-2 + 5 * 8^-3
= 192 + 32 + 7 + 0.25 + 0 + 0.01
= ( 231.26)10
Conversion from Hexadecimal to Decimal
• ( 23A4.EC)16
= 2 * 16^3 + 3 * 16^2 + A * 16^1 + 4 * 16^0 + E * 16^-1 + C * 16^-2= 8192 + 768 + 160 + 4 + 0.875 + 0.0468
= (9214.9218 )10
Conversion from Decimal to Binary
( 61 )10
Conversion from Decimal to Binary
( 61 )10
Decimal value Integer Fraction Coefficient
0001
Conversion from Decimal to Octal
(247.6875)10
= (367.54)₈
Octal Number SystemOctal Numbers Binary Equivalents
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Hexadecimal Number SystemDecimal Values Hexadecimal
RepresentationBinary Equivalents
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
Binary Arithmetic
• Binary Addition• Binary Subtraction• Binary Multiplication• Binary Division
Binary Addition
1 0 1 1 0 1 0 1 + 1 1 0 0 + 1 1 1 1 _ _ _ _ _ _ _ _ _ _ 1 0 1 1 1 1 0 1 0 0
Addition of two binary numbers
1410 = 011102
+2510 = 1100121
0
1
0
1
0
0
1
0
1
1
0
= 32 + 7 = 39
1 0 1 1 0 1
+ 0 1 1 1 0 1
1
0
0
1
1
0
1
1
1
0
1
0
1
Carry
Sum
Check your work
45
+ 29
= 74
Binary Subtraction
1 0 1 1 Minuend11101
- 0 1 1 0 Subtrahend - 10011
_ _ _ _ _ _ _ _ _ _ _ _ 0 1 0 1 Difference
01010
Binary Multiplication
1001 Mul t ip l icand *1101 Mul t ip l ier _____
1001 0000 1001
1001 _________
1110101
Partial Products
Final Product
Binary Division 1101 1001 1110101 1001 - - - - - - - - - 1011 1001 - - - - - - - - - - - 1001 1001
- - - - - - - - - - - 0000
Complements
Used in digital computers • for simplifying the subtraction
operation and• for logical manipulation.
Diminished Radix Complement
• Also called (R-1)’s complement• (R-1)’s complement of any number system
can be defined as ( Rⁿ-1 )-N• R = Base or Radix of a given number system• N = given number• n = no. of digits present in the given number• For Decimal Number System, R-1’s
complement is (10ⁿ-1) –N• For Binary Number System, R-1’s
complement is (2ⁿ-1) –N
For Decimal Number System
• R = 10 ==> (R-1) = 9• ( R-1 )’s complement = 9’s complement = (10ⁿ-1) –N (R-1)’s complement of 546700 is 9’s complement of 546700 = (10⁶-1)-
(546700)
= 99999-546700
= 453299
For Binary Number System
• R = 2 ==> (R-1) = 1• ( R-1 )’s complement = 9’s complement = (2ⁿ-1) –N (R-1)’s complement of 1011000 is 1’s complement of 1011000 =(2⁷-1)-
(1011000)
= 1111111-1011000
= ( 0100111 )₂
Radix Complement
• Also called R’s complement• R ’s complement of any number system can
be defined as [ ( Rⁿ-1 )-N ]+ 1• R = Base or Radix of a given number system• N = given number• n = no. of digits present in the given number• For Decimal Number System, R-1’s
complement is [ (10ⁿ-1) –N ] + 1• For Binary Number System, R ’s complement
is [ (2ⁿ-1) –N ] + 1
For Decimal Number System
• R = 10 R’s complement = 9’s complement
= [ (10ⁿ-1) –N ] + 1 R’s complement of 546700 is 10’s complement of 546700 = 9’s
complement + 1
9’s complement = (10⁶-1)- (546700) = 999999-546700
= 45329910’s complement = 453299 + 1 = 453300
For Binary Number System
• R = 2 ==> R’s complement = 2’s complement
= (2ⁿ-1) –N R’s complement of 1011000 is 1’s
complement + 1
1’s complement of 1011000 =(2⁷-1)- (1011000)
= 1111111-1011000
= ( 0100111 )₂
2’s complement = 0100111 + 1 = (01001000)₂
Subtraction with Complements(Unsigned Numbers)
• During subtraction of two n- digit unsigned numbers M & N of same base R, there occurs two cases
• Case (i): M>N• Case (ii): M<N• This operation can be applied for
any number system
For Decimal Number System
• M= minuend = 72532
• N = subtrahend = 3250• Perform M-N• Case (i) M>N is to be applied
M= 72532 M= 72532N = 03250 10’s complement N = 96750
--_______ +_______
69282 169282
For Decimal Number System
So case (ii) : M<NM = 03250 M = 03250N = 72532 N = 27468
-______ +_____
-69282 30718
For Binary Number System
• M= minuend = 1010100• N = subtrahend = 1000011• Perform M-N• Case (i) M>N is to be applied
M= 1010100 M= 1010100N = 1000011 2’s complement N = 0111101
-- _________ +_________ 0010001 10010001
For Binary Number System
So case (ii) : M<NM = 1000011 M = 1000011N = 1010100 N = 0101100
-_______ +________
- 0010001 1 1 0 1 1 1 1
Final Answer = - ( 2’s complement of 1101111) = - ( 0010001)₂
Signed- Binary Numbers
• “+ve” sign indicates a positive number• “-ve” sign indicates a negative number• Digital Circuits can understand only two
numbers 0 & 1• Hence to indicate the sign, an additional
bit is placed as the most significant bit.• 0 represents a +ve number• 1 represents a –ve number
• “+ve” sign indicates a positive number• “-ve” sign indicates a negative number• Digital Circuits can understand only two
numbers 0 & 1• Hence to indicate the sign, an additional
bit is placed as the most significant bit.• 0 represents a +ve number• 1 represents a –ve number
Signed- Binary Numbers
Consider an 8 bit number (01000100)₂
MSB of this no. is 0 which represents a +ve sign i.e., a positive number
Its equivalent is (01000100)₂ = (+68)10
Consider another number (11000100)₂
MSB of this no. is 1 which represents –ve sign i.e., a negative number
Its equivalent is (11000100)₂ = (-68)10
Signed- Binary Numbers
(101100)₂ =
MSB = 1 -ve number Magnitude =
(01100) = (12)₂ 10
Answer = Sign & Magnitude = (-12)10
Signed- Binary Numbers
(0111)₂ =
MSB = 0 +ve number Magnitude =
(111) = ( 7 )₂ 10
Answer = Sign & Magnitude = ( +7 )10
Signed- Binary Numbers1’s Complement representation
Also called Signed Complement representation
i.e., Sign + Complement
( 0101 )₂ = (+5)10
( 1010 )₂ = ( -5 )10 in 1’s complement form
( 01000 )₂ = (+8)10
( 10111 )₂ = ( -8 )10 in 1’s complement form
Signed- Binary Numbers2’s Complement representation
Also called Signed 2’s Complement representation
i.e., Sign + 2’s Complement of magnitude
( 0101 )₂ = (+5)10
( 1011 )₂ = ( -5 )10 in 2’s complement form
( 01000 )₂ = (+8)10
( 11000)₂ = ( -8 )10 in 2’s complement form
Signed Decimal Numbers
Signed Magnitude Signed 1’s complement
Signed 2’s complement
(+7) 0111 0111 0111
(+6) 0110 0110 0110
(+5) 0101 0101 0101
(+4) 0100 0100 0100
(+3) 0011 0011 0011
(+2) 0010 0010 0010
(+1) 0001 0001 0001
(+0) 0000 0000 0000
(-0) 1000 1111 --
(-1) 1001 1110 1111
(-2) 1010 1101 1110
(-3) 1011 1100 1101
(-4) 1100 1011 1100
(-5) 1101 1010 1011
(-6) 1110 1001 1010
(-7) 1111 1000 1001
(-8) -- -- 1000
Addition of 2 signed numbers
+ 6 00000110 +13 00001101 - - - - - -
- - - - - - - - - - - - - - - - - - - +19 00010011
- 6 11111010 +13 00001101 ------ ------------------- +19 00000111
- 6 11111010 -13 11110011 ------ ------------------- +19 11101101
+ 6 00000110 -13 11110011 ------ ------------------- +19 11111001
Subtraction of 2 signed numbers
• (+ A) – (+B) = (+ A) + (-B)• (+ A) – (-B) = (+ A) + (+B)
Overflow, Signed Integers
• As has been shown, when numbers are treated as signed integers, a “carry” of 1 from the addition of the most significant bits DOES NOT indicate an overflow, 3 00011+ (-3) +11101= 0 = 00000, with a carry of “1”
• For signed integers, overflow occurs when:
• The addition of two positive numbers results in a negative number, orThe addition of two negative numbers results in a positive number
Overflow Examples• In a 6-bit register
+ 17 = 010001+ 16 = +010000
=100001100001 = - (011110 + 1) = - 011111 = -31
• In an 8-bit register- 100 = - (0110 0100) = 1001 1011 +1 = 1001 1100- 50 = - (0011 0010) = 1100 1101 +1 = 1100 1110
= 0110 10100110 1010 = 6A16=6*16 + 10 = +106
Range of a numberOverflow during addition
• A fixed-length register can only hold a Range of numbers
• For a 4-bit device, the range of positive integers is 0 - 15
• For an 8-bit device the range of positive integers is 0 - 255
• When adding positive integers, Overflow occurs when the sum falls outside the range of the register
Overflow Summary
• For positive integers, overflow occurs when the carry from addition of the leftmost bits is a “1”
• For signed integers, overflow occurs when either
The addition of two negative numbers gives a positive number, or
The addition of two positive numbers gives a negative number.
Binary Codes
Codes
Weighted
Non-weighted
Weighted Codes
• BCD (8421) • (2421)• (5421)• (63-1-1)• (7421)
• N= w₃a₃ + w₂a₂ + w₁a₁
BINARY CODES
• Most compatible system for a computer or a digital system is binary system
• Most of the users are accustomed to decimal number system
• To reduce this gap, decimal numbers are converted to binary, arithmetic calculations are performed in binary, and then converted back to decimal.
BINARY CODES• Code is a symbolic representation of an
information transform
• During this process, we need to store decimal numbers in computer for performing conversion
• But computers accept only digits 0s & 1s
• So, we must represent these decimal digits by means of a code consisting of 0s & 1s.
• Arithmetic operations can be directly performed with decimal numbers when they are stored in computer in coded from.
BCD Code
• In simplest form of binary code, each decimal digit is represented by its binary equivalent.
8 5 4 . 7 9 2
1000 0101 0100 0111 1001 0010
Representation of BCD Code
( 3 4 5 )10 = ( 0011 0100 0101)BCD
= ( 101011001 )₂
( 1 5 7 )10 = ( 0001 0101 0111 )₂
BCD representation – 12 bits – denotes a decimal number
Binary value – 8 bits – denotes binary value itself
BCD Addition
1 8 4 0001 1000 0100 + 5 7 6 0101 01 1 1 01 10 ---------- ---------------------- 7 6 0 0 111 10000 1010 0 11 0 0110
----------------------- 0 111 0110 0000
Non-Weighted Codes
• Excess – 3 code• Gray code• 2 out of 5 code• Biquinary code
Excess-3 code
Gray Codes
The property of this code is that the successive decimal digits differ in exactly one bit.
Conversion from Binary to Gray
Conversion of Gray to Binary
Alpha numeric codes
• ASCII code• EBCDIC code
Binary Storage & Registers
Register Transfer
Logical Operation in Registers
Binary Logic