You are on page 1of 55

Digital Logic Design

[Eeng-3191]
Chapter One:
Introduction to Digital Systems

1.1 Basic Concepts

Analog Vs Digital Quantities and


Representations
In science, technology, business, and, in fact,
most other fields of endeavor, we are constantly
dealing with quantities.
Quantities are measured, monitored, recorded,
manipulated arithmetically, observed, or in some
other way utilized in most physical systems.
It is important when dealing with various
quantities that we be able to represent their
values efficiently and accurately.
There are basically two ways of representing the
numerical value of quantities: analog and digital.
3

Analog Representations
In analog representation, a quantity is represented
by a voltage, current, or meter movement that is
proportional to the value of that quantity.
Some examples are: the automobile speedometer,
the common mercury thermometer, audio
microphone, etc.
Analog quantities such as the cited above have an
important characteristic: they can vary over a
continuous range of values.
4

Contd

Figure 1-1 Graph of an analog quantity


(temperature versus time).
5

Digital Representations
In digital representation the quantities represented
not by proportional quantities but by symbols called
digits.
As an example, consider the digital watch, as we
know, the time of day changes continuously, but the
digital watch reading does not change continuously;
rather, it changes in steps of one per minute (or per
second).
In other words, this digital representation of the time
of day changes in discrete steps, as compared with
the representation of time provided by an analog
watch, where the dial reading changes continuously. 6

Digital Representations
In general, the major difference between analog and digital
quantities, then, can be simply stated as follows:
Analog = Continuous
Digital = Discrete (Step By Step)
If you take the temp. each hour, you are sampling the above
graph. Now, you have sampled-values representing the
temperature at discret points in time(every hour) over a 24hour period, as indicated in Figure 1-2.
Each value represented by a dot can be digitized by
representing it as a digital code that consists of a series of 1s
and 0s.
7

Contd

Figure 1.2 Sampled-value representation


(quantization) of the analog quantity in
Figure 1-1.

Digital and Analog systems


A digital system:- a combination of devices
designed to manipulate logical information or
physical quantities that are represented in digital
form i.e. the quantities can take on only discrete
values.
Some of the more familiar digital systems
include: Digital computers and calculators,
Digital audio and video equipment, and
The telephone systemthe worlds largest digital
system.
9

Contd
An analog system:- contains devices that
manipulate physical quantities that are
represented in analog form.
In an analog system, the quantities can vary over
a continuous range of values.
For example, the amplitude of the output signal
to the speaker in a radio receiver can have any
value between zero and its maximum limit.
Other Common analog systems are audio
amplifiers, magnetic tape recording and playback
equipment.
10

Contd

Figure 1.3 Basic audio public address system


11

Advantages of Digital Techniques


Digital systems are generally easier to design. This is because the circuits
that are used are switching circuits.
Information storage is easy. This is accomplished by special devices and
circuits that can latch onto digital information and hold it for as long as
necessary.
Accuracy and precision are greater:- Digital data can be stored more
compactly/easily and reproduced with greater accuracy and clarity.
Operation can be easily programmed. It is fairly easy to design a digital
systems whose operation is controlled by a set of stored instruction called
program.
Digital circuits are less affected by noise:- Since the exact value of voltage
is not important in digital systems.
More digital circuits can be fabricated on IC chips:- Due to its relative
Complexity and economical problem, analog s/m cant achieve the same
degree of integration.
12

Contd
The Only major drawback when using digital
techniques is:- the real world is mainly analog.
Most physical quantities are analog in nature, and
they need to be monitored, operated on, and
controlled by the system.
E.g. Temperature, Pressure, velocity, liquid levels,
flow rate etc.
We are in the habit of expressing these quantities
digitally, such as when we say that the temperature
is 64.
13

Contd
To take advantage of digital techniques when dealing
with analog inputs and outputs, three steps must be
followed:
Convert the real-world analog inputs to digital
form(by using ADC).
Process (operate on) the digital information.
Convert the digital outputs back to real-world
analog form(by using DAC).

14

Contd
As example, consider a Compact disk(CD)
player, as shown below.

Figure 1.4 Basic principle of a CD player


15

Contd
First, during recording of audio using Compact
disks(CDs), sound from instruments and human
voices produces an analog voltage signal in the
micro phone.
Then, this analog signal is converted to digital
using ADC.
The digital information is stored on the CDs
surface. Then the process for playing the CD
shown on the figure 1.4 above takes place during
play back.
16

