Top Banner
Microprocessor Engineering Introduction 11/12
36

Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: [email protected]@shu.ac.uk.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microprocessor Engineering

Introduction 11/12

Page 2: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microprocessor Engineering 16-7210

Alan Holloway – contact: [email protected]– Room 9323 Furnival/Cantor

• Weeks 1-6– 6 × 2 Hour Lectures– 6 × 1 Hour Labs

• Weeks 7-12– 6 × 1 Hour Lectures– 6 × 2 Hour Labs

Page 3: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Assessment method

• 50% Coursework– formative series of lab tutorials (7.5%)– In class test on C & bit manipulation (2.5%)– major assignment (40%)

• 50 % Exam – 2 Hours duration– 4 from 6 questions

Page 4: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Resources

• All course information can be found on the Blackboard site or at www.aholloway.co.uk

– Lecture notes– Sample programs– Reading list– Software (available free)

Page 5: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microprocessor Engineering

• Microprocessor Systems• Microcontrollers• ARM7 core Processor Family

– specifically NXP LPC2368 microcontroller– Many others are available 8051, PIC, AVR etc

• C Programming will be used throughout– ARM Realview MDK - 'C' compiler & other tools– u-Vision Integrated Development Environment

1-5

Page 6: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-6

clock

address bus

data bus

chip enable signals

readwrite

uP ROM I/ORAM

CE CECE

OE WR OE OEWR

Additional devices

Microprocessor System Structure

ad

address decoder

reset

Page 7: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Bus operations

• Read • Write• Each read/write operation is made up of a

number of clock cycles or T states• Each machine instruction is made up of one or

more read and/or write operations• This is why we shouldn't compare

microprocessors simply based on clock speed

1-7

Page 8: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-8

Address Bus• Unidirectional and generated by microprocessor• Number of address lines determines number of address

locations • Addressable locations = 2^a where a is the number of

address lines

ROM

RAM

I/O

0000H

E000H

3FFFH

E00FH

7FFFH

FFFFH

6000H

MemoryAddress

Totalmemory space

d bits

2a - 1

01

Memory Map :A memory map shows the position of devices within the whole of the addressable area

memory addresses

Page 9: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Data Bus

• Bi-directional• Usually matches the word length of the

microprocessor • Usually a multiple of 8 • We talk of 8-bit, 16-bit , 32-bit and 64-bit

processors which refers to the normal word length of the microprocessor

1-9

Page 10: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Control bus

• Consists of potentially many signals. Typically:-– Read– Write– Could be single signal - Read/notWrite line– Interrupt control– Bus control signals for DMA (Direct Memory

Access)

1-10

Page 11: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microprocessr

• CPU – Central Processing Unit– ALU – Arithmetic Control Unit

• Circuit which performs arithmetic and logical operations

– Registers• Small CPU bases storage very quick

– Control Unit• Controls the flow of data through the processor, and

coordinates the activities of the other units within it

1-11

Page 12: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-12

Microprocessor Registers

• General purpose registers• Accumulator – used in conjunction with ALU –

often found on 8-bit microprocessors• Status or Flag Register – indicate result of last

instruction executed• Program counter(PC) or Instruction Pointer• Stack Pointer (SP)• Special registers – Instruction and memory

address register

Page 13: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

The Fetch – Execute cycle• Fetch

– memory read cycle– place in instruction register and decode

• Execute– may involve additional read and/or write cycles

• Often the whole Fetch-Execute cycle is carried out through a pipeline operation involving several stages.– 5 stages are often used (IF, ID, RR, EX, WB)– The Pentium 4 has 20 stages– The ARM 7 has 3 stages

1-13

Page 17: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Pipelines

• Does not speed up 1 task - increases overall throughput

• Multiple tasks operate simultaneously using separate resources

• Limited by speed of slowest resource

Page 18: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

ARM7 Pipeline• The pipeline has hardware-independent stages that execute one

instruction while decoding a second and fetching a third. The pipeline speeds up the throughput ofCPU instructions so effectively that most ARM instructions can be executed in a single cycle.

• The pipeline works most efficiently on linear code.

Page 19: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-19

CPU operation

• On reset – PC is loaded with a value, typically 0• Fetch – execute cycle

– Fetch instruction • memory read cycle using PC (program counter)• place in instruction register and decode• increment PC ready for next fetch

– Execute instruction• often involves additional read and/or write cycles to read

operands and possibly write back results• could modify PC – causes flow of program execution to

change

Page 20: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-20

CPU Architecture

• Two basic types– Von Neumann

• One memory space for instructions and data• Therefore one single memory bus structure

– Harvard• Separate instruction and data spaces• Therefore separate memory buses – parallel operation

and therefore faster operation• Can have different address and data bus widths

optimised for each bus

