Subject: ECE3004
Microprocessors and Microcontrollers
Computer System Components
● Memory
Stores instructions and data
● Input/Output
● Called peripherals
● Used to input and output instructions and data
● Arithmetic and Logic Unit
● – Performs arithmetic operations (addition, subtraction)
● – Performs logical operations (AND, OR, XOR, SHIFT, ROTATE)
Computer System
Components
● Control Unit
● – Coordinates the operation of the computer
System Interconnection and Interaction
● Bus—A group of lines used to transfer bits between the microprocessor
and other components of the computer system. Bus is used to
communicate between parts of the computer. There is only one
transmitter at a time and only the addressed device can respond.
● Types
● » Address
● » Data
● » Control signals
CPU Components
Registers
● Hold data, instructions, or other items.
● Various sizes.
● Program counter and memory address registers must be of
same size/width as address bus.
● Registers which hold data must be of same size/
width as memory words.
CPU Components
Control Unit
● Generates control signals which are
necessary for execution of an instruction.
● Connect registers to the bus.
● Controls the data flow between CPU
and peripherals (including memory).
● Provides status, control & timing signals
required for the operation of memory and I/
O devices to the system.
● Acts as a brain of computer system
All actions of the control unit are
associated with the decoding and
executions of instructions (fetch and
execute cycles).
CPU Components
Arithmetic and Logic Unit
● Executes arithmetic and logical operations.
● Accumulator is a special 8-bit register
associated with [Link] ‘A’ in 8085 is
an accumulator.
● Source of one of the operands of an
arithmetic or logical operation.
● serves as one input to ALU.
● Final result of an arithmetic or logical
operation is placed in accumulator.
Arithmetic and Logic
Unit
ALU performs the following arithmetic & logical operations:
● Addition
● Subtraction
● Logical AND
● Logical OR
● Logical EXCLUSIVE OR
● Complement(logical NOT)
● Increment (add 1)
● Decrement (subtract 1)
● Left shift, Rotate Left, Rotate right
● Clear etc.
● Data and instructions are stored in a single set o f read-
write memory. Contents of memory are addressable by
memory address, without regard to the type of data
[Link] occurs in a sequential fashion, unless
explicitly altered, from one instruction to the other.
Performance metrics of CPU:
Short response time for a given piece of work
High throughput (rate of processing work)
Low utilization of computing resource(s)
High availability of the computing system or application
Fast (or highly compact) data compression and decompression
High bandwidth
Short data transmission time.
Microprocessor and microcontrollers:
[Link]
Microprocessor
● is a semiconductor device consisting
of electronic logic circuits
● manufactured by using various
fabrication schemes
● capable of performing computing
functions
● capable of transporting data/information
● can be divided into 3 segments:
● Arithmetic and Logic Unit
● Register Unit
● Control Unit
History: [Link]
Historical Background of Intel Microprocessors
INTEL 4004
Introduced in 1971 and noted as
1Generation µP.
It was the first microprocessor by Intel.
It was a 4-bit µP.
Its clock speed was 740KHz.
It had 2,300 transistors.
It could execute around 60,000
● 4 KB main memory instructions per second.
● 45 instructions
● PMOS technology 5
It was first programmable device which was used in calculators
INTEL 8008
● Introduced in 1972.
● It was first 8-bit µP.
● Its clock speed was 500 KHz.
● Could execute 50,000 instructions
per second.
● 8-bit version of 4004
● 16 KB main memory
● 48 instructions
● PMOS technology 8
● Slow
INTEL
8080 Introduced in 1974.
It was also 8-bit µP.
Its clock speed
was 2 MHz.
It had 6,000
transistors.
Was 10 times faster
than 8008.
● 64 KB main memory
Could execute
● 10X faster than 8008 5,00,000
● NMOS technology instructions per
● second.
Drawback was that it needed three power supplies. 9
● Small computers (Microcomputers) were designed in mid 1970’s
using 8080 as CPU.
Introduced in 1976.
INTEL 8085 It was also 8-bit µP.
Its clock speed was 3 MHz.
Its data bus is 8-bit and address bus
is 16-bit.
It had 6,500 transistors.
Could execute 7,69,230 instructions
per second.
It could access 64 KB of
memory.
It had 246 instructions.
● 64 KB main memory ● Over 100 million copies were
10
● NMOS technology sold.
● Uses only one +5v power supply.
● Introduced in 1978.
It was first 16-bit µP and noted as 3G.
INTEL 8086
Its clock speed is 4.77 MHz, 8 MHz and
10 MHz, depending on the version.
Its data bus is 16-bit and address
bus is 20-bit.
It had 29,000 transistors and HMOS
technology.
Could execute 2.5 million
instructions per second.
It could access 1 MB of memory.
It had 22,000 instructions.
It had Multiply and Divide instructions.
12
INTEL
Introduced in 1979.
8088 It was also 16-bit µP.
It was created as a cheaper
version of Intel’s 8086.
It was a 16-bit processor with an
8-bit external bus.
Could execute 2.5 million
instructions per second.
● This chip became the most popular in
the computer industry when IBM used it
for its first PC
13
.
INTEL 80186 & 80188
Introduced in 1982.
They were 16-bit µPs.
Clock speed was 6 MHz.
80188 was a cheaper version of
80186 with an 8- bit external data
bus.
They had additional components
like:
Interrupt Controller
Clock Generator
Local Bus Controller
14
Counters
INTEL
80286 Introduced in 1982.
It was 16-bit µP.
Its clock speed was 8 MHz.
Its data bus is 16-bit
and address bus is 24-
bit.
It could address 16 MB of
memory.
It had 1,34,000 transistors.
● It could execute 4 million 15
instructions per second.
Protected mode
INTEL
● Introduced in 1986.
● It was first 32-bit µP.
80386 ● Its data bus is 32-bit and
address bus is 32-bit.
● It could address 4 GB
of memory.
● It had 2,75,000 transistors.
● Its clock speed varied from 16
MHz to 33 MHz depending
upon the various versions.
● Different versions:
● 80386 DX
● 80386 SX
● 80386 SL
● Intel 80386 became the best selling 17
microprocessor in history.
● It can allow many 8086 programs to run
INTEL ● Introduced in 1989.
80486 ● It was also 32-bit µP.
● It had 1.2 million transistors.
● Its clock speed varied from
16 MHz to 100 MHz
depending upon the various
versions.
● It had five different versions:
●80486 DX
●80486 SX
●80486 DX2
●80486 SL
●80486 DX4
● 8 KB of cache memory was
introduced. 18
Internal CPU clock runs at twice the
external bus speed
INTEL
PENTIUM
● Introduced in 1993.
● It was also 32-bit µP.
It was originally named 80586.
Its clock speed was 66 MHz.
Its data bus is 32-bit and
address bus is 32-bit.
It could address 4 GB of
memory.
Could execute 110 million
instructions per second.
It can execute two instruction
simultaneously.
Cache memory:
19
● 8 KB for instructions.
● 8 KB for data.
INTEL PENTIUM
PRO
● Introduced in [Link] for servers
and high end work stations.
● It was also 32-bit µP.
● It had L2 cache of 256 KB.
● It had 21 million transistors.
● It was primarily used in server
systems.
● Cache memory:
● 8 KB for instructions.
● 8 KB for data.
● It had L2 cache of 256 KB. 20
INTEL PENTIUM
II
● Introduced in 1997.
● It was also 32-bit µP.
● Its clock speed was 233
MHz to 500 MHz.
● Could execute 333 million
instructions per second.
● MMX technology was
supported.
● L2 cache & processor were
on one circuit. 21
INTEL PENTIUM II
XEON
● Introduced in 1998.
● It was also 32-bit µP.
● It was designed for servers.
● Its clock speed was 400 MHz
to 450 MHz.
● 7.5 million transistors
● L1 cache of 32 KB & L2 cache of
512 KB, 1MB or 2 MB.
● It could work with 4 Xeons in 22
same system.
INTEL PENTIUM
III
● Introduced in 1999.
● It was also 32-bit µP.
● Its clock speed varied from 500
MHz to 1.4 GHz.
● It had 9.5 million
transistors.
23
INTEL PENTIUM
IV
Introduced in 2000.
It was also 32-bit µP.
Its clock speed was from
1.3 GHz to 3.8 GHz.
L1 cache was of 32 KB & L2 cache
of 256 KB.
It had 42 million transistors.
All internal connections were made
from aluminium to copper.
24
INTEL DUAL
CORE Introduced in 2006.
It is 32-bit or 64-bit µP.
It has two cores.
Both the cores have there own
internal bus and L1 cache, but
share the external bus and L2
cache.
It supported SMT
technology.
SMT: Simultaneously Multi-
Threading
E.g.: Adobe Photoshop supported
SMT.
25
29
INTEL CORE
2 ● Introduced in 2006.
● It is a 64-bit µP.
● Its clock speed is from 1.2 GHz to 3 GHz.
● It has 291 million transistors.
● It has 64 KB of L1 cache per core and 4 MB
of L2 cache.
● It is launched in three different versions:
● Intel Core 2 Duo
● Intel Core 2 Quad
● Intel Core 2 Extreme
● Better performance with less power
consumption 28
INTEL CORE
I3
● Introduced in 2010.
● It is a 64-bit µP.
● It has 2 physical cores.
● Its clock speed is from 2.93
GHz to 3.33 GHz.
● It has 781 million transistors.
● It has 64 KB of L1 cache
per core, 512 KB of L2
cache and 4 MB of L3
cache.
31
INTEL CORE
I5
Introduced in 2009.
It is a 64-bit µP.
It has 4 physical cores.
Its clock speed is from 2.40
GHz to 3.60 GHz.
It has 781 million transistors.
It has 64 KB of L1 cache
per core, 256 KB of L2
cache and 8 MB of L3
cache.
30
Suitable for multitasking
and gaming.
INTEL CORE
I7
Introduced in 2008.
It is a 64-bit µP.
It has 4 physical cores.
Its clock speed is from 2.66
GHz to 3.33 GHz.
It has 731 million transistors.
It has 64 KB of L1 cache
per core, 256 KB of L2
cache and 8 MB of L3
cache.
29
INTEL CORE I9
Introduced in 2017.
It is a 64-bit µP.
It has 10 physical cores.
Its clock speed is from 3.33
GHz to 5.2 GHz.
It has 4.3 billion transistors.
It has 64 KB of L1 cache
per core, 1 MB of L2
cache per core and 13.75
MB of L3 cache.
Suitable for heavy
computation like 3D and
AI.
Assembly language, high level language, low level language,
machine language:
[Link]
and-high-level-language/.
MOV A, M : Assembly language
7E (0111 1110): Machine language
■ Assembly language and machine language are treated as low level languages.
■ Assembly language vs high-level language :
■ In assembly language programs written for one processor will not run on another
type of processor. In high-level language programs run independently of
processor type.
■ Performance and accuracy of assembly language code are better than a high-
level.
■ High-level languages have to give extra instructions to run code on the computer.
■ Code of assembly language is difficult to understand and debug than a high-level.
■ One or two statements of high-level language expand into many assembly
language codes.
■ Assembly language can communicate better than a high-level. Some type of
hardware actions can only be performed by assembly language.
■ In assembly language, we can directly read pointers at a physical address which
is not possible in high-level ex: MOV AX, [1234H]
■ Working with bits is easier in assembly language.
■ Assembler is used to translate code in assembly language while the compiler is
used to compile code in the high-level.
■ The executable code of high-level language is larger than assembly language
code so it takes a longer time to execute.
■ Due to long executable code, high-level programs are less efficient than
assembly language programs.
■ High-level language programmer does not need to know details about hardware
like registers in the processor as compared to assembly programmers.
■ The most high-level language code is first automatically converted into
assembly code.
Assembly Programming
● Machine Language
● binary
● hexadecimal
● machine code or object
code
● Assembly Language
● mnemonics
● assembler
● High-Level Language
● Pascal, Basic, C
● compiler
Assembly Language Programming
Microprocessor development tools:
[Link]
[Link].
Hardware Tools :
Software Tools !
In Circuit Emulator (ICE)
Assembler !
Logic Analyzer
Linker !
Emulator
Loader !
Compiler ! ■ A debugger is a computer program used by programmers to test
Libraries ! and debug a target program. Debuggers may use instruction-set
Simulator ! simulators, rather than running a program directly on the
Debugger ! processor to achieve a higher level of control over its execution.
Locator ! This allows debuggers to stop or halt the program according to
specific conditions. However, use of simulators decreases
execution speed. When a program crashes, debuggers show the
position of the error in the target program. Most debuggers also
are capable of running programs in a step-by-step mode, besides
stopping on specific points. They also can often modify the state
of programs while they are running.
Linker : A linker is special program that combines the object files, generated by
compiler/assembler, and other pieces of codes to originate an executable file have.
exe extension. In the object file, linker searches and append all libraries needed for
execution of file. It regulates the memory space that will hold the code from each
module. It also merges two or more separate object programs and establishes link
among them.
Loader : The loader is special program that takes input of object code from linker,
loads it to main memory, and prepares this code for execution by computer. Loader
allocates memory space to program. Even it settles down symbolic reference
between objects. It is in charge of loading programs and libraries in operating system.
Locator - A locator is a program used to assign the specific addresses of where the
segments of object code are to be loaded into memory.
Linking and relocation:
In computing, a linker or link editor is a computer utility program that takes one or
more object files generated by a compiler and combines them into a single executable
file, library file, or another 'object' file.
Computer programs typically are composed of several parts or modules;
these parts/modules need not all be contained within a single object file, and in
such cases refer to each other by means of symbols as addresses into other
modules, which are mapped into memory addresses when linked for execution.
For most compilers, each object file is the result of compiling one input source
When a program comprises multiple object files, the linker
combines these files into a unified executable program,
resolving the symbols as it goes along. Linkers can take
objects from a collection called a library or runtime library.
Most linkers do not include the whole library in the output; they
include only the files that are referenced by other object files or
libraries. Library linking may thus be an iterative process, with
some modules included requiring additional modules to be
linked, and so on.
Relocation is the process of assigning load addresses for
position-dependent code and data of a program and adjusting
the code and data to reflect the assigned addresses. Prior to
the advent of multi process systems, and still in many
embedded systems the addresses for objects were absolute
starting at a known location, often zero. Since multiprocessing
systems dynamically link and switch between programs it
became necessary to be able to relocate objects using position-
independent code.
A linker usually performs relocation in conjunction with
symbol resolution, the process of searching files and libraries
to replace symbolic references or names of libraries with
actual usable addresses in memory before running a
program. Relocation is typically done by the linker at link time,
but it can also be done at load time by a relocating loader, or
at run time by the running program itself. Some architectures
avoid relocation entirely by deferring address assignment to
run time; this is known as zero address arithmetic.
After linking, there has to be re-allocation of the sequences of placing
the codes before actually placement of the codes in the memory. The loader
program performs the task of reallocating the codes after finding the
physical RAM addresses available at a given instant.
Debugger: - A debugger is a program which allows you to load your object code
program into system memory, execute the program and troubleshoot or debug
it.
The debugger allows you to look at the contents of registers and memory
locations after your program runs.
- It allows you to change the contents of registers and memory locations and re-
run the program.
- Some debuggers allow you to stop execution after each instruction so that
you can check or alter after each register contents.
- A debugger also allows you to set a breakpoint at any point in your program. If
you insert a breakpoint at any point in your program, the debugger will run the
program up to the instruction where you put the breakpoint and then stop the
execution.
Emulator: - An emulator is a mixture of hardware and software.
- It is used to test and debug the hardware and software of an external system,
such as the prototype of a microprocessor based instrument. Part of the
Debugging, Simulator, Emulator, In-circuit
emulator:
[Link]
ICE:
Embedded systems pose unique debugging challenges. With neither terminal
nor display (in most cases), there's no natural way to probe these devices, to
extract the behavioural information needed to find what's wrong. They let us
connect an external computer to the system being debugged to enable single
stepping, breakpoints, and all of the debug resources enjoyed by programmers
of desktop computers.
In-circuit emulation (ICE) is the use of a hardware device or in-circuit emulator used to
debug the software of an embedded system. It operates by using a processor with the
additional ability to support debugging operations, as well as to carry out the main
function of the system. Particularly for older systems, with limited processors, this
usually involved replacing the processor temporarily with a hardware emulator: a more
powerful although more expensive version. It was historically in the form of bond-out
processor which has many internal signals brought out for the purpose of debugging.
These signals provide information about the state of the processor.
Logic analysers:
[Link]
An in-circuit emulator (ICE) provides a window into the embedded system.
The programmer uses the emulator to load programs into the embedded
system, run them, step through them slowly, and view and change data used
by the system's software.
What Does It Mean to Disassemble Code?
Preprocessing
& Compiling
Source Code Assembly Code
Assembly
Executable Code Object Code
Linking
DLLs
What Does It Mean to Disassemble
Code?
Preprocessing
& Compiling
Source Code Assembly Code
DISASSEMBLY
Assembly
Executable Code Object Code
Linking
DLLs