Binary Digits
Each of the two digits in the binary system, 1 and 0, is
called a bit, which is a contraction of the words binary digit.
In digital circuits, two different voltage levels are used to
represent the two bits.
Generally, 1 is represented by the higher voltage, which we
will refer to as a HIGH, and a 0 is represented by the lower
voltage level, which we will refer to as a LOW.
HIGH = 1 and LOW = 0
Groups of bits (combinations of 1s and 0s), called codes,
are used to represent numbers, letters, symbols,
instructions, and anything else required in a given
application.

17

Logic Levels
The voltages used to represent a 1 and a 0 are
called logic levels.
Ideally, one voltage level represents a HIGH
and another voltage level represents a LOW.
In a practical digital circuit, however, HIGH can
be any voltage between a specified minimum
value and a specified maximum value.
Likewise, a LOW can be any voltage between a
specified minimum and a specified maximum.
18

Contd
Figure below illustrates the
general
range of LOWs
and HIGHs for
a digital
circuit.
The variable VH(max)
represents the maximum
HIGH voltage value, and
VH(min) represents the
minimum HIGH voltage
value.
19

Contd
The maximum LOW voltage value is represented by VL(max),
and the minimum LOW voltage value is represented by
VL(min)'
The voltage values between VL(max) and VH(min) are
unacceptable for proper operation.
For example, the HIGH values for a certain type of digital
circuit called CMOS may range from 2V to 3.3V and the LOW
values may range from o V to 0.8V.
So, for example, if a voltage of 2.5 V is applied, the circuit will
accept it as a HIGH or binary 1.
If a voltage of 0.5V is applied, the circuit will accept it as a
LOW or binary O.
For this type of circuit, voltages between 0.8 V and 2 V are
20
unacceptable.

1.2 Number Systems and Codes

Number Systems
A number system is a set of symbols used to
express quantities as the basis for counting,
determining
order,
comparing
amounts,
performing calculations, and representing value.
The most frequently used number systems are:

Decimal
Binary
Octal
Hexadecimal
22

Decimal Numbers
The decimal system is composed of 10 numerals or symbols.
These 10 symbols are 0, 1, 2,3,9; using these symbols as
digits of a number, we can express any quantity.
The decimal system, also called the base-10 system because
it has 10 digits.
The position of each digit in a decimal number indicates the
magnitude of the quantity represented and can be assigned
a weight.
The weights for whole numbers are positive powers of ten
that increase from right to left, beginning with 10 = 1.
For fractional numbers, the weights are negative powers of
ten that decrease from left to right beginning with 10-1.

23

Contd
The value of a decimal number is the sum of the digits after
each digit has been multiplied by its weight.
Example:-

Example 2:- Express the decimal number 568.23 as a sum of


the values of each digit.

24

Binary Numbers
The binary number system has two digits (bits). The two binary
digits (bits) are 1 and 0.
The position of a 1 or 0 in a binary number indicates its weight. The
weights in a binary number are based on powers of two.
The right-most bit is the LSB (least significant bit) in a binary whole
number and has a weight of 2 = 1.
The weights increase from right to left by a power of two for each
bit. The left-most bit is the MSB (most significant bit). The left-most
bit is the MSB in a binary fractional number and has a weight of 21= 0.5.
The fractional weights decrease from left to right by a negative
power of two for each bit.
Generally, the weight structure of a binary number is
where n is the
number of bits from
25
the binary point.

Binary to Decimal Conversion


The decimal value of any binary number can be found by adding the
weights of all bits that are 1 and discarding the weights of all bits that are O.

Example:-Convert the binary whole number 1101101 to decimal

Example 2:- Convert the fractional binary number 0.1011 to decimal.

Ex :-

26

DECIMAL- TO-BINARY CONVERSION

a. Sum-of-Weights Method
One way to find the binary number that is equivalent to a given
decimal number is to determine the set of binary weights whose sum
is equal to the decimal number.
Example:- Convert the following decimal numbers to binary:
b. Repeated Division-by-2 Method
To get the binary number for a given decimal number, divide the
decimal number by 2 until the quotient is 0. Remainders form the
binary number.
The first remainder to be produced is the LSB in the binary number,
and the last remainder to be produced is the MSB.
Example:- Convert the following decimal numbers to binary:
27

Converting Decimal Fractions to Binary


