Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views62 pages

Chapter 1 Introduction

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 62

Digital Logic Design

University of Gondar
Institute of Technology
Department of Electrical Engineering
Digital Logic Design:
Chapter 1: Introduction to Digital Systems
By:
Habtamu Maru

Habtamu M. Digital Logic Design February 27, 2023 1 / 61


Digital Logic Design

Outline

1 Introduction to Digital and analogue Systems

2 Advantages and Limitations of Digital Techniques


Advantages of Digital system
Limitations of Digital system

3 Comparison chart

4 Binary digit, Logic level & Digital wave form

5 Number system ,operations and codes


Types of numbering system
Conversion of one Number System to Another

Habtamu M. Digital Logic Design February 27, 2023 2 / 61


Digital Logic Design
Introduction to Digital and analogue Systems

Introduction to Digital Systems

Quantities are measured, monitored, recorded, manipulated arith-


metically, observed, or in some other way utilized in most physical
systems that represent their values efficiently and accurately.
There are basically two way of representing the numerical value
of quantities i.e. Analogue & digital.
Analog Representations:
In analog representation a quantity is represented by a continu-
ously variable, proportional indicator.
In the world most quantities having continuous value are ana-
logue.

Habtamu M. Digital Logic Design February 27, 2023 3 / 61


Digital Logic Design
Introduction to Digital and analogue Systems

Analog means continuous both in time and amplitude


Analog information exhibit smooth, gradual changes over time
and assume a continuous (infinite) range of amplitudes. Eg.:
I Room and body temperature
I Our speech
I Speed of the car
I Electric current,volt. . . etc.

Figure: Temperature in analogue Figure: Digital quantity

quantity
Habtamu M. Digital Logic Design February 27, 2023 4 / 61
Digital Logic Design
Introduction to Digital and analogue Systems

The temperature on a continuous basis suppose just take a tem-


perature reading every hours.
For example, the air temp changes over a continuous range of
values during a given day a temp doesn’t go from 70°F - 71°F in-
stantaneously; it takes on all the infinite values in between.
It may be measured to be 70 °F or 70.01 °F or 70.001 °F or even
70.0001 °F and so on, depending upon the accuracy of the mea-
suring instrument.
In electrical analog systems, the physical quantity that is being
measured or processed is converted to a proportional voltage or
current (electrical signal).
This voltage or current is then used by the system for display, pro-
cessing, or control purposes.
Habtamu M. Digital Logic Design February 27, 2023 5 / 61
Digital Logic Design
Introduction to Digital and analogue Systems

Digital Representations:
In digital representation the quantities are represented not by continu-
ously variable indicators but by symbols called digits.
Digital information assume a limited (finite) set of ”Discrete” (step by step)
values.
Values change suddenly (not smoothly) by ”Jumping” between values.
Examples:
I Energy levels of electrons in atoms.
I Digital clock
As an example, consider the digital clock, which provides the time of day
in the form of decimal digits that represent hours , minutes and seconds.
As we know, the time of day changes continuously, but the digital clock
reading does not change continuously; rather, it changes in steps of one
per minute or per second.
Habtamu M. Digital Logic Design February 27, 2023 6 / 61
Digital Logic Design
Advantages and Limitations of Digital Techniques
Advantages of Digital system

Advantages of Digital system:


Digital systems are easier to design: The switching circuits in
which there are only HIGH and LOW voltage levels, are easier to
design. The exact numerical values of voltages are not impor-
tant because they have only logical significance; only the range
in which they fall is important.
Information storage is easy: There are many types of semicon-
ductor and magnetic memories of large capacity which can store
data for periods as long as necessary.
Accuracy and precision are greater: Digital systems are much more
accurate and precise than analog systems, because digital systems can be
easily expanded to handle more digits by adding more switching circuits.
Analog systems will be quite complex and costly for the same accuracy
and precision.
Habtamu M. Digital Logic Design February 27, 2023 7 / 61
Digital Logic Design
Advantages and Limitations of Digital Techniques
Advantages of Digital system

Digital systems are more versatile: It is fairly easy to design


digital systems whose operation is controlled by a set of stored
instructions called the program. Any time the system operation
is to be changed, it can easily be accomplished by modifying the
program.
Digital circuits are less affected by noise: Unwanted electrical
signals are called noise. Noise is unavoidable in any system.
I Since in analog systems the exact values of voltages are important
and in digital systems only the range of values is important, the effect
of noise is more severe in analog systems.
I In digital systems, noise is not critical as long as it is not large enough
to prevent us from distinguishing a HIGH from a LOW.

