Chapter 1
Chapter 1
Chapter 1
Binary Systems
Introduction
We are in “Information age” since digital systems have such a prominent
and growing role in modern society. They are involved in our business
transactions, communications, transportation, medical treatment and
entertainment. In industrial world they are heavily employed in design,
manufacturing, distribution and sales.
Digital system
A digital signal is discrete-time as well as discrete-valued signal
A system that works with digital signal is digital system
Digital doesn’t always mean binary
Why digital?
Perfect Reconstruction/Regeneration
Error control
Encryption/Decryption
Advantages of Digital System
Easy to store and retrieve digital information
Easy to process digital data
Digital is less error prone
Error can be controlled
Noise does not accumulate from one logic stage to next as it does in
analog system (Regeneration)
The ease of large scale fabrication
Can be processed by a general purpose processor
Disadvantages of Digital System
Use more energy than analog circuits to accomplish the same tasks,
thus producing more heat as well.
Digital circuits are often fragile, in that if a single piece of digital
data is lost or misinterpreted, the meaning of large blocks of related
data can completely change.
Quantization error during analog signal sampling.
Analog system
It is system that manipulate physical quantities that represent in analog
form.
Analogue systems process analogue signals which can take any value
within a range, for example the output from an LDR (light sensor) or a
microphone.
An audio amplifier is an example of an analogue system. The amplifier
produces an output voltage which can be any value within the range of
its power supply.
Logic signals
Most digital systems use the simplest possible type of signal which has
just two values. This type of signal is called a logic signal because the
two values (or states) can be called true and false. Normally the positive
supply voltage +Vs represents true and 0V represents false. Other labels
for the true and false states are shown in the table.
Logic states
True False
1 0
High Low
+Vs 0V
On Off
Analog vs. Digital design
Digital design need to handle with only few specified (mostly two) logic levels
– It is less important to precisely simulate resistive, capacitive and inductive
parameters
– Design simulation can be based on the logic only, tools can therefore follow the
truth tables
Analog design requires precise voltage and current characteristics of the devices
– Parasitic capacitance, resistance, inductance are very important
– Circuit elements are non-linear
– Design verifications require complex simulations
involving solutions of differential equations
Block diagram of digital computer
Working principle
Memory stores programs as well as input, output and intermediate data.
The Datapath performs arithmetic and other data-processing operations
as specified by the program. The control unit supervises the flow of
information between the various units. A Datapath, when combined with
the control unit, forms a component referred to as a central processing
unit, or CPU. The program and data prepared by the user are transferred
into memory by means of an input device such as a keyboard. An output
device, such as a CRT (cathode-ray tube) monitor, displays the results of
the computations and presents them to the user.
Number system
Number: Arithmetical value representing a particular quantity. The
various types of numbers are Natural Numbers, Whole Numbers,
Integers, Rational Numbers, Irrational Numbers, Real Numbers etc.
Integers
Integers are the numbers that includes whole numbers along with the
negative numbers.
Rational ,irrational, whole number ?
Number system
The technique to represent and work with numbers is called number
system. Decimal number system is the most common number system.
Other popular number systems include binary number system, octal
number system, hexadecimal number system, etc.
Decimal Number System
Decimal number system is a base 10 number system having 10 digits
from 0 to 9. This means that any numerical quantity can be represented
using these 10 digits. Decimal number system is also a positional value
system. This means that the value of digits will depend on its position.
Let us take an example to understand this.
Decimal number system
Example – 734, 971 and 207. The value of 7 in all three numbers is
different−
In 734, value of 7 is 7 hundreds or 700 or 7 × 100 or 7 × 10^2
In 971, value of 7 is 7 tens or 70 or 7 × 10 or 7 × 10^1
In 207, value 0f 7 is 7 units or 7 or 7 × 1 or 7 × 10^0
In digital systems, instructions are given through electric signals;
variation is done by varying the voltage of the signal. Having 10
different voltages to implement decimal number system in digital
equipment is difficult. So, many number systems that are easier to
implement digitally have been developed.
Binary Number System
The easiest way to vary instructions through electric signals is two-state
system – on and off. On is represented as 1 and off as 0, though 0 is not
actually no signal but signal at a lower voltage. The number system having
just these two digits – 0 and 1 – is called binary number system.
Each binary digit is also called a bit. Binary number system is also
positional value system, where each digit has a value expressed in powers
of 2,5 as displayed here. 3
2 2 4
2 2 2
21
20
In any binary number, the rightmost digit is called least significant bit
(LSB) and leftmost digit is called most significant bit (MSB).
Binary Number System
1 0 0 0 1 1
MSB LSB
Computer memory is measured in terms of how many bits it can store.
Here is a chart for memory capacity conversion.
Unit of data storage
Bit=1 0r 0 (on or off)
1 byte (B) = 8 bits
1 Kilobytes (KB) = 1024 bytes
1 Megabyte (MB) = 1024 KB
1 Gigabyte (GB) = 1024 MB
1 Terabyte (TB) = 1024 GB
1 Exabyte (EB) = 1024 PB
1 Zettabyte = 1024 EB
1 Yottabyte (YB) = 1024 ZB
Octal Number System
Octal number system has eight digits – 0, 1, 2, 3, 4, 5, 6 and 7. Octal
number system is also a positional value system with where each digit
has its value expressed in powers of 8.
Decimal equivalent of any octal number is sum of product of each digit
with its positional value.
it into groups of 3 bits, give each group an octal symbol and combine the result.
Integer part: Group bits from right to left of an octal point. 0’s can be added to make
it multiple of 3.
Fractional part: Group bits from left to right of an octal point. 0’s must be added to
equivalent hex, we divide it into groups of 4 bits, give each group a hex digit and combine
Number Base Conversions
Q. (41.6875)10=(?)8
Q. (41.675)8=(?)16
Q. (A5.6875)16=(?)8
Q. (1010101.1101)2=(?)8
Q. (11101.1010)2=(?)16
Complements
Complements are used in digital computers for simplifying the subtraction operation and
for logical manipulation. There are two types of complements for each base-r system: r's
complement and the second as the (r - 1)'s complement. When the value of the base r is
substituted, the two types are referred to as the 2's complement and 1's complement for
binary numbers, the 10's complement and 9's complement for decimal numbers etc.
(r-1)'s Complement (diminished radix compl.)
(r-1)'s complement of a number N is defined as
(r^n-1) –N
Where N is the given number
r is the base of number system
n is the number of digits in the given number
To get the (r-1)'s complement fast, subtract each
digit of a number from (r-1).
Example:
- 9's complement of 835 is 164 (Rule: (10^n-1) –N)
- 1's complement of 1010 is 0101 (bit by bit complement operation)
r's Complement (radix complement)
r's Complement (radix complement)
r's complement of a number N is defined as r^n–N
Where N is the given number
r is the base of number system
n is the number of digits in the given number
To get the r's complement fast, add 1 to the low-order digit of its (r-1)'s
complement.
Example:
- 10's complement of 835 is 164 + 1 =
165
- 2's complement of 1010 is 0101 + 1 = 0110
Subtraction with complements
The direct method of subtraction taught in elementary schools uses the
borrow concept. When subtraction is implemented with digital hardware,
this method is found to be less efficient than the method that uses
complements.
1. Subtraction using 1’s complement
2. Subtraction using 2’s complement
3. Subtraction using 10’s complement
4. Subtraction using 9’s complement
Perform the following:
1. Subtract 101011 from 11101 using 1’s complement
2. Subtract 10111 from 111011 using 1’s complement
3. Subtract 101011 from 11101 using 2’s complement
4. Subtract 10111 from 111011 using 2’s complement
5. Subtract 5657 from 6745 using 9’s complement
6. Subtract 456434 from 124567 using 10’s complement
Binary Codes
Electronic digital systems use signals that have two distinct values and
circuit elements that have two stable states. There is a direct analogy
among binary signals, binary circuit elements, and binary digits. A
binary number of n digits, for example, may be represented by n binary
circuit elements, each having an output signal equivalent to a 0 or a 1.
Digital systems represent and manipulate not only binary numbers, but
also many other discrete elements of information. Any discrete element
of information distinct among a group of quantities can be represented
by a binary code. Binary codes play an important role in digital
computers. The codes must be in binary because computers can only
hold 1's and 0's.
Binary Coded Decimal (BCD)
The binary number system is the most natural system for a computer, but
people are accustomed to the decimal system. So, to resolve this
difference, computer uses decimals in coded form which the hardware
understands. A binary code that distinguishes among 10 elements of
decimal digits must contain at least four bits. Numerous different binary
codes can be obtained by arranging four bits into 10 distinct
combinations. The code most commonly used for the decimal digits is
the straightforward binary assignment listed in the table below. This is
called binary-coded decimal and is commonly referred to as BCD
Binary Coded Decimal (BCD)
Binary Coded Decimal (BCD)
A number with n decimal digits will require 4n bits in BCD. E.g. decimal
396 is represented in BCD with 12 bits as 0011 1001 0110.
Numbers greater than 9 has a representation different from its equivalent
binary number, even though both contain 1's and 0's.
Binary combinations 1010 through 1111 are not used and have no
meaning in the BCD code.
Example:
(185)10= (0001 1000 0101)BCD = (10111001)2
Error-Detection codes
Binary information can be transmitted from one location to another by
electric wires or other communication medium. Any external noise
introduced into the physical communication medium may change some
of the bits from 0 to 1 or vice versa.
The purpose of an error-detection code is to detect such bit-reversal
errors. One of the most common ways to achieve error detection is by
means of a parity bit. A parity bit is the extra bit included to make the
total number of 1's in the resulting code word either even or odd.
Error Checking Mechanism
During the transmission of information from one location to another, an
even parity bit is generated in the sending end for each message
transmission. The message, together with the parity bit, is transmitted to
its destination. The parity of the received data is checked in the receiving
end. If the parity of the received information is not even, it means that at
least one bit has changed value during the transmission.
This method detects one, three, or any odd combination of errors in each
message that is transmitted. An even combination of errors is undetected.
Additional error detection schemes may be needed to take care of an
even combination of errors.
Gray code (Reflected code)