Sum-of-Weights:-The sum-of-weights method can be applied to
fractional decimal numbers, as shown in the following example:
Repeated Multiplication by 2 :-Decimal fractions can be converted to
binary by repeated multiplication by 2.
Multiplying each resulting fractional part of the product by 2 until the
fractional product is zero or until the desired number of decimal
places is reached.
The carry digits, or carries, generated by the multiplications produce
the binary number.
The first carry produced is the MSB, and the last carry is the LSB.
Example:-Convert each decimal number to binary by using the
repeated multiplication-by-2 for fractions.

a) 0.625

b) 0.375

28

BINARY ARITHMETIC

Division in binary follows the same procedure as


division in decimal. as Example blew illustrates. The
equivalent decimal divisions are also given.

29

1'S AND 2'S


COMPLEMENTS OF BINARY NUMBERS
The 1's complement and the 2's complement of a binary number are
important because they permit the representation of negative numbers.
The method of 2's complement arithmetic is commonly used in computers
to handle negative numbers.

A. FINDING THE 1'S COMPLEMENT


The l's complement of a binary number is found by changing all 1s to 0s and
all 0s to 1s.

B. FINDING THE 2' S COMPLEMENT


The 2's complement of a binary number is found by adding 1 to the LSB of
the l's complement.

30

SIGNED NUMBERS
Digital systems, such as the computer, must be able to handle both positive
and negative numbers.
A signed binary number consists of both sign and magnitude information.
The sign indicates whether a number is positive or negative, and the
magnitude is the value of the number.
There are three forms in which signed integer (whole) numbers can be
represented in binary:
a. Sign-magnitude,
b. l's complement, and
c. 2' complement.
Of these, the 2's complement is the most important and the signmagnitude is the least used.
The Sign Bit:- the left-most bit in a signed binary number is the sign bit,
which tells you whether the number is positive or negative.
A 0 sign bit indicates a +ve number, and a 1 sign bit indicates a ve number.
31

Cont.
a. Sign-Magnitude Form
When a signed binary number is represented in sign-magnitude, the left-most bit is
the sign bit and the remaining bits are the magnitude bits.
The magnitude bits are in true (uncomplemented) binary for both positive and
negative numbers.
For example, the decimal number + 25 is expressed as an 8-bit signed binary
number using the sign-magnitude form as

Notice that the only difference between + 25 and - 25 is the sign bit.

b. l' s Complement Form


Positive numbers in I's complement form are represented the same way as the
positive sign-magnitude numbers.
Negative numbers, however, are the l's complements of the corresponding positive
numbers.
For example:- using eight bits, the decimal number -25 is expressed as the 1's
complement of +25 (0001100 I ) as 11100110
32

Cont.
c. 2 ' s Complement Form
Positive numbers in 2's complement form are represented the same way as in the
sign-magnitude and l's complement forms.
Negative numbers are the 2's complements of the corresponding positive numbers.
Again, using eight bits, let's take decimal number -25 and express it as the 2's
complement of +25 (00011001).
111O0111
In the 2's complement form, a negative number is the 2's complement of the
corresponding positive number.
:-Express the decimal number -39 as an 8-bit number in the
a) sign-magnitude
b) I's complement, and
c) 2's complement forms.
The Decimal Value of Signed Numbers
Example:- Determine the decimal value of this signed binary number expressed in :
a) sign-magnitude
b) 1's complement, and c) 2's complement forms.
i) 10010101

ii) 00010I11 iii) 11101000


33

ARITHMETIC OPERATIONS WITH SIGNED NUMBERS


The most commonly used system for representing signed binary numbers is the 2scomplement system.
Because the 2's complement form for representing signed numbers is the most
widely used in computers and microprocessor-based systems, the coverage in this
section is limited to 2's complement arithmetic.
A. ADDITION
There are four cases that can occur when two signed binary numbers are added.
Case I: Two Positive Numbers. The addition of two positive numbers is straight
forward. Consider the addition of +9 and +4:
Note:- Addition of two positive
numbers yields a positive
number.
Case II: Positive Number and Smaller Negative Number. Consider the addition of
+9 and -4. Remember that the 4 will be in its 2s-complement form. Thus, +4
(00100) must be converted to -4 (11100).
Note:- The final carry bit is discarded. The
sum is positive and therefore in true (uncomplemented) binary.
34

Cont.
Case III: Positive Number and Larger Negative Number. Consider the addition of
-9 and +4:
Note:- The sum is negative and therefore in
2's complement form.
Case IV: Two Negative Numbers:- Consider the addition of -5 and -9:
Note:- The final carry bit is discarded.
The sum is negative and therefore in
2's complement form.
In a computer, the negative numbers are stored in 2's complement form so. as you
can see, the addition process is very simple: Add the two numbers and discard any
final carry bit.
Overflow Condition:- When two numbers are added and the number of bits
required to represent the sum exceeds the number of bits in the two numbers, an
overflow results.
An overflow can occur only when both
numbers are positive or both numbers are
35
negative.

