0% found this document useful (0 votes)
114 views87 pages

Micro Unit 1

This document provides an overview of microprocessors and embedded systems. It discusses the history of computing from mechanical to electrical to integrated circuits ages. It also describes the basic components of a microprocessor system including the CPU, memory, and I/O. General purpose computers and microcontrollers are compared. Embedded applications like automobiles, TVs, and appliances are reviewed. The von Neumann and Harvard architectures are introduced. Finally, the basic operation and programming of microprocessors is covered at a high level.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views87 pages

Micro Unit 1

This document provides an overview of microprocessors and embedded systems. It discusses the history of computing from mechanical to electrical to integrated circuits ages. It also describes the basic components of a microprocessor system including the CPU, memory, and I/O. General purpose computers and microcontrollers are compared. Embedded applications like automobiles, TVs, and appliances are reviewed. The von Neumann and Harvard architectures are introduced. Finally, the basic operation and programming of microprocessors is covered at a high level.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 87

COE 381 MICROPROCESSORS

UNIT 1 BASICS OF MICROPROCESSORS

Chapter Objectives
General-purpose Computers and High Performance Systems
Embedded Computing

Micro controllers Memory

The CPU

Chapter Objectives

Input / Output

The External Bus The Arithmetic Logic Unit

The Registers

The Internal Bus

Chapter Objectives
The Control Unit Instructions and Data The Control Logic

The Internal Structure of a Simple Machine

Microprocessor Instructions

Micro cycles

SECTION 1: INTRODUCTION

MICROPROCESSORS

History of Computation
Mechanical Age: B.C. to 1800s
500 B.C. Babylonians invented abacus, first mechanical calculator 1642 Blaise Pascal invented calculator using wheels and gears 1823 Charles Babbage created Analytical Engine capable of storing data using punch cards

History of Computation
Electrical Age: 1800s to 1970s
Triggered by advent of electric motor (conceived by Faraday) Motor driven adding machines based on Pascals idea

History of Computation
1896 Hollerith formed Tabulating Machine Company (Todays IBM) 1946 ENIAC (Electronics Numerical Integrator and Calculator) First general purpose programmable electronic machine Used 17000 vacuum tubes, 500 miles of wires, weighed 30 tons. Performed 100K operations/second, programmed by rewiring)

History of Computation
Integrated Circuits Age: 1960s to present
Triggered by development of transistor at Bell Labs, 1948
1958 IC technology invented by Jack Kilby of Texas Instruments 1971 Worlds first microprocessor, Intel 4004, 4-bit bus 4K 4-bit(nibble) memory, 50 KIPs, 2300 transistors, 10 m technology 1972 first 8-bit P, Intel 8008, 16K bytes, 50 KIPs

History of Computation
1973 Intel 808, 64K bytes, 500 KIPS, 6000 transistors, 6 m followed by other 8-bit Ps lke Motorola MC6800 (1974) and Z-8

1978 Intel 8086, 16-bit P, 1M bytes, 2.5 MIPs Used 4-bytes instruction cache to speed up execution time Base for 80286 P, also 16-bit with 16M bytes

History of Computation
1986 Intel 80386, 32-bit P, 32-bit data and address busses 4G bytes, 16 to 33 MHz, 275000 transistors, 1 m

1989 Intel 80486, like 80386 with numeric coprocessor. 4G bytes + 8Kb cache, 25 to 50 MHz, 1.2M transistors, 1 and 0.8 m
Advancement continues with Intel, AMD, Motorola, and other Ps

Reasons Behind P Technology


Speed
Graphics, Numerical Analysis, CAD, and Signal Processing applications

Convenience
Large memory, smaller size, and lower weight

Power Dissipation
Portable computers and wireless services

Reliability
Noise tolerance in adverse environments and temperatures

Cost
Get more done for the money

THE CPU
Central Processing Unit (CPU) - system component responsible for processing the instructions that control the flow of information in the system causing the transformation of data Early CPUs consisted of several components. In the 1970s VLSI technology allowed CPUs and additional circuitry to be fabricated on a single chip

THE CPU
MICROPROCESSOR

When the CPU is fabricated as a single chip (or as a part of a single chip) then that chip is known as a microprocessor

MICROPROCESSORS
4-Bit 8-Bit 16-Bit

32-Bit

64-Bit

Microprocessors are classified by their word size - the number of bits which can be stored and operated on as a single unit inside their CPU

MICROPROCESSORS
Used to replace equivalent hardwired logic Unit cost is lower than direct logic when volumes are high
Overall UnIt Cost Component Cost per unIt: Random CPU CPU Number of unIts produced LogIc

(general) (custom)

MICROPROCESSORS
Microprocessors require more attention to software design whereas hardware design is important in direct logic designs