Habtamu M. Digital Logic Design February 27, 2023 8 / 61


Digital Logic Design
Advantages and Limitations of Digital Techniques
Limitations of Digital system

There are really very few drawbacks when using digital techniques.
The two biggest problems are:
I The real world is analog.
I Processing digitized signals takes time.

Most physical quantities are analog in nature, and these quanti-


ties are often the inputs and outputs that are being monitored,
operated on, and controlled by a system.
To take advantage of digital techniques when dealing with analog
inputs and outputs, four steps must be followed:
1 Convert the physical variable to an electrical signal (analog).
2 Convert the electrical (analog) signal into digital form.
3 Process (operate on) the digital information.
4 Convert the digital outputs back to real-world analog form.

Habtamu M. Digital Logic Design February 27, 2023 9 / 61


Digital Logic Design
Advantages and Limitations of Digital Techniques
Limitations of Digital system

The need for conversion between analog and digital (ADC and
DAC) forms of information can be considered a drawback because
of the added complexity and expense.
Another factor that is often important is the extra time required
to perform these conversions.
In many applications, these factors are outweighed by the numer-
ous advantages of using digital techniques, and so the conversion
between analog and digital quantities has become quite common
place in the current technology.

Habtamu M. Digital Logic Design February 27, 2023 10 / 61


Digital Logic Design
Comparison chart

Analog Digital
Basic: It is a continuous wave Basic: It is a discrete wave
that changes over a time pe- that carries information in bi-
riod. nary form.
Signal: Analog signal is a Signal: Digital signals are dis-
continuous which represents crete time signals generated
physical measurements. by digital modulation.
Representation: Uses con- Representation: Uses dis-
tinuous range of values to crete values to represent
represent information & de- information & denoted by
noted by sine waves. square waves.
Range: It has no fixed range.
Range: It has finite № (0 & 1).
Habtamu M. Digital Logic Design February 27, 2023 11 / 61
Digital Logic Design
Comparison chart

Technology: Analog technol- Technology: Samples analog


ogy records wave forms as wave forms into a limited set
they are. of numbers & records them.
Description: It is described by Description: It is described by
the amplitude, period or fre- bit rate and bit intervals.
quency, and phase.
Memory: Stored in the form
Memory: Stored in the form of binary bit
of wave signal.
Power: Digital instrument
Power: Analog instrument draws only negligible power.
draws large power.
Cost: Cost is high and not eas-
Cost: Low cost and portable.
ily portable

Habtamu M. Digital Logic Design February 27, 2023 12 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

Digital electronics involves circuits and systems in which there are


only two possible states. The states are represented by two dif-
ferent levels:
I Digit Values: 0 and 1
I Logic Levels: True and False
I Signal Levels (voltage and current): Low and High
I States: ON and OFF or open and closed

In digital system such as computers, combination of the two state,


called codes are used to represent numbers, symbols, alphabetic
characters, and other types of information.
The two state number system is called binary and its two digit are
0 & 1. A binary digit is called a bit.

Habtamu M. Digital Logic Design February 27, 2023 13 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

Binary digit
Each of the two digit in binary system, 1 & 0 is called a bit, which
is the contraction of the word binary digit.
In digital circuit ,two different voltage level are used to represent
the two bits.
Generally 1 is represented by the higher voltage, which we will
refers as to HIGH and 0 is represented by the lower voltage level
,which we will refers to as a LOW.
This is called positive logic HIGH = 1 & LOW = 0
In another system 1 is represented by LOW and 0 is represented
by HIGH, this system is called negative logic.

Habtamu M. Digital Logic Design February 27, 2023 14 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

Logic level
The voltage used to represent 0 and 1 are called logic level, ide-
ally one voltage level represents a high and another voltage level
represents low.
In practical HIGH can be any voltage between the specified max-
imum value and the specified minimum value. likewise LOW can
be any voltage between the specified maximum value and the
specified minimum value.
There can be no overlap between the accepted HIGH level and the
accepted LOW level.

Habtamu M. Digital Logic Design February 27, 2023 15 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

Figure: Logic level range of the


Figure: Ideal pulse voltage

