Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lecture 1&2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

MECHANICAL ENGINEERING

Lecture Notes on EEE 4130 Microprocessors


May-August 2024 Semester

Samuel Ndegwa

1
EEE 4130 MICROPROCESSORS
Prerequisites
Computer Science Basics
Digital Electronics

Purpose of the Course


The aim of this course is to enable the student to understand the fundamentals of
microprocessors, their design and applications.

Expected Learning Outcomes


By the end of this course, the learner should be able to;
1. Describe the internal structure of a microprocessor
2. Know the difference between microprocessors and microcontrollers
3. Design systems requiring microprocessor controllers

2
Course Content
1. Survey of computer and microprocessor system: Architecture;
central processing unit, memory and input and output devices, structure of
single board computer register oriented programme counter. Von-Neumann
and Harvard Architectures.
2. Registers instruction: types, formats and simple addressing modes. Input
and output devices: programme control fetch execute cycle, memory cycles.
Input and output operations, stacks processor status word.
3. Assembly language programming: assembler concept, mnemonics,
symbolic addresses, literal and pseudo operations,
simple instructions and addressing modes, data storage location, counter
error flags and messages. Interrupt service routines. Application of C
programming in microprocessors.
4. Interfacing: serial and parallel interfacing devices, polling techniques.
Development tools and monitors. Sensors and actuators interfacing. Study
case of an application.
5. Program structure: program modularization, relocation, re-entrant and
position independent code, sub-routines, parameter passing, development
tools and monitors, redundancy and fault tolerance.
Laboratory/Practical Exercises
i. Advanced programming (Assembly, Machine code)
ii. The 32-bit 80386 microprocessor
iii. Interrupt management
iv. Interface management-serial and parallel
Course Assessment
Cats 10%
Assignments 5%
Labs 15%
Exam 70%
Total 100%

3
Reference Materials

Core Text Book

1. Crisp J. (2004). Introduction to Microprocessors and microcontrollers,


Amsterdam, Boston, Elsevier/Newnes, 2nd Ed
Reference Text Books

1. Tocci R. & Ambrosio F., (2002). Microprocessors and Microcomputers:


hardware and software, Prentice Hall, 6th
2. Ed. Ramesh S.,(2002). Microprocessor Architecture, Programming, and
Application with 8085, Prentice Hall, 5th Ed

4
MICROPROCESSORS

Introduction

Figure 1: Microprocessor Chip

A microprocessor is an electronic device, which can perform basic arithmetic/logical


functions such as and, or, add, subtract upon given input signals. The word 'micro' is
used to indicate the physical size of the components involved.
Microprocessor is a VLSI (Very Large Scale Integration) device that contains
thousands of gates in a single chip.
It constitutes the heart of a microcomputer and it fetches microinstructions from
memory, decodes the instructions into a series of actions, and carries out these
actions in a sequence of steps.
All microprocessors contain microprograms, which impart basic logic given by
their instruction set for which they are called “Microprogrammed devices”.
The microprocessor is usually enclosed in one IC package called a
'Microprocessor chip'.
The microprocessor and associated support chips make up the “Central
Processor or Central Processing Unit (CPU)” which is also called the ”Micro
Processing Unit” (MPU).
The CPU is the nerve center of any digital computer, since it coordinates and,
controls the activities of all the peripheral units and performs all the calculations.

5
Components of Microprocessor
 Microprocessor is capable of performing various computing
functions and making decisions to change the sequence of
program execution.
 The microprocessor can be divided into three segments as
shown in the figure, Arithmetic/logic unit (ALU), register
array, and control unit.
 These three segment is responsible for all processing done in a computer

Arithmetic Register
and Logical Array
Unit (ALU)

Control Unit

Figure 2: Components of Microprocessor

Arithmetic and logic unit (ALU)


 It is the unit of microprocessor where various computing functions
are performed on the data.
 It performs arithmetic operations such as addition, subtraction, and
logical operations such as OR,AND, and Exclusive-OR.
 It is also known as the brain of the computer system.

Register array
 Registers are the small additional memory location which are used
to store and transfer data and programs that are currently being
executed.

Control unit
 The control unit provides the necessary timing and control signals
to all the operations in the microcomputer.

6
 It controls and executes the flow of data between the
microprocessor, memory and peripherals.
 The control bus is bidirectional and assists the CPU in synchronizing
control signals to internal devices and external components.
 This signal permits the CPU to receive or transmit data from main
memory.

System bus (data, address and control bus)


 This network of wires or electronic pathways is called the 'Bus'.
 A system bus is a single computer bus that connects the major
components of a computer system.
 It combines the functions of a data bus to carry information, an
address bus to determine where it should be sent, and a control bus
to determine its operation.
 The technique was developed to reduce costs and improve modularity.

Figure 3: System Bus


Address Bus
 It is a group of wires or lines that are used to transfer the addresses
of Memory or I/O devices.
 It is unidirectional.

7
 The width of the address bus corresponds to the maximum addressing