Cont.
B) SUBTRACTION
Subtraction is a special case of addition.
For example, subtracting +6 from +9 is equivalent to adding -6 to +9.
Basically, the subtraction operation changes the sign of the subtrahend and adds it
to the minuend.
The result of a subtraction is called the difference.

NOTE:-The sign of a positive or negative binary number is changed by taking its 2's
complement.
To subtract two signed numbers, take the 2's complement of the subtrahend and
add. Discard any final carry bit.

36

HEXADECIMAL NUMBERS
The hexadecimal number system has a base of sixteen; that is, it is composed of 16
numeric and alphabetic characters.
The hexadecimal number system consists of digits 0,1,29 and letters A,B,C,D,E & F

Binary-to-Hexadecimal Conversion
Simply break the binary number into 4-bit groups, starting at the LSB and replace
each 4-bit group with the equivalent hexadecimal symbol.

Hexadecimal-to-Binary Conversion
To convert from a hexadecimal number to a binary number, reverse the process
and replace each hexadecimal symbol with the appropriate four bits.
Hexadecimal is a convenient way to represent binary numbers.
37

Cont.

Hexadecimal-to-Decimal Conversion
One way to find the decimal equivalent of a hexadecimal number is to first convert
the hexadecimal number to binary and then convert from binary to decimal.
Exapmle:- Convert the following hexadecimal numbers to decimal:

Another is to multiply the decimal value of each hexadecimal digit by its weight and
then take the sum of these products.
Example:-Convert the following hexadecimal numbers to decimal:

38

Hexadecimal Addition
Addition can be done directly with hexadecimal numbers as the following example
Example:- Add the following hexadecimal numbers:

Hexadecimal Subtraction
Convert the hexadecimal number to binary. Take the 2's complement of the binary
number. Convert the result to hexadecimal.
Example:- Subtract the following hexadecimal numbers:

39

OCTAL NUMBERS
The octal number system is composed of eight digits, which are 0, I, 2, 3, 4, 5, 6, 7
The octal number system has a base of 8.

Octal-to-Decimal Conversion
The evaluation of an octal number in terms of its decimal equivalent is
accomplished by multiplying each digit by its weight and summing the products.

Octal-to-Binary Conversion
Because each octal digit can be represented by a 3-bit binary number, it is very easy
to convert from octal to binary.

To convert an octal number to a binary number, simply replace each octal digit with
the appropriate three bits.
Example:-Convert each of the following octal numbers to binary:

40

Binary-to-Octal Conversion
Conversion of a binary number to an octal number is the reverse of the octaJ-tobinary conversion.
Start with the right-most group of three bits and, moving from right to left, convel1
each 3-bit group to the equivalent octal digit.
Example:-Convert each of the following binary numbers to octal:

41

BINARY CODED DECIMAL (BCD)


Binary coded decimal means that each decimal digit, 0 through 9, is represented by
a binary code of four bits.
The 8421 code is a type of BCD (binary coded decimal) code.
The designation 8421 indicates the binary weights uf the four bits (23 , 22 , 21 ,20 )

Invalid Codes:-The six code combinations that are not used-1010, 1011, 1100,
1101, 1110, and 1111-are invalid in the 842] BCD code..
To express any decimal number in BCD, simply replace each decimal digit with the
appropriate 4-bit code, as shown by Example:
Example:-Convert each of the following decimal numbers to BCD:

42

Cont.
It is equally easy to determine a decimal number from a BCD number.
Start at the right most bit and break the code into groups of four bits.
Then write the decimal digit represented by each 4-bit group.

Example:-Convert each of the following BCD codes to decimal:

43

DIGITAL CODES
Many specialized codes are used in digital systems.
You have just learned about the BCD code; now let's look at a few others.
Some codes are strictly numeric, like BCD, and others are alphanumeric; that is,
they are used to represent numbers, letters, symbols, and instructions.
The codes introduced in this section are the Gray code and the ASCII code.

The Gray Code


The Gray code is unweighted and is not an arithmetic code; that is, there are no
specific weights assigned to the bit positions.
The important feature of the Gray code is that it exhibits only a single bit change
from one code word to the next in sequence.
This property is important in many applications, such as shaft position encoders,
where error susceptibility increases with the number of bit changes between
adjacent numbers in a sequence.
Like binary numbers. the Gray code can have any number of bits. Notice the singlebit change between successive Gray code words.