Habtamu M. Digital Logic Design February 27, 2023 16 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

Digital wave form:


Digital wave form is made up of series of pulses.
Digital wave form consists of voltage level that are changing back
and so forth between the HIGH and LOW level or state.
Positive going pules is generated, the voltage or current goes from
its LOW level to HIGH level.
Negative going pules is generated, the voltage or current goes
from its HIGH level to LOW level.
Waveform characteristic:
Digital wave form are can be classified as periodic or non periodic.
A pulse waveform is one that repeats itself at a fixed interval, called
a period (T). The frequency (f) is the rate at which it repeats itself
and is measured in hertz (Hz).
Habtamu M. Digital Logic Design February 27, 2023 17 / 61
Digital Logic Design
Binary digit, Logic level & Digital wave form

A non-periodic pulse waveform, of course, does not repeat itself at


fixed intervals and may be composed of pulses of randomly differ-
ing pulse widths and/or randomly differing time intervals between
the pulses.

Figure: Non-Periodic pulse-train


Figure: Periodic pulse-train

An important characteristic of a periodic digital waveform is its


duty cycle. The duty cycle is the ratio of the pulse width (tW ) to the
period (T) and can be expressed as a percentage.

Habtamu M. Digital Logic Design February 27, 2023 18 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

tw Figure: D=50%
D= ∗ 100%
T
T = T1 = T2 = T3 = ...Tn (1)
1
F=
T
Figure: D=75%

Timing Diagrams:
A timing diagram is a graph of digital waveforms showing the ac-
tual time relationship of two or more waveforms and how each
waveform changes in relation to the others.
Habtamu M. Digital Logic Design February 27, 2023 19 / 61
Digital Logic Design
Binary digit, Logic level & Digital wave form

By looking at a timing diagram, you can determine the states (HIGH


or LOW) of all the waveforms at any specified point in time & the
exact time that a waveform changes state relative to the other
waveforms.
Figure below is an example of a timing diagram made up of 4
waveforms. From this timing diagram you can see, for example,
that the 3 waveforms A, B, & C are HIGH only during bit time 7 and
they all change back LOW at the end of bit time 7 (shaded area).

Habtamu M. Digital Logic Design February 27, 2023 20 / 61


Digital Logic Design
Binary digit, Logic level & Digital wave form

Data transfer:
Data refers to groups of bits that convey some type of informa-
tion.
In computer systems, as illustrated in Figure below, binary data
are transferred in two ways: serial and parallel.
(1) Serial transfer
sent one bit at a time along a single conductor.

During the time interval from t0 - t1 , the first bit is transferred.


During the time interval from t1 - t2 the second bit is transferred, &
so on. To transfer eight bits in series, it takes eight time intervals.
Habtamu M. Digital Logic Design February 27, 2023 21 / 61
Digital Logic Design
Binary digit, Logic level & Digital wave form

Advantage: Only one line is required


Disadvantage: It takes longer to transfer a given number of bits
than with parallel transfer
(2) Parallel transfer
Send bits on separate lines at the same time

Advantage: It can transfer


data at one time.

Disadvantage: It takes more


lines

Habtamu M. Digital Logic Design February 27, 2023 22 / 61


Digital Logic Design
Number system ,operations and codes

Introduction
A number system is a system of writing for expressing numbers.
It provides a unique representation to every number & represents
the arithmetic & algebraic structure of the figures. It also allows
us to operate arithmetic operations like addition, subtraction..
The decimal system is important because it is universally used to
represent quantities outside a digital system.
For example, calculator (computer), the circuitry inside the ma-
chine converts the decimal number to a binary value.
When we type any letter or word, the computer translates them
into numbers since computers can understand only numbers. A
computer can understand only a few symbols called digits, and
these symbols describe different values depending on the posi-
tion they hold in the number.
Habtamu M. Digital Logic Design February 27, 2023 23 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

Number systems can be classified into its sub-types on the basis


of base of that system. Base of a number systems plays crucial
role in understanding the number system and to convert it from
one subtype to other sub-type. Base is also sometimes referred
as radix;
The value of any digit in a number can be determined by:
I The digit
I Its position in the number
I The base of the number system

four numbering system


I Decimal (10) number system
I Binary (2) number system
I Octal(8) number system
I Hexadecimal (16) number system
Habtamu M. Digital Logic Design February 27, 2023 24 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