MICROPROCESSORS
Speed generally lower than direct logic Direct logic must be redesigned for any modification whereas microprocessors can form entire families of products by changing the software

Summary of Advantages of Microprocessor Design over Random Logic


Area of comparison
Design: Design Emphasis: Package Count: Flexibility: Redesign/modification: Circuitry: Speed:

Random logic
Specific Hardware High Low Difficult Redesign always Very fast

Microprocessor
General Software Low High Relatively easy (Families of Products) Alike Moderate

MICROPROCESSOR SYSTEMS
Microprocessor-based systems can generally be divided into two distinct groups:
General-purpose Computers Microcontrollers

Total Development & Production Cost vrs Quantity

GENERAL-PURPOSE COMPUTERS

These computer systems are designed to be as versatile as possible Consist of generalised microprocessor and expandable PCB mainboard 1000s of uses and applications!

HIGH PERFORMANCE SYSTEMS

High performance systems are used to run computationally intensive and data processing applications Much more expensive than the average PC (specialized software and small volumes)

HIGH PERFORMANCE SYSTEMS


Main factors in selecting a microprocessor for a general-purpose computer:
cost speed instruction set capabilities memory range available software and development tools

MICROCONTROLLERS
PIC

Replaces equivalent random logic design When fabricated as a single chip which can be programmed on a PCB it is called a PIC (Programmable In-circuit Controller)

MICROCONTROLLERS
Do not require excellent CPU performance Software is not generally as sophisticated as that for general-purpose computers Unit costs much lower than that of general microprocessor systems

MICROCONTROLLERS
Main factors in selecting a microprocessor for a micro-controller:
cost power consumption overall system chip count external interfacing features on-chip additional support circuits (DACs, ADCs, timers, )

Examples
Personal digital assistant (PDA). Printer. Cell phone. Automobile: engine, brakes, dash, etc. Television. Household appliances. PC keyboard (scans keys).

Early History
Late 1940s: MIT Whirlwind computer was designed for real-time operations.
Originally designed to control an aircraft simulator.

First microprocessor was Intel 4004 in early 1970s.


HP-35 calculator used several chips to implement a microprocessor in 1972.

Early History, contd.


Automobiles used microprocessor-based engine controllers starting in 1970s.
Control fuel/air mixture, engine timing, etc.

Multiple modes of operation: warm-up, cruise, hill climbing, etc.


Provides lower emissions, better fuel efficiency.

Microprocessor Varieties
Micro-controller: includes I/O devices, onboard memory. Digital signal processor (DSP): microprocessor optimized for digital signal processing.

Typical embedded word sizes: 8-bit, 16-bit, 32bit.

Application Examples
Simple control: front panel of microwave oven, etc. Canon EOS 3 has three microprocessors.
32-bit RISC CPU runs autofocus and eye control systems.

Analog TV: channel selection, etc. Digital TV: programmable CPUs + hardwired logic.

EMBEDDED SYSTEMS
Typical embedded system applications

EMBEDDED COMPUTING
Since the start of the computing age (1940s1950s) computers have been embedded in applications An embedded system is an infrastructure, including programmable computers, which contains a microprocessor but which is not itself a general-purpose computing system The application characteristics influence the design of the infrastructure

Automotive Embedded Systems


Todays high-end automobile may have 100 microprocessors:
4-bit microcontroller checks seat belt;

microcontrollers run dashboard devices;


16/32-bit microprocessor controls engine.

BMW 850i brake and stability control system


Anti-lock brake system (ABS): pumps brakes to reduce skidding. Automatic stability control (ASC): controls engine to improve stability.

SECTION 2

BASIC MICROPROCESSOR SYSTEM ARCHITECTURE

Basic Microprocessor System

PROGRAMMABLE COMPUTERS
CPU MEMORY

A separate memory which can hold CPU instructions is what defines a programmable computer

von Neumann ARCHITECTURE


INPUT CPU OUTPUT

MEMORY

Instructions and Data reside in the same memory banks Simple and Economical

Harvard ARCHITECTURE
INPUT CPU OUTPUT

INSTRUCTION MEMORY

DATA MEMORY

Fetch instruction and fetch/store data at the same time (Performance improvements) More expensive and specialized

CPU Internal Structure

CPUs Three Main Sections


Registers: high speed locations used to store important information during CPU operations. Arithmetic/Logic Unit: performs operations on operands (stored in registers), for example the addition of two numbers, and stores the result (in a register). Control Unit: generates all the control signals which control the flow of information within the CPU and the transfer of data between the CPU and memory and I/O devices.

BASIC MICROPROCESSOR OPERATION