44

Cont.
The following table is listing of the 4-bit Gray code for decimal numbers 0,1,2,15.

Binary-to-Gray Code Conversion


The following rules explain how to convert from a binary number to a Gray code
word:
1.

The most significant bit (left-most) in the Gray code is the same as the
corresponding MSB in the binary number.

2.

Going from left to right, add each adjacent pair of binary code bits to get the
next Gray code bit. Discard carries.
45

Cont.
Gray-to-Binary Conversion To convert from Gray code to binary, use a similar
method; however, there are some differences.
The following rules apply:
1. The most significant bit (left-most) in the binary code is the same as the corresponding
bit in the Gray code.
2. Add each binary code bit generated to the Gray code bit in the next adjacent sposition.
Discard carries.

46

Alphanumeric Codes
Alphanumeric codes are codes that represent numbers and alphabetic characters
(letters).
Most such codes, however, also represent other characters such as symbols and
various instructions necessary for conveying information that are found on a
computer keyboard.
The ASCII is the most common alphanumeric code and is covered next.
ASCII:-is the abbreviation for American Standard Code for Information Interchange.
ASCII is a universally accepted alphanumeric code used in most computers and
other electronic equipment.
Most computer keyboards are standardized with the ASCII.
When you enter a letter. a number, or control command, the corresponding ASCII
code goes into the computer.
ASCII has 128 characters and symbols represented by a 7-bit binary code.
Actually, ASCII can be considered an 8-bit code with the MSB always O. This 8-bit
code is 00 through 7F in hexadecimal.
The following table is a listing of partial ASCII code showing the decimal,
hexadecimal, and binary representations for each character and symbol.
47

1. INTRODUCTION

48

Cont.
Example:-The following is a message encoded in ASCII code. What s the message?
1001000 1000101 1001100 1010000

Solution: Convert each seven-bit code to its hex equivalent.


The results are 48 45 4C 50
Now locate these hex values in Table above and determine the character
represented by each. The results are

HELP

Example2: write your full name using ASCII Code.

Example3:

49

Exercise

50

Parity Method for Error Detection


Binary data and codes are frequently moved
between locations:
Digitized voice over a microwave link.
Storage/retrieval of data from magnetic/optical
disks.
Communication between computer systems
over telephone lines, using a modem.

Ronald Tocci/Neal Widmer/Gregory Moss


Digital Systems: Principles and Applications, 10e

Copyright 2007 by Pearson Education, Inc.


Columbus, OH 43235
All rights reserved.

51

Parity Method for Error Detection


Electrical noise can cause errors during
transmission.
Spurious fluctuations in voltage or current present
in all electronic systems.

Many digital systems employ methods for error


detectionand sometimes correction.
One of the simplest and most widely used schemes
for error detection is the parity method.
Ronald Tocci/Neal Widmer/Gregory Moss
Digital Systems: Principles and Applications, 10e

Copyright 2007 by Pearson Education, Inc.


Columbus, OH 43235
All rights reserved.

52

Parity Method for Error Detection


The parity method of error detection requires
the addition of an extra bit to a code group.
Called the parity bit, it can be either a 0 or 1,
depending on the number of 1s in the code group.

There are two parity methods, even and odd.


The transmitter and receiver must agree on
the type of parity checking used.
Even seems to be used more often.

Copyright 2007 by Pearson Education, Inc.


Columbus, OH 43235
All rights reserved.

53

Parity Method for Error Detection


Even parity methodthe total number of bits in a
group including the parity bit must add up to an even
number.
The binary group 1 0 1 1 would require the addition of a
parity bit 1, making the group 1 1 0 1 1.
The parity bit may be added at either end of a group.

Copyright 2007 by Pearson Education, Inc.


Columbus, OH 43235
All rights reserved.

54

Parity Method for Error Detection


Odd parity methodthe total number of bits in a
group including the parity bit must add up to an odd
number.
The binary group 1 1 1 1 would require the addition of a
parity bit 1, making the group 1 1 1 1 1.
The parity bit becomes a part of the code word.

Adding a parity bit to the seven-bit ASCII


code produces an eight-bit code.

Ronald Tocci/Neal Widmer/Gregory Moss


Digital Systems: Principles and Applications, 10e

Copyright 2007 by Pearson Education, Inc.


Columbus, OH 43235
All rights reserved.

55

You might also like