(1) Decimal (10) number system


The decimal number system contains 10 symbols and uses the
symbols 0,1,2,3,4,5,6,7,8 and 9. It is sometimes called the base 10
system.
The decimal system is a positional value system in which the value
of a digit depends on its position.
In general ”Any number is simply the sum of the products of each
digit value and its positional value”

2∗103 +7∗102 +4∗101 +5∗100 +2∗10−1 +1∗10−2 +4∗10−3 = 2745.214


Habtamu M. Digital Logic Design February 27, 2023 24 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

Decimal Counting:
When counting in decimal system, we start with 0 in the unit’s po-
sition and take each digit in progression until we reach 9.
Then we add a 1 to the next higher position and start over with
zero in the first position. This process continues until the count of
99 is reached.
The same pattern is followed continuously as high as we wish to
count.
It is important to note that in decimal counting
I The units position (LSD) changes up ward with each step in the
count.
I The tens position changes up ward every 10 steps in the count.
I The hundreds position changes upward every 100 steps in the
count and so on.
Habtamu M. Digital Logic Design February 27, 2023 25 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

(2) Binary (2) number system


A binary system is a code that uses only two basis symbols, 0 &1
and is sometimes called the base 2 system. Therefore, it is less
complicated compared to decimal numbers.
This base 2 system can be used to represent any quantity that can
be represented in decimal or other number systems.
The binary system is also a positional value system, where in each
binary digit has its own value / weight expressed as a power of 2.
The most significant bit (MSB) is the left most bit (largest weight).
The least significant bit (LSB) is the right most bit (Smallest weight).

Habtamu M. Digital Logic Design February 27, 2023 26 / 61


Digital Logic Design
Number system ,operations and codes
Types of numbering system

Binary Counting:
Let us use 4 bit binary numbers to illustrate the method for count-
ing in binary. The sequence (shown on the right side) begins with
all bits at 0, this is called the Zero count.
For each successive count the units (20 ) position toggles; that is, it
changes from one binary value to the other. Each time the units
bits changes from a 1 to 0, the twos (21 ) position will toggle (change
states).
Each time the twos position changes from 1 to 0, the fours (22 )position
will toggle (change states).
Like wise, each time the four bits/ position goes from 1to 0, the
eights (23 ) position toggles. As we have seen in the table below.
In general, with “n” bits we can count up to a number equal to 2n -1
Habtamu M. Digital Logic Design February 27, 2023 27 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

Habtamu M. Digital Logic Design February 27, 2023 28 / 61


Digital Logic Design
Number system ,operations and codes
Types of numbering system

(3) Octal (8) Number System


The octal № system is very important in digital Computer work.
The octal number system has a base of eight, meaning that it has
eight possible digits: 0,1,2,3,4,5,6 and 7.
Thus, each digit of an octal № can have any value from 0 to 7.
The advantage of the octal system is its usefulness in converting
directly from a 3 bit binary number.
The digit positions in an octal number have weights as follows.

Habtamu M. Digital Logic Design February 27, 2023 29 / 61


Digital Logic Design
Number system ,operations and codes
Types of numbering system

Octal Counting:

In octal the largest digit is 7,


so that in counting a digit po-
sition is incremented up ward
form 0 to 7.
Once it reaches 7, it recycles
to 0 on the next count and
causes the next higher digit
position to be incremented.
For example:
0,1, ..7,
10, 11,..17,
20, . . . 27. . . .
Habtamu M. Digital Logic Design February 27, 2023 30 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

(4) Hexadecimal (16) Number Systems


The hexadecimal (base-16) number system has become a very
standard way of communicating numeric values in digital systems.
Hexadecimal numbers are one of the most important numbers in
digital systems, as “Assembly” language (machine language) uses
this number to program a micro processor system.
It uses sixteen characteristics, but easy to read as each of its 4 bits
are used to represent a number between 0-16.
It uses the digits
I 0 through 9 plus The letters A, B, C, D, E and F as the 16 digit
symbols.

The digit positions are weighted as powers of 16 as shown below,


rather than as powers of 10 as in the decimal system.
Habtamu M. Digital Logic Design February 27, 2023 31 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

Note that each hexadecimal digit represents a group of four bi-