It fetches and executes instruction from memory performing this cycle continuously The microprocessor is nothing more than a very large and complex sequential circuit on a chip

It is made up of smaller and simpler sequential and combinational logic circuits

MICROPROCESSOR INTERNAL OVERVIEW


A simple microprocessor consists of the following three main units:
Registers (hold data to be operated on) Arithmetic/Logic Unit (operates on data) Control Unit (controls the flow of information to/from external memory/devices and between registers within the CPU)

These main units are connected by busses which enables data to flow between them

MICROPROCESSOR PROGRAMMING
High-Level Language (e.g. C++) Assembly Language Binary Machine Code Instructions
Instruction Flow CU CCR MEMORY Control Signals

External Hardware Signals


Busses

IR ALU CPU

MEMORY
Very large array of cells each of which can hold one BInary digiT (BIT) The number of bits which can be accessed simultaneously is called a word usually expressed in bytes (8 bits) The size of memory in bytes is always a power of 2 (usually expressed in K bytes) Each word has a distinct address

MEMORY
A CPU must provide the address of the data it wishes to access to the memory device Both instructions and data may reside in the same memory bank - the only difference between them being how they are interpreted by the CPU Memory devices can be classified as
read only, read/write, volatile and non-volatile

INPUT/OUTPUT
INPUT MICRO

I/O provides the only means by which a microprocessor can communicate with the outside world (A system without I/O is useless) I/O is accessed via ports which are accessed in a similar manner to memory

EXTERNAL BUSSES
These connect the CPU to external systems such as I/O devices and memory banks Busses can be divided into data, address and control lines

OPTIMIZATIONS
Additional external busses can help increase system performance (for example, the Harvard architecture)

Additional internal busses can allow CPU instructions to be executed concurrently Optimizations greatly complicate the design of a microprocessor system and its CPU

SECTION 3

BASIC COMPONENTS OF A MICROPROCESSOR

What is a Microprocessor?
Simplest form: Clocked Sequential Circuit Responds to: A known Series of Binary Signals

Specific Signal sets can force the microprocessor to do specific things. These sets are called instructions. A sequence of Instructions is called a program and the generation is of the program is called machine-code programming.

Registers
Made up of number of flip-flips connect in parallel and clocked simultaneously.

Registers
Information is latched in the registers Can be moved internally to other registers or components, or it could move to an external device to the microprocessor Register width is related to memory width, usually by a factor of 2
E.g. If memory is 16 bits wide, then the some of the registers will be 16 and others 32 bits wide.

Micro-Operations
Register have combination logic associated with them to perform simple functions and are called micro-operations. There are many types of micro-operations and the registers wont usually be able to perform all of them
Load, Clear, Complement, Increment, Decrement, Shift Right, Shift Left, Serial Load Left, Serial Load Right and many more!

Micro-Operations
Notation:
Rn is the most significant bit (MSB) R0 is the least significant bit (LSB) Ri is any bit
Examples:
R <- R-1 : Decrement Ri+1 <- Ri ; R0 <- 0 : Shift Left

Micro-Operations

The Internal Bus


Need: To be able to transfer the contents of the registers between each other easily. Solution: An internal bus. All input and outputs are connected to a bus so that information can be shared easily. This is only possible if the inputs and outputs are disabled and enabled appropriately and so tri-state buffers are used for this.

The Internal Bus


Registers are clocked. Thus enable lines may be set before the clock but actions will only take effect, and thus data transferred, on the clock signal and in time with the microprocessor. Note the example in your notes!

The ALU
Used to perform arithmetic and logic operations on the contents of registers Dedicated unit and performs more complex operations than the registers

The ALU
Typical Functions:
Addition Subtraction Logic And/OR/XOR Complement Increment

The outputs are connected directly to the bus and tri-state buffered. Because it takes time to set up the registers, an ALU operation is slower than a registers micro operation.

Control Unit
Contains the hardware instruction logic Decodes and monitors instruction execution Arbiter for the resources in the CPU

Combines with Registers, Bus and ALU forms the CPU

SECTION 4

BASIC OPERATIONS OF A MICROPROCESSOR

Instructions and Data

Instructions and Data


Binary information from memory is applied to both the control logic and the registers Interpreted:
By the control logic as an instruction and causes logic to generate the appropriate micro operations By the memory as data and stored appropriately

Note: Instructions and Data share the same Data Bus path for accessed memory as the process to retrieve the information is exactly the same! The operation of the CPU determines the content

Instructions and Data


For an 8 bit CPU, the data bus width is 8 bits which is the same as the memory width Implying:
Instructions: 8 bits wide. Thus 28 or 256 possible instructions. Not all will be used - to prevent errors Data: In 8 bit units

Control Logic
A small sequential circuit or state machine