capacity of the bus, or the largest address within memory that the bus
can work with.
Data Bus
 It is used to transfer data within Microprocessor and Memory/Input or
Output devices.
 It is bidirectional as Microprocessor requires to send or receive data.
 As such, a greater width allows greater amounts of data to be
transferred at the same time.
Control Bus
 Microprocessor uses control bus to process data, i.e. what to do with
the selected memory location.
 Some control signals are Read, Write and Opcode fetch etc.
 This is a dedicated bus, because all timing signals are generated according
to control signal.
Microprocessor
Terminologies
Integrated circuits
An electronic circuit fabricated out of a solid block of semiconductor material. This
design of circuit, often called a solid state circuit, allows for very complex circuits
to be constructed in a small volume. An integrated circuit is also called a‘chip’.
Microprocessor-based system
A microprocessor based system consists of data input, storage, processing and output
devices, under the control of a CPU.
Microcontroller
This is a complete microprocessor-based control system built onto a single chip. It is
small and convenient but doesn’t do anything that could not be done with a
microprocessor and a few additional components.

Applications of Microprocessors (Microcomputers)


While comparing microprocessors it is better to consider the application at hand.

8
Generally, there are three main types of microprocessor depending on their
use:

A General-Purpose microprocessor is capable of executing various


instructions and can be instructed as to what specific sequence of operations it
must perform. It has myriad (variation) of applications as personal computer in
education, business, and home.

Embedded or Dedicated microprocessors are special purpose


microprocessors, the sequence of micro-operations is fixed and the computer
performs the same specific task over and over again.
These used to control 'smart machines' such as microwave ovens,
food blenders, washing machines, and driers.
These are also termed as 'Microcontrollers'. One of the fastest
growing applications of microcontrollers is in the automotive industry.

Peripheral Control microprocessors are attached to main


microprocessors. So they are also referred as 'Attach/Slave microprocessors or
Coprocessors'.
These are used in many computer systems for video graphics, data
communication, sound synthesis, floating-point math, and direct memory
accesses (DMA).
Their main objective is to offload the main microprocessor, thus saving time
and improving speeds. As a result, the main processor is able to concentrate
on higher-level tasks resulting in improved system performance.

The concept of 'Distributed Computing or Processing' is evolving, and future


microcomputers systems will be designed with separate processors for each I/O
device in the system. Distributed processing is the organization of processing in such a
way that a number of machines (microprocessors) can cooperate in exchanging data over a
network. Local processing is carried out locally and the exchanged data affects the
system as a whole.

9
Computer Architecture
Computer Architecture refers to the internal design of a computer with its CPU, which
includes: Arithmetic and logic unit, Control unit, Registers, Memory for data and instructions,
Input/output interface and External storage functions.
Von-Neumann architecture: The same memory and bus are used to store both
Data and Instructions

Figure 4: Von-Neumann computer architecture


The main drawback: CPU is unable to access program memory and data memory
simultaneously. This case is called the "bottleneck" that affects system
performance.
The bottleneck:
 If a Von-Neumann machine wants to perform an instruction (already
fetched from the memory) on some data in memory, it has to move the
data across the bus into the CPU.
 When the computation is done, it needs to move outputs of the
computation to memory across the same bus; this operation will be
completed if the bus is not used by another operation to fetch another
instruction or data from the shared memory; otherwise the outputs of
the computation has to wait.

Harvard architecture: The Harvard architecture stores machine


instructions and data in separate memory units using different buses.

10
Figure 5: Harvard computer architecture
The main advantage: Computers designed with the Harvard architecture are able
to run a program and access data independently, and therefore simultaneously.
Harvard architecture is more complicated but separate pipelines remove the
bottleneck that Von-Neumann creates.
Modified Harvard Architecture: The majority of modern computers
have no physical separation between the memory spaces used by both data
and instructions, therefore could be described technically as Von-
Neumann.

Figure 6: Modified Harvard computer architecture


But as they have two separate address spaces, different buses and special
instructions that keep data from being mistaken for code, this architecture
is called "Modified Harvard Architecture". Ex. some initial data values or
constants can be accessed by the running program directly from instruction
memory without taking up space in data memory.

11
Classification of Computer Systems
A computer sequentially performs one operation at a time. The time required to
perform operations is called the 'Processing Speed' of the computer.
Computers are classified according to their processing speed. It depends not only
on the hardware characteristics of the system but also on the efficiency of its
software components.

Some hardware characteristics of importance in achieving high processing speed


are as follows:
Word Length/Size: is the number of bits treated by the computer as a unit.
It can be 4-, 8-, 16-, 32-bits and so on e.g. a 16-bit word will be able to hold
numbers in the range from -215 through +215-1.

The number of different types of instructions is directly related to the word


length/size. So it can be concluded that larger the word length, the greater the
processing speed.

Data Path Size: depends on the width of the internal CPU buses. Wider data
paths speed up CPU operations, since more information is transmitted in a single
transfer.

Other important hardware functions are the logic family, overlapping of CPU
instructions, memory bandwidth, I/O bandwidth etc.