nary digits.
It is important to remember that hex (abbreviation for “hexadec-
imal”) digits A through F are equivalent to the decimal values 10
through 15
hexadecimal Counting:
In Hexadecimal when counting in hex, each digit position can be
incremented (increase by 1) from 0 to F.
Once a digit position reaches the value F, it is reset to 0 and the
next digit position is incremented.
This is illustrated in the following hex counting sequences.
10, 11, 12, .....,1E,1F, 20, 21,22 ..., 2E, 2F,30, 31,. . . 6F9,6FA, 6FB,6FC,
Habtamu M. Digital Logic Design February 27, 2023 32 / 61
Digital Logic Design
Number system ,operations and codes
Types of numbering system

Here are some advantages of using the hexadecimal system:


It is very concise and by using a base of 16 means that the num-
ber of digits used to signify a given number is usually less than in
binary or decimal. It allows you to store more information using
less space.
It is fast and simple to convert between hexadecimal numbers and
binary. Hexadecimal can be used to write large binary numbers
in just a few digits.
Higher information density. With 2 hexadecimal digits, we can ex-
press any number from 0 to 255. To do the same in binary, we
need 8 digits. As we get bigger and bigger numbers, we start need-
ing more and more digits and it becomes harder to deal with.

Habtamu M. Digital Logic Design February 27, 2023 33 / 61


Digital Logic Design
Number system ,operations and codes
Types of numbering system

Figure: Numbers in different system

Habtamu M. Digital Logic Design February 27, 2023 34 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

1) Binary-to-decimal Conversions:
Any binary number can be converted to its decimal equivalent
simply by summing together the weights of the various positions
in the binary number, which contain a 1 and discarding the weights
of all bits that are 0.
Fore example:

Note that the MSB has a weight of 27 even though it is the 8th bit
this is because the LSB is the first bit and has a weight of 20 .
Habtamu M. Digital Logic Design February 27, 2023 35 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

2) Decimal – to – Binary conversions :


There are two ways to convert a decimal whole number to its
equivalent binary system representation.
The 1st method (Sum-of-Weights)
The decimal number is simply expressed as a sum of power of 2
and then 1s and 0s are written in the appropriate bit positions.
Example:
I (25)10 =16+8+1=24 +23 +0+0+20 =(11001)2
I (63)10 =?,(100)10 =?, (1025)10 =?

The 2nd method (Repeated Division):


This method uses repeated division by 2. Requires repeatedly di-
viding the decimal number by 2 and writing down the remainder
after division until the quotient of 0 is obtained.
Habtamu M. Digital Logic Design February 27, 2023 36 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Convert the following decimal to binary


I (63)10 =?,
I (100)10 =?,
I (1025)10 =?

Habtamu M. Digital Logic Design February 27, 2023 37 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

3) Octal to decimal Conversion:


An octal number, can easily be converted to its decimal equivalent
by multiplying each octal digit by it positional weight i.e. a power
of 8. Example: (705)8 = 7*82 + 0*81 + 5*80 =(453)10
4) Decimal to Octal Conversion:

Decimal integer can be con-


verted to octal by using re-
peated division with a divi-
sion factor of 8.

Habtamu M. Digital Logic Design February 27, 2023 38 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

5) Octal to Binary Conversion:


The conversion from octal to binary is presented by converting
each octal digit to its 3- bit binary equivalent.

6) Binary to Octal Conversion:


The bits of the binary number are grouped into groups of three
bits starting at the LSB, then each group is converted to its octal
equivalent.

Habtamu M. Digital Logic Design February 27, 2023 39 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

7) Hex to decimal Conversion:


A hex number can be converted to its decimal equivalent by using
the fact that each hex digit position has a weight that is a power
of 16.
The LSD has a weight of 160 = 1,the next higher digit position has
a weight of 161 =16, the next has a weight of 162 = 256, and so on.
Example: (34)16 =3*161 +4*160 =48+4=52
8) Decimal-to-Hex conversion:
Recall that we did decimal –to- binary conversion using repeated
division by 2. Like wise decimal-to-hex conversion can be done
using repeated division by 16.

Habtamu M. Digital Logic Design February 27, 2023 40 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

9) Hex-to-Binary conversion:
The Hexadecimal number system is used primarily as a ”Short-
hand” method for representing binary numbers.
Each hex digit is converted to its 4 bit binary equivalent.
10) Binary-to- Hex conversion:
The binary number is grouped into groups of four bits, and each
group is converted to its equivalent hex digit.
Zeros (shown shaded) are added, as needed, to complete a four-
bit group.
Habtamu M. Digital Logic Design February 27, 2023 41 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