Generates control signals for the microoperations


Manipulate ALU and register data

Fetch Cycle:
Instruction read from memory and applied to control logic inputs

Execute Cycle:
Control signals are generated appropriately

Control Logic

Simple Internal Structure

Simple Internal Structure


All registers are connected to a common bus and are tri-stated via the control logic The bus is wide enough to accommodate the largest register Key:
MAR: Memory address register
Holds the address of the memory to be read

MDR: Memory data register


Placeholder for information read from or to be written to memory

Simple Internal Structure


IR: Instruction Register
Currently executing instruction

PC: Program Counter


Address of next instruction to be executed

A: Accumulator
Drives input of ALU Logic operations can take place here

CR: Control Register


Loaded by the control logic, provides control for the memory and I/O devices

DP: Data Pointer


Stores the address of any needed operand

Simple Internal Structure


SP: Stack Pointer
Dedicated pointer to the top of the system memory stack

PSW: Process Status Word


Stores the status and error flags

General Registers
General purpose use within the processor and are assumed to be the same as the accumulator.

In the simple machine we assume the PC can increment and the SP can increment or decrement itself.

Microprocessor Instructions
Instructions complete certain tasks and must include certain bits on information to complete these tasks:
1. The Operation (Opcode)
The instructions such as add Or where the data can be found if the data is in memory For instructions such as add which take two inputs Where to put the data after the instruction has completed

2. The Data Source


3. Second Data Source

4. Destination
5. Next instruction

Microprocessor Instructions
Cannot be stored in a single memory location (8 bits) so reduction is needed
Requirement 5 omitted:
Assume next instruction follows on immediately after the current instruction!

Requirements 2 through 4 omitted:


Use internal CPU registers to contain data (or addresses) making them implicit.

Thus an instruction can fit into a single byte

Microprocessor Instructions
Example:
Add C (Instruction = 81Hex) 1. 2. 3. 4. 5. Operation: Addition Source 1: Accumulator (Implied) Source 2: Register C Destination: Accumulator (Implied) Next instruction: Followed on (Implied)

Microprocessor Instructions
Even after such simplification, commands that require memory access to perform the instruction will need to use more than 8 bits These commands are known as multi-byte instructions The first byte is then the Opcode and the following bytes supply the extra information.

Microcycles (1)
The execution of each instruction is made of of smaller operations called microcycles Each microcycle takes one clock cycle to perform Represents one register manipulation or one data transfer Notation:
Destination<-Source
MAR <- PC or IR <- MDR PC <- PC + 1 or SP <- SP - 1

Microcycles (2)
If memory must be accessed, it cannot be done in one clock cycle. The appropriate registers need to be accessed and the memory requested. This is done by:
MAR <- source register MDR <- memory(MAR)

Microcycles (3)
Each microcycle involving transfer of data internally uses the internal bus and only one such cycle can occur at a time If an operation involves a register manipulation or external memory, then it can occur at the same time as an internal bus operation

InstructionsSummary
To summaries, the instruction cycle is made up of two sections:
Fetch the instruction and any necessary operands Execute the instruction

InstructionsExample
"Add the contents of the accumulator to the contents of memory location 2100, and leave the result of the addition in the accumulator". Assume:
Opcode is A2 (hex) Little endian

Instruction Fetch

Microcycles of the Instruction


Microcycles on our simple machine
Cycle I IIa IIb III Micro-operations Description

MAR PC
PC PC + 1

Opcode address
PC points to the 1st operand

MDRmemory(MAR)
IR MDR

Place opcode into MDR


Transfer opcode to IR

Cycle IV Va Vb

Micro-operations MAR PC PC PC + 1 MDRmemory(MAR)

Description Operand address into MAR PC points to 2nd operand Get 1st operand byte

VI
VII

DP(L) MDR
MAR PC PC PC + 1 MDRmemory(MAR) DP(H) MDR MAR DP MDRmemory(MAR) tempR MDR A A plus tempR

Put into LSByte of DP


2nd operand byte address to MAR

VIIIa VIIIb IX X

Point to next opcode Get 2nd operand byte Put into MSbyte of DP Address of operand data into MAR

XI XII XIII

Get operand data byte Put into tempR of ALU Use ALU to add A and tempR

Notes
Four machine cycles were used to perform the instruction First three are FETCH cycles A total of 13 clock cycles are used for the four machine cycles The PC is used to point to the next byte to be fetched, and is incremented by 1 automatically during (simultaneous with) every memory fetch PC increment is by register manipulation

Notes
The first fetch (the opcode fetch cycle) is the same for all instructions Any further fetch cycles are dictated by the opcode itself

Opcode is now in the IR and influences the operation of the control logic

You might also like