Chapter 1
Chapter 1
Chapter 1
CHAPTER ONE
INTRODUCTION TO MICROPROCESSORS & COMPUTERS
OUTLINE OF THE CHAPTER
INTRODUCTION TO COMPUTERS
HISTORY OF MICROPROCESSORS
1. Battery compartment
2. Flash capacitor
3. Flash lamp
4. LED
5. Lens
6. Focusing mechanism
7. CCD
8. USB connector
9. SD (secure digital) card slot
10. Processor chip
11. Wrist connector
12. Top case
CELL PHONES
COMPUTERS
INTRODUCTION TO
COMPUTERS
TWO TYPES OF MEMORY IN MICROCOMPUTERS:-
A. RAM, which stands for random access memory and
B. ROM, which stands for read-only memory.
RAM:
Used by the computer for temporary storage of programs that it is running.
Data is lost when the computer is turned off.
Sometimes called volatile memory.
CPU directly communicate to RAM or ROM
ROM:
Contains programs and information essential to operation of the computer.
The information in ROM is permanent,
Cannot be changed by the user.
Not lost when the power is turned off.
Therefore, it is called nonvolatile memory.
INTERNAL ORGANIZATION OF
COMPUTERS
The internal working of every computer can be
broken down into three parts:
CPU (Central Processing Unit),
Memory, and
I/O (input/output) devices.
CPU:- To execute (process) information stored in
memory.
Memory:- To Store data and instruction for CPU
I/O devices:- Such as the keyboard and video
monitor is to provide a means of communicating
with the CPU.
INTERNAL ORGANIZATION OF
COMPUTERS
The CPU is connected to memory and I/0 through
strips of wire called a bus, to carries information
from place to place.
INTERNAL ORGANIZATION
OF COMPUTERS
In every computer there are three types of
buses:
Address Bus,
Data Bus, and
Control Bus.
More about the data bus:
Data buses are bidirectional, since the CPU
must use them either to receive or to send data.
The processing power of a computer is related
to the size of its buses
A n 8-bit bus can send out 1 byte a time, but a
16-bit bus can send out 2 bytes at a time, which
is twice as fast.
More about the address bus:
The number of address buses for a CPU determines the
number of locations with which it can communicate.
The number of locations is always equal to 2x, where x
is the number of address lines, regardless of the size of
the data bus.
Each location can have a maximum of 1 byte of data.
This is due to the fact that all general-purpose
microprocessor CPUs are what is called byte
addressable.
The address bus is a unidirectional bus, which means
that the CPU uses the address bus only to send out
addresses
CPU AND ITS RELATION TO RAM AND
ROM:
For the CPU to process information, the data must
be stored in RAM or ROM.
The function of ROM in computers is to provide
information that is fixed and permanent.
RAM is used to store information that is not permanent
and can change with time.
The CPU gets the information to be processed, first from
RAM (or ROM).
Only if it is not there does the CPU seek it from a mass
storage device such as a disk, and then it transfers the
information to RAM.
RAM and ROM are sometimes referred to as primary
memory and disks are called secondary memory.
Inside CPU
A program stored in memory provides
instructions to the CPU to perform an action.
It is the function of the CPU to fetch these
instructions from memory and execute them.
Cont…
To perform these actions all CPUs are
equipped with resources such as the following:
Registers-store information temporarily
ALU-for performing arithmetic and logic
functions
Program counter-used to point to the address of
the next instruction to be executed
• Instruction decoder used to interpret the
instruction fetched into the CPU
Adding two numbers
Cont….
Cont…
Inside of cpu
Program counter
• Hold the address of the next instruction
• The MAR will store the address in the PC
Cont…
• The content of MAR will be loaded into
MDR(we fetched the 1st instruction now)
Cont….
• Now, that instruction will be stored in CIR
Cont…
• The PC will be incremented by 1
Cont…
• Decoding of the current instruction will take
place
Cont….
• Cont…
Cont….
• The content of memory address 10 will be
loaded into MDR
Cont…
• The content of MDR will be store in
Accumulator register(the 1st inst. executed)
Cont…
• Fetching the next instruction
Cont…
• The content of memory address 101 will be
loaded into MDR
Cont…
• The content of MDR loaded into CIR
Cont…
• Increment program counter
Cont…
• Decoding the content of CIR(Add the content
of memory location 11 to the accumulator) &
ALU will perform addition
• The content of the accumulator on ALU
Cont…
• Now, get the content of memory location 11
Cont….
• The content of the Memory location 11 will be
placed in MDR
Cont….
• The content of MDR will be stored in
accumulator
Cont…
• ALU add the two numbers and put the result
back to accumulator
Cont….
• The content of PC will be placed in MAR
Cont…
• The content of that memory location(102) will
be placed on MDR
Cont…
• The content of MDR placed in CIR
Cont….
• Increment the program counter
Cont….
• Decoding the content of CIR
Cont…
• MAR will store memory location 12
Cont….
• The content of memory address 12 will be
loaded into MDR & Then, the content of the
accumulator placed in to MDR
Finally,
• MDR will move its content to memory
location 12
Some Important Terminology
One of the most important features of a computer is
how much memory it has.
Terms used to describe amounts of memory are:
Bit = a binary value which can be 0 or 1.
Nibble (4bit) = a group of 4 bits
Byte (8bit)= a group of 8 bits
Word (2bytes)= a group of 16 bits or a group of 2 bytes.
Kilobyte (210 bytes = 1,024 bytes)
Megabyte (220 bytes = 1,048,576)
Gigabyte (230 bytes, just over one billion bytes)
Terabyte (240 bytes, just over one trillion bytes)
As an example of how some of these terms are used, suppose that a
given computer has 16 megabytes of memory. That would be 16 x 220,
or 24 x 220, which is 224.
Therefore 16 megabytes is 224 bytes.
Number System
• There are two type of number system
1.Positional
2.Non-Positional
• Positional number system
– E.g. Decimal,Binary,Octal,Hexa decimal
• Non-Positional
– E.g Roman Number(I,II,…)
Data organization
• Computers generally work with some specific
number of bits.
• Common collections are
– single bits,
– groups of four bits (called nibbles)
– groups of eight bits (called bytes)
– groups of 16 bits (called words), and more.
Bits
• The smallest “unit” of data on a binary
computer is a single bit.
• single bit is capable of representing only two
different values
• There are no infinite number of items you can
represent with a single bit.
• There are a very small number of items you
can represent with a single bit
Cont…
• With a single bit, you can represent any two
distinct items
• Examples include zero or one, true or false, on
or off, male or female, and right or wrong.
• For the bit to have any true meaning, you
must be consistent.
Nibbles
• A nibble is a collection of four bits.
• It takes four bits to represent a single BCD or
hexadecimal digit.
• With a nibble, we can represent up to 16
distinct values.
• In the case of hexadecimal numbers, the
values 0, 1, 2, 3, 4,5, 6, 7, 8, 9, A, B, C, D, E,
and F are represented with four bits
Bytes
• The most important data structure used by the
80x86 microprocessor is the byte.
• A byte consists of eight bits and is the smallest
addressable datum (data item) on the 80x86
microprocessor.
• The smallest item that can be individually
accessed by an 80x86 program is an eight-bit
value.
Cont…
• The bits in a byte are normally numbered from
zero to seven using the convention
• Bit 0 is the low order bit or least significant
bit, bit 7 is the high order bit or most
significant bit of the byte.
• Bits 0..3 comprise the low order nibble, bits
4..7 form the high order nibble.
• Since a byte contains exactly two nibbles, byte
values require two hexadecimal digits.
Words
• A word is a group of 16 bits.
• Bits 0 through 7 form the low order byte , bits
8 through 15 form the high order byte
• We end up with a carry into the ninth bit and all other
bits are zero.
• As it turns out, if we ignore the carry out of the H.O.
bit, adding two signed values always produces the
correct result when using the two’s complement
numbering system.
Sign and Zero Extension
• To sign extend a value from some number of bits
to a greater number of bits is easy,
• just copy the sign bit into all the additional bits in
the new format.
• Examples of sign extension:
• Eight Bits Sixteen Bits Thirty-two Bits
• 80h FF80h FFFFFF80h
• 28h 0028h 00000028h
• 9Ah FF9Ah FFFFFF9Ah
• 7Fh 007Fh 0000007Fh
Cont…
• To extend an unsigned byte you must zero extend
the value.
• Zero extension is very easy – just store a zero into
the H.O. byte(s) of the smaller operand
• Eight Bits Sixteen Bits Thirty-two Bits
• 80h 0080h 00000080h
• 28h 0028h 00000028h
• 9Ah 009Ah 0000009Ah
• 7Fh 007Fh 0000007Fh
Shifts and Rotates
• Another set of logical operations which apply
to bit strings are the shift and rotate operations.
• These two categories can be further broken
down into left shifts, left rotates , right shifts,
and right rotates.
• These operations turn out to be extremely
useful to assembly language programmers.
Cont…
• The left shift operation moves each bit in a bit
string one position to the left
• Bit zero moves into bit position one, the
previous value in bit position one moves into
bit position two, etc.
• We’ll shift the value zero into the L.O. bit, and
the previous value of bit seven will be the
carry out of this operation.
Cont….
• Note that shifting a value to the left is the same
thing as multiplying it by its radix.
• For example, shifting a decimal number one
position to the left ( adding a zero to the right
of the number) effectively multiplies it by ten
(the radix):
• 1234 SHL 1 = 12340 (SHL 1 = shift left one
position)
Cont…
• Since the radix of a binary number is two, shifting it
left multiplies it by two.
• For example left shift 11101110
• 11101110*10=11011100
• If you shift a binary value to the left twice, you
multiply it by two twice (i.e., you multiply it by four).
• If you shift a binary value to the left three times, you
multiply it by eight (2*2*2).
• In general , if you shift a value to the left n times, you
multiply that value by 2 to the power of n
Right shift
• A right shift operation works the same way,
except we’re moving the data in the opposite
direction.
• Bit seven moves into bit six, bit six moves into
bit five, bit five moves into bit four, etc.
• During a right shift, we’ll move a zero into bit
seven, and bit zero will be the carry out of the
operation
Cont…
• Right shift is roughly comparable to a division
by two (or, in general, a division by the radix
of the number).
• If you perform n right shifts, you will divide
that number by 2 power of n
Example
• SHL the following 1 and 2 position
– 10011000
– 11001100
Right & left rotate operation
• Another pair of useful operations are rotate left
and rotate right.
• These operations behave like the shift left and
shift right operations with one major
difference: the bit shifted out from one end is
shifted back in at the other end.
Bit Fields and Packed Data
• There are data type that uses some number of bits
other than eight, 16, or 32.
• For example, consider a date of the form “4/2/88”.
• It takes three numeric values to represent this
date: a month, day, and year value.
• Month is 1-12 so it need 2 raise 4 =16
• Day is 1-30 so it need 2 raise 5=32
• Year 0-99 so it need 2 raise 7=127
• Number of bit=4+5+7=16
Cont…
• MMMM represents the four bits making up
the month value,
• DDDDD represents the five bits making up
the day, and YYYYYYY is the seven bits
comprising the year.
• Each collection of bits representing a data
item is a bit field.
• April 2nd, 1988 would be represented as
4158h:
Exercise
• SHR the following 1 and 2 position
– 11101110
– 10011000
– 11001100
• What is the negative counterpart
EEEE,ACAC,BCAB and CBAD
• Represent “June 20 1996” in hexadecimal
History of Microprocessors
In the 1940s, CPUs were designed using vacuum tubes.
The first large-scale digital computer, ENIAC, consumed
130,000 watts of power and occupied 1500 square feet.
The invention of transistors changed all of that.
In the 1950s, transistors replaced vacuum tubes in the design
of computers.
Then in 1959, the first IC (integrated circuit) was invented.
It was not until the 1970s that the entire CPU was put on a
single IC chip.
The first working CPU on a chip was invented by Intel in
1971.
This CPU was called a microprocessor.
History of Microprocessors
The first microprocessor, the Intel 4004, had a 4-bit data bus and was
made of 2300 transistors.
It was designed primarily for the hand-held calculator but soon came
to be used in applications such as traffic-light controllers.
The advances in IC fabrication made during the 1970s made it
possible to design microprocessors with an 8-bit data bus and a 16-bit
address bus.
By the late 1970s, the Intel 8080/85 was one of the most widely used
microprocessors, appearing in everything from microwave ovens to
homemade computers.
Many other companies joined in the race for faster and better
microprocessors.
Notable among them was Motorola with its 6800 and 68000 microprocessors.
Apple's Macintosh computers used the 68000 series microprocessors.
Types of microprocessor
• Based on its architecture
– Reduced instruction set computer(RISC)
– Complex instruction set computer(CISC)
• Based on data bus
– 4 bit, 8 bit, 16 bit,32 bit, 64bit…..
• Based on application
– General purpose
– Microcontroller
– Special purpose
CISC vs RISC
Cont…..
CISC Vs RISC
Until the early 1980s, all CPUs, whether single-chip or
whole-board, followed the CISC (complex instruction
set computer) design philosophy.
CISC refers to CPUs with hundreds of instructions
designed for every possible situation.
Drawbacks of CISC:-
Consumes millions of transistors, makes the
design very complicated, time-consuming, and
expensive.
In the early 1980s, a new CPU design philosophy
called RISC (reduced instruction set computer) was
developed.
The proponents of RISC argued that no one was using
all the instructions etched into the brain of CISC-type
CPUs.
CISC Vs RISC
RISC:-
Streamline the instructions by simplifying and reducing
them from many to few and use all the transistors that are
saved to enhance the power of the CPU.
The first working single-chip RISC microprocessor was
implemented by a group of researchers at the University
of California at Berkeley in 1980.
Since the late 1980s, many companies designing new
CPUs have used the RISC philosophy.
Evolution of the Intel processors
The Start of microprocessor (Intel 4004):
– The 1st Microprocessor, called a 4-bit
microprocessor
– Able to address 4096, 4 bit wide memory = 4 K
nibble or 2 Kbytes.
– Instruction set contained only 45 instructions.
– Instruction execution rate was 50 KIPs (kilo-
instructions per second).
– Most calculators are still based on 4-bit
microprocessors that process 4-bit BCD (binary-
coded decimal) codes.
Intel 8008, 8080 Microprocessors
Intel 8008:
– 50,000 IPS,
– 8-bit microprocessor,
– 16 K bytes memory,
– 48 instructions.
Intel 8080:
– 500,000 IPS,
– 8-bit microprocessor,
– 64 K bytes memory,
Intel
Intel 8085
8085:- Microprocessor
– In 1977, Intel Corporation introduced the last 8 bit
microprocessor.
– Execution rate 769,230 per second.
– 246 instructions
– The main advantages of the 8085 were :
• Its internal clock generator,
• Internal system controller, and
• Higher clock frequency.
– This higher level of component integration reduced the
8085's cost and increased its usefulness.
Evolution from 8080/8085 to 8086
Intel 8086:-
– In 1978, Intel Corporation introduced a 16-bit
microprocessor called the 8086.
– This processor was a major improvement over the
previous generation 8080/8085 series Intel
microprocessors in several ways.
First, the 8086's capacity of 1 megabyte of memory
exceeded the 8080/8085’s capability of handling a
maximum of 64K bytes of memory.
Second, the 8086 is a 16-bit microprocessor.
Third, the 8086 was a pipelined processor, as opposed to
the nonpipelined 8080/8085.
• In a system with pipelining, the data and
address buses are busy transferring data while
the CPU is processing information, thereby
increasing the effective processing power of
the microprocessor.
Evolution from 8086 to 8088
Although the introduction of the 8086 marked a great
advancement over the previous generation of
microprocessors, there was still some resistance in using
the 16-bit external data bus since at that time all
peripherals were designed around an 8-bit
microprocessor.
In addition, a printed circuit board with a 16-bit data bus
was much more expensive.
Therefore, Intel came out with the 8088 version.
It is identical to the 8086 as far as programming is
concerned, but externally it has an 8-bit data bus instead
of a 16-bit bus.
It has the same memory capacity, 1 megabyte.
Other microprocessors: the 80286, 80386, and
80486
80286:
4 MIPs, 16 M byte memory
Almost identical to 8086.
80386:
First 32 bit microprocessor.
32 bit data and 32 bit memory address.
4 G bytes memory