Page 21: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-21

Basic microprocessor system

• Von Neumann Architecture

Reset

Oscillator

Clock

Memory (Instructions & Data) and Input/Output

Read

Write

Address

Data

Microprocessor

Power on & manual reset

D0-dy

A0-Ax

Page 22: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-22

Harvard Architecture

Program Memory

Data Memory & I/O

Read

Write

Address

Data

Microprocessor

d0-dn

Address

Read

Instruction

I0-Iw

A0-AxA0-Ay

Page 23: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

What is an embedded system?

• An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions

•Washing machine runs programs•Open water valve•Heat water•Start spin•etc etc….

•Do we need a PC running windows Vista to do this ?

Page 24: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Will I ever need to use one?

• Over 4 billion 8-bit microcontrollers were sold in 2006 alone

• the world's population is estimated to be about 6.756 billion

• Average car contains >50 microcontrollers• Electrical, electronic, control, robotics,

computer engineer - Yes you will

Page 25: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

What is an Embedded Computer System• Special purpose computer – usually with one

specific task or application.• Usually embedded in a device which often

has other electronic and mechanical parts• Usually optimised for the specific task• Has the usual basic computer components –

CPU, memory, inputs & outputs

Page 26: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microcontroller

• A microcontroller is the integration of – microprocessor– memory

• ROM types – commonly flash PROM• RAM – Static ram

– peripherals• parallel input and output(digital I/O)• Timers and Counters• Serial input and output (UART, USART, SPI etc.) • Analogue to digital converters• PWM, CAPCOM registers, DACs etc.etc.

1-26

Page 27: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Examples• consumer appliances

– tv's, mp3 players, dvd's, washing machines etc.

• automotive applications– engine management, anti-lock braking

• computer peripherals– hard disk controllers, routers, switches

• medical equipment– scanners, blood analysers

• telecoms– mobile phones

• aerospace – satellite control systems, avionics

Page 28: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Some Characteristics

• Very simple to very complex applications • Often single application

– but concurrent operation• Could be real-time (hard and soft)• Program is normally stored in ROM – called

firmware – flash ROM commonly• Could be critical applications • Interfacing with other devices via peripherals• Require a range of development tools –

hardware and software• May use operating system (RTOS)

Page 29: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Constraints

• Physical size• Weight• Power usage• Performance – throughput and/or response

time• Cost

Page 30: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Resulting in -

• limited space• limited processing power

– 8-bit processor• limited memory RAM & ROM

– only Ks of memory not Ms• schemes to limit power consumption

– low power modes– sleep– standby

• determinism – needed for RT guarantee

Page 31: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Linksys Wired & Wireless Router

Page 32: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Linksys WRT54GL Router & Access point• CPU – Broadcom BCM4712KPB @ 200 MHz• RAM – 16MiBytes (2 x S42S16400 RAM Chips)• ROM – 4MiBytes (Intel TE28F320 C3 Flash ROM)• I/O

– WAN port: One 10/100 RJ-45 port– LAN port: Four 10/100 RJ-45 ports– Wi-Fi Channels: 13– LED Indicators : power, DMZ, WLAN, port 1/2/3/4,

Internet

Page 33: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microprocessor vs Microcontroller vs Soc vs FPGA

• uP – General purpose– external memory and peripherals– connected by a memory bus

• uC– uP integrated with memory and peripheral

interfaces– families of uC all with same uP but varying

amounts and types of memory and interfaces.

Page 34: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

1-34

Microcontroller (µC) vs. Microprocessor (µP)• µC intended as a single chip solution, µP requires

external support chips (memory, peripheral interfaces etc.)

• µC has on-chip non-volatile memory for program storage, µP does not.

• µC has more interface functions on-chip (serial interfaces,Analog-to-Digital conversion, timers, etc.) than µP

• General purpose µPs are typically higher performance (clock speed, data width, instruction set, cache) than µCs

• However the division between some µPs and some µCs becoming increasingly blurred.

Page 35: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

FPGA/PLD• A field-programmable gate array is a semiconductor device containing

programmable logic components called "logic blocks", and programmable interconnects.

• Logic blocks can be programmed to perform the function of basic logic gates & combinational functions such as decoders or simple mathematical functions.

• In most FPGAs, the logic blocks also include memory elements, which may be simple flip-flops or more complete blocks of memory

Page 36: Microprocessor Engineering Introduction 11/12. Microprocessor Engineering 16-7210 Alan Holloway – contact: a.f.holloway@shu.ac.uka.f.holloway@shu.ac.uk.

Microprocessor vs Microcontroller vs SoC vs FPGA

• SoC – System on a chip• FPGA – Field

Programmable Gate Array

Microcontroller-based System-on-a-Chip

Core

Rest of FPGA contains standard

logic