Fundamental Steps of a Microprocessor Cycle


Execution of an instruction starts from the program counter (PC), which
contains the address of the instruction and ends with the placement of the result
in the appropriate location.

The sequence of steps during execution of instructions is:


i. Fetch Instruction: Every instruction cycle begins with an op-code fetch
bus cycle i.e., a memory read of the op-code.
ii. Determine Operand: The operand is required to execute the instructions.
iii. Execute Instruction: Control signal from the control unit activates the

12
operation, so the instructions are executed.
iv. Store the Result: The memory stores the result in the specified location,
and the execution/microprocessor cycle ends.

After completing one instruction, the CPU moves on to the next one. This fetch
and execute process is repeated until all of the instructions in a specific program
have been executed.

The CPU’s lifeblood, its heartbeat is the system clock, which synchronizes all
activities within the computer. Each step in the microprocessor cycle takes at
least one tick of the system clock called a 'Clock Cycle or T Cycle' e.g., one T
cycle for 8088 5MHz is 200 nanoseconds.
We measure the speed of an instruction by the number of clock cycles required
to execute it. A clock cycle is the microprocessor's smallest unit of time measurement.

The Intel 8088/86 Microprocessor Family


The width of the data bus in bits is usually used to categorize the
microprocessors. On this basis of word length, they are categorized into:
i.8-bit microprocessor.
ii.16-bit microprocessor.
iii.32-bit microprocessor and so on.
The width of data bus determines how much data the microprocessor can read
or write in one memory or I/O cycle.
The term 16-bit means that it’s ALU, its internal registers, and most of its
instructions are designed to work with 16-bits (also called 'word').
Some microprocessors have an internal data bus wider than the external one,
e.g. in the Intel 8088 the widths of the external and internal data buses are 8-
and 16-bits respectively, for which it is also referred to as “8/16- bit
microprocessor”.
8088/8086 CPU Architecture: -
The term architecture in relation to microprocessor refers to the internal design and
organization of the device.
Every microprocessor does two basic things over and over again- fetching
instructions and then executing them. The older microprocessors could only do one

13
thing at a time, if it is busy fetching an instruction it could not execute one.

The entire process of reading memory, incrementing the IP, and decoding the
instruction is known as the 'Fetch and Execute principle' of the stored program
computer.
A stored program computer works mainly on instructions held in store
(ROM/RAM); and these can be altered. One way of increasing the processing
speed of a microprocessor is to clock at a higher frequency. Another way is to
employ the 'Pipelining Technique'.
A computer performs sequentially one operation at a time i.e., CPU performs
all the tasks involved in processing an instruction such as fetching, decoding,
determining operands, and executing instructions serially on a one-at-a-time
basis. It is termed as 'Serial or Sequential Fetch/Execute Cycle'.

On the other hand, 8088/8086 incorporates 'Overlap Fetch/Execute Cycle',


which is also known as 'Pipelining Technique'. This technique is based on the
overlapping of the execution of several instructions simultaneously. Each instruction is
executed as a number of cycles that must be performed in sequentially. Thus we enable
several instructions to be done by the execution of different cycles on different
instructions concurrently.

14
Figure 1: 8088/8086 CPU Architecture
Fig 5 shows that a model of 8088/86 CPU, which consists of two separate
processors, called the Bus Interface Unit (BIU) and the Execution Unit (EU).
Since these two units are entirely independent of each other, the 8088 can do
two things at the same time. Together they form a two-stage pipeline. Each
unit performs certain tasks associated with the instruction processing
simultaneously and this allows the 8088/86 to achieve a higher execution rate.

Bus Interface Unit (BIU): fetches instructions, calculates addresses, fetches


operands and writes results in memory as requested by the EU.
However, if no such requests are outstanding and the bus is free, the BIU
proceeds to fill any vacancies created in the Instruction Queue (IQ).

15
Execution Unit (EU): receives program instructions and data from the BIU,
executes these instructions, and stores the result in the general registers.
When the EU completes the execution of an instruction, it passes to the BIU any
results (destined for memory or I/O) and proceeds to the next instruction.

First-in-First-Out (FIFO) buffer called an 'Instruction Queue or Pre-fetch


Queue' (IQ). FIFO is the processing of items in a list such that the earliest arrival is
processed first and the latest arrival is processed last.

The main advantage of the Pipelining is that the EU can execute


instructions almost continually instead of having to wait for the BIU to fetch a
new instruction.
Another subtle advantage to the Pipelined Architecture is that as the
next several instructions are in the IQ, and the BIU can access memory at a
'leisurely' pace. This means that slow-memory parts such as printers can be used
without affecting overall system performance.

There are three conditions that will cause the EU to enter in a 'wait' mode.

i.Firstly, when an instruction requires access to a memory location not in the queue.
ii.The second condition occurs when the instruction to be executed is a “Branch/Jump”
instruction. In this case control is to be transferred to a new (non-sequential)
address.
iii.The last condition occurs during execution of instructions that are slow to execute.
This can cause the BIU to suspend fetching instructions.

16

You might also like