practice the following


What is the total range of decimal values that can be represented
in four bits binary, Octal and Hexadecimal?
Write the next seven numbers in this hex counting sequence:998,999,

Habtamu M. Digital Logic Design February 27, 2023 42 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Summary of Conversions
When converting from binary [or octal, or hex] to decimal, use
the method of taking the weight sum of each digit position.
When converting from decimal to binary [or octal or hex] use the
method of repeatedly dividing by 2 [or 8 or 16] and collecting
remainders.
When converting from binary to octal [or hex], group the bits in
groups of the three [or four], and convert each group into the
correct octal [or hex] digit.
From Hexadecimal or Octal to Binary Change each symbol to
binary and you are done!

Habtamu M. Digital Logic Design February 27, 2023 43 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Binary Arithmetic
Binary arithmetic is essential in all digital computers and in any
other digital systems.
To understand digital system we must know the basics of binary
addition,subtraction, multiplication, and division

four basic rules for binary addi- four basic rules for binary sub-
tion traction

Habtamu M. Digital Logic Design February 27, 2023 44 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Binary multiplication
The multiplication of binary numbers is done in the same manner as the
multiplication of decimal numbers.
Binary division
The process for dividing one binary number (the dividend) by another
(the divisor) is the same as that followed for decimal numbers, that which
we usually refer to as long division.
The actual process is simpler in binary because when we are checking to
see how many times the divisor “goes into” the dividend, there are only
two possibilities, 0 or 1.

Habtamu M. Digital Logic Design February 27, 2023 45 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Representing signed numbers


In digital computers, the binary numbers are represented by a set of bi-
nary storage devices (e.g., flip-flops).
Each device represents one bit. For example, a six-bit FF register can store
binary numbers ranging from 000000 to 111111 (0 to 63 in decimal).
This represents the magnitude of the number. Because most digital com-
puters and calculators handle negative as well as positive numbers, some
means is required for representing the sign of the number (+ or -).
This is usually done by adding to the №another bit called the sign bit.
The common convention is that a 0 in the sign bit represents a positive
number and a 1 in the sign bit represents a negative number.

Habtamu M. Digital Logic Design February 27, 2023 46 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

1’s-Complement Form
The 1’s complement of a binary number is obtained by changing
each 0 to a 1 and each 1 to a 0.
2’s Complement Form
The 2’s complement of a binary number is formed by taking the 1’s
complement of the number and adding 1 to the least-significant-
bit position.

Habtamu M. Digital Logic Design February 27, 2023 47 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Representing Signed Numbers Using 2’s Complement


If the number is positive, the magnitude is represented in its true
binary form, and a sign bit of 0 is placed in front of the MSB.
If the number is negative, the magnitude is represented in its 2’s
complement form, and a sign bit of 1 is placed in front of the MSB.

Habtamu M. Digital Logic Design February 27, 2023 48 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Binary Codes
In the coding, when numbers, letters or words are represented
by a specific group of symbols, it is said that the number, letter or
word is being encoded.
The group of symbols is called as a code. The digital data is repre-
sented, stored and transmitted as group of binary bits. This group
is also called as binary code.
When a decimal number is represented by its equivalent binary
number, we call it straight binary coding.
We have seen that the conversing between decimal and binary
can be come long and complicated for large numbers.
For this reason, a means of encoding decimal numbers that com-
bines some features of both the decimal and binary system is
used in certain situations.
Habtamu M. Digital Logic Design February 27, 2023 49 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Classification Of Binary Codes


The codes are broadly categorized into following four categories:

I Weighted Codes
I Non-Weighted Codes
I Binary Coded Decimal Code
I Alphanumeric Codes
I Error Detecting Codes
I Error Correcting Codes

There are binary code techniques available to detect and correct


data during data transmission.

Habtamu M. Digital Logic Design February 27, 2023 50 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Weighted Codes:
Weighted binary codes are those binary codes which obey the po-
sitional weight principle. Each position of the number represents
a specific weight. Several systems of the codes are used to ex-
press the decimal digits 0 through 9. In these codes each decimal
digit is represented by a group of four bits.

