Subject: ECE3004
Microprocessors and Microcontrollers
Dr. Nella Anveshkumar
Course type: LTP
Credits: 4
Max 5 sessions
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
CPU COMPONENTS
Arithmetic and Logic Unit
Executes arithmetic and logical
operations.
Accumulator is a special 8-bit register
associated with ALU.Register ‘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 contained.Execution 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:
https://www.youtube.com/watch?v=_Cdf68NMTZ0.
INTRODUCTION
Fairchild Semiconductors (founded in 1957)
invented the first IC in 1959.
In 1968, Robert Noyce, Gordan Moore, Andrew
Grove resigned from Fairchild Semiconductors.
They founded their own company Intel (Integrated
Electronics).
Intel grown from 3 man start-up in 1968 to
industrial giant by 1981.
3
It had 20,000 employees and $188 million revenue
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.
4 KB main memory It could execute around 60,000
45 instructions instructions per second.
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
Drawback was that it needed three power supplies.
second. 9
Small computers (Microcomputers) were designed in mid 1970’s
using 8080 as CPU.
Introduced in 1976.
INTEL It was also 8-bit µP.
8085
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 were10
NMOS technology sold.
Uses only one +5v power
Introduced in
1978.
It was first 16-bit µP and noted as
INTEL 3G.
Its clock speed is 4.77 MHz, 8 MHz
8086
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 Multiply and Divide
It had 22,000 instructions. 12
instructions.
Introduced in 1979.
INTEL 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
It could execute 4
transistors. 15
million
instructions per second.
Introduced in 1986.
It was first 32-bit µP.
INTEL 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
Intel 80386
80386 SX became the best 17
selling microprocessor in
80386 SL
history.
Introduced in 1989.
INTEL 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
8KB of cache
80486 SL memory
was
80486 DX4 18
introduced.
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.
Cache memory:
8 KB for
instructions. 19
8 KB for data.
INTEL PENTIUM PRO
Introduced in 1995.
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.
20
It had L2 cache of 256 KB.
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.
L1 cache of 32 KB & L2
cache of 512 KB, 1MB or 2
MB.
It could work with 4 Xeons
in same system. 22
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
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
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 230 billion
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 430 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.
Assembly language, high level language, low level language,
machine language:
http://www.itrelease.com/2018/07/difference-between-assembly-language-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
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:
https://
csenotesforyou.blogspot.com/2016/12/assembly-language-program-development.
html
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 code file.
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 hardware of an
emulator is a multi wire cable which connects the host system to the system being
developed. Ex: FPGAs, USRPs.
Debugging, Simulator, Emulator, In-circuit emulator:
https://www.youtube.com/watch?v=4wmDsd53ibE.
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:
https://www.radio-electronics.com/info/t_and_m/logic_analyzer/logic_analyzer.php.
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
LY
M B
SE
AS Assembly
I S
D
Executable Code Object Code
Linking
DLLs
Modular programming: https
://en.wikipedia.org/wiki/Modular_programming.
Modular programming is a software design technique that emphasizes separating the
functionality of a program into independent, interchangeable modules, such that each
contains everything necessary to execute only one aspect of the desired functionality.
A module interface expresses the elements that are provided and required by the module.
The elements defined in the interface are detectable by other modules. The implementation
contains the working code that corresponds to the elements declared in the interface.
Modular programming is closely related to structured programming and
object-oriented programming, all having the same goal of facilitating construction of large
software programs and systems by decomposition into smaller pieces, and all originating
around the 1960s. While the historical usage of these terms has been inconsistent, "modular
programming" now refers to high-level decomposition of the code of an entire program into
pieces: structured programming to the low-level code use of structured control flow, and
object-oriented programming to the data use of objects, a kind of data structure.
52