Habtamu M. Digital Logic Design February 27, 2023 51 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Binary Coded Decimal (BCD) code


If each digit of a decimal number is represented by its 4- bit binary
equivalent the result is a code called binary-coded decimal (BCD).
In other words only 10 of the 16 possible 4 bit binary code groups
are used (0-9/0000-1001).
If any of the ‘’forbidden” 4 bit numbers ever occurs in machine
using the BCD code, it is usually an indication that an error has
occurred.

Habtamu M. Digital Logic Design February 27, 2023 52 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Comparison of BCD and Binary


It is important to realize that BCD is not another number system
like binary, decimal, and hexadecimal. In fact, it is the decimal
system with each digit encoded in its binary equivalent.
It is also important to understand that a BCD number is not the
same as a straight binary number.
A straight binary number takes the complete decimal number and
represents it in binary; the BCD code converts each decimal digit
to binary individually.
To illustrate, compare its straight binary and BCD codes:
(33)10 =1000012 binary; (33)10 =0011 0011 BCD
The main advantage of the BCD code is the relative ease of con-
verting to and from decimal.
Habtamu M. Digital Logic Design February 27, 2023 53 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Gray code :
It is the non-weighted code and it is not arithmetic codes i.e. there
are no specific weights assigned to the bit position.
The Gray code belongs to a class of codes called minimum change
codes, The unique aspect of the Gray code is that only one bit ever
changes between two successive numbers in the sequence.
Because of this, the gray code is not suitable for arithmetic op-
erations but finds application in input/out put devices and some
types of analog-to digital converters.
The most common application of the Gray code is in shaft position
encoders. A shaft position encoder produces a code word which
represents the angular position of the shaft

Habtamu M. Digital Logic Design February 27, 2023 54 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Going from left to right , add Add each binary code bit gener-
each adjacent pair of binary code ated to the gray code bit in the
bits to get the next gray code bit. next adjacent position. Discard
Discard carries. carries.

Figure: (a) B-G and (b) G-B

Habtamu M. Digital Logic Design February 27, 2023 55 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Excess-3 code:
The Excess-3 code is also called as XS-3 code. It is non-weighted
code used to express decimal numbers.
The Excess-3 code words are derived from the 8421 BCD code
words adding (0011)2 or (3)10 to each code word in 8421.
To encode a decimal number to the excess –3 form, we add 3 to
each digit of the decimal number and convert to binary form.
Note that both BCD and Excess-3 use only 10 of the 16 possible 4
bit code groups.
The Excess-3 code, however, does not use the same code groups.
For Excess-3 code, the invalid code groups are 0000, 0001, 0010,
1101,1110, and 1111
Habtamu M. Digital Logic Design February 27, 2023 56 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Habtamu M. Digital Logic Design February 27, 2023 57 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Alphanumeric Codes
A binary digit or bit can represent only two symbols as it has only
two states ’0’ or ’1’. But this is not enough for communication be-
tween two computers because there we need many more sym-
bols for communication.
Computer should recognize “codes” that represent letters of the
alphabet, punctuation marks, and other special characters as well
as numbers. These codes are called ”alphanumeric codes”.
A complete alphanumeric code would include:
I The 26 upper and lower case letters;
I 10 numeric digits,
I 7 punctuation marks, and
I Anywhere from 20 to 40 other characters, such as +, /, #, %,*, and
so on
Habtamu M. Digital Logic Design February 27, 2023 58 / 61
Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

Habtamu M. Digital Logic Design February 27, 2023 59 / 61


Digital Logic Design
Number system ,operations and codes
Conversion of one Number System to Another

The following three alphanumeric codes are very commonly used


for the data representation.
I American Standard Code for Information Interchange (ASCII).
I Extended Binary Coded Decimal Interchange Code 8 bit
representation (EBCDIC).
I Five bit Baudot Code.
The most widely used alphanumeric code, the ASCII, is used in
most micro computers and mini computers, and in many main-
frames.
The ASCII code (pronounced ”ask-ee”) is a 7- bit code, and so it has
27 = 128 possible code groups.
We can say that an alphanumeric code represents all of the vari-
ous characters and functions that are found on a computer key-
board.
Habtamu M. Digital Logic Design February 27, 2023 60 / 61
Digital Logic Design

!! !
O U
K Y
A N
T H
Habtamu M. Digital Logic Design February 27, 2023 61 / 61

You might also like