Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 67

Chapter 4: The Embedded Computing Platform

Computer as Components
Embedded Systems Laboratory Dept. of Computer Science & Engineering National Sun Yat-Sen University

Presenter: Chung-Fu Kao

Chapter view

CPU bus, I/O devices, and interfacing The CPU system as a framework for understanding design methodology Development environments and debugging

An alarm clock design

2
4/9/2002 The Embedded Computing System C.-F. Kao

Typical PC hardware platform

CPU

memory CPU bus bus interface device high-speed bus low-speed bus device

intr ctrl

DMA controller

timers

bus interface
3
4/9/2002 The Embedded Computing System C.-F. Kao

Introduction

Computer platform
Microprocessors I/O devices Memory

How to interconnect microprocessors and devices using the CPU bus


device keyboard display memory

CPU
4
4/9/2002

device
device

The Embedded Computing System C.-F. Kao

The CPU bus

Wire vs. bus


Wire: a 1-bit line between two devices

wire

bus

Bus: a collection of wires with a protocol


5
4/9/2002 The Embedded Computing System C.-F. Kao

Bus protocol

The simplest bus protocol is the four-cycle handshake

enq 1 3

data

ack

Action
time
The Embedded Computing System C.-F. Kao

6
4/9/2002

Typical bus signals

Clock
provides synchronization to the bus components

R/W
true when bus is reading

Address
a n1-bit bundle

Data
a n2-bit bundle

Data ready
The Embedded Computing System C.-F. Kao

7
4/9/2002

A typical microprocessor bus

the CPU can read/write devices or memory, bus devices of memory cannot initiate a transfer
Device 1 Device 1

CPU
memory
8
4/9/2002 The Embedded Computing System C.-F. Kao

clock R/W data rdy address data

Timing diagrams

one A rising

zero

falling

10 ns stable

changing

Timing constraint C
time
9
4/9/2002 The Embedded Computing System C.-F. Kao

A simple transfer example

10
4/9/2002 The Embedded Computing System C.-F. Kao

Transfer with wait states

11
4/9/2002 The Embedded Computing System C.-F. Kao

State diagrams for the bus read transaction

Get data

Done

Send data

Release ack

See ack

(start here)

Address

ack

(start here)

Address

Wait

Wait

CPU
12
4/9/2002 The Embedded Computing System C.-F. Kao

Device

Bus read state diagram


Get data Done
one data send/receive per transfer cycle

See ack

(start here)

Address

How to speedup the transfer ? Wait


13
4/9/2002 The Embedded Computing System C.-F. Kao

Burst transfer

14
4/9/2002 The Embedded Computing System C.-F. Kao

Bus architectures: Tri-state design

1-bit tri-state design data_out data_in

enable

tri_out

System tri-state bus


The Embedded Computing System C.-F. Kao

15
4/9/2002

Bus architectures: Multiplexing design


Master(s)

AREQx1 AREQx2 AREQx3

AGNTx1 AGNTx2

Data (W) MUX Address MUX Control MUX

Data (R) MUX

BTRAN[1:0] BA[31:0 BWRITE BSIZE[1:0] BPROT[1:0]

DSEL 1 DSEL 2 DSEL n BWAIT

BLOK BWAIT BnRES/ BCLK

ASB Arbiter

AGNTx3

Response MUX

ASB Decoder

BERROR

select

BnRES/ BCLK

BLAST

Select-1 Select-2

Address bus Data bus Control (write, transfer type, size)


16
4/9/2002

[31:28]

Decoder

Slave(s)
Response (wait, last, error)

End of Chapter 4.2.1


The Embedded Computing System C.-F. Kao

I/O techniques

Programmed I/O
data are exchanged between CPU and I/O
CPU must wait until the I/O operation is complete

Interrupt-driven I/O
CPU can continues to execute other instructions

before I/O operation has completed

Direct Memory Access (DMA)


CPU does not involve the I/O transfer

17
4/9/2002 The Embedded Computing System C.-F. Kao

DMA: Direct Memory Access

The DMA controller includes 3 registers


a starting address register
a length register a status register
Data count
Data register Address register

Cycle stealing

DMA REQ DMA ACK INTR Read Write

Control Logic

18
4/9/2002 The Embedded Computing System C.-F. Kao

Possible DMA configuration


CPU
module

DMA

I/O

. . .

I/O

MEM

(a) Single-Bus, Detached DMA

CPU

module

DMA I/O

module

DMA

MEM

I/O

I/O

(b) Single-Bus, Integrated DMA-I/O System bus CPU DMA MEM I/O bus I/O
19
4/9/2002

module

I/O
The Embedded Computing System C.-F. Kao (c) I/O bus

I/O

Bus example: ARM bus

ARM supports an on-chip bus: AMBA


Advanced Microcontroller Bus Architecture
Arbiter BIU: Bus Interface Unit Other APB slaves Slave BIU APB Bridge On-chip RAM Slave BIU
The Embedded Computing System C.-F. Kao

CPU
Master BIU

AHB/ASB BUS

Master N Master BIU

Timer
Slave BIU

APB BUS Interrupt Controller

Decoder
20
4/9/2002

LED
Slave BIU

AMBA features

Pipelining
only AHB or ASB

Burst transfers
1, 4, 8, 16-beat transfer

Split transactions
release the current transfer

Multiple bus masters

21
4/9/2002 The Embedded Computing System C.-F. Kao

Bus components devices


Arbiter
BIU: Bus Interface Unit

CPU
Master BIU

AHB/ASB BUS

Master N Master BIU APB Bridge On-chip RAM Slave BIU

Other APB slaves Slave BIU


APB BUS Interrupt Controller

Timer
Slave BIU

Decoder

LED
Slave BIU

22
4/9/2002 The Embedded Computing System C.-F. Kao

Memory device organization

The most basic way to characterize a memory is by its capacity A 4-Mbit memory aspect ratio :
as a 1M x 4-bit array, MAX of 2
20

addresses 22 as a 4M x 1-bit array, MAX of 2 different addresses

different

23
4/9/2002 The Embedded Computing System C.-F. Kao

Random-Access Memories (RAMs)

There are two major categories of RAM:


static RAM (SRAM)
dynamic RAM (DRAM)

The differences between SRAM and DRAM


SRAM is faster than DRAM SRAM consumes more power than DRAM more DRAM can be put on a single chip DRAM values must be periodically refreshed

24
4/9/2002 The Embedded Computing System C.-F. Kao

SRAM

SRAM doesnt need CLOCK signal Block diagram 15


address chip select

SRAM
8 8

output enable
write enable

32K x 8

Data_out

Timing diagram
CS R/W Adrs Data

Data_in

From SRAM
The Embedded Computing System C.-F. Kao

From CPU

25
4/9/2002

DRAM

Single transistor and capacitor per bit


address chip select output enable

15

DRAM

Data_out

write enable Data_in 8

CPU address bus is split into a row and a column address NO clock Refreshed
CAS-before-RAS refresh

26
4/9/2002 The Embedded Computing System C.-F. Kao

Other DRAMs

FPM DRAM
fast page mode switch (burst)

EDO DRAM
extended data out

SDRAM
synchronous DRAM

27
4/9/2002 The Embedded Computing System C.-F. Kao

Read-Only Memories (ROMs)


Read only, cannot write any data to ROMs ROMs can store data without any power ROM size
height: n input line, consists 2 addressable
n

entries width: the number of bits in each addressable entry

A ROM can encode a collection of logic functions directly from the truth table
The Embedded Computing System C.-F. Kao

28
4/9/2002

ROMs

Mask ROM Programmable ROM (PROM)


write once

Erasable Programmable ROM (EPROM)


can be erased using UV light and then

reprogrammed

Electrically Erasable Programmable ROM


using high voltages for erasure and

reprogramming

29
4/9/2002

Flash ROM
The Embedded Computing System C.-F. Kao

I/O devices

Timers / counters A/D and D/A converters Keyboards LEDs Displays Touchscreens

30
4/9/2002 The Embedded Computing System C.-F. Kao

Timers and counters

Very similar:
a timer is incremented by a periodic signal
a counter is incremented by an asynchronous,

occasional signal

Rollover causes interrupt

31
4/9/2002 The Embedded Computing System C.-F. Kao

Watchdog timer

Watchdog timer is periodically reset by system timer If watchdog is not reset, it generates an interrupt to reset the host (CPU) reset

time-out

CPU

Watchdog Timer

32
4/9/2002 The Embedded Computing System C.-F. Kao

A/D and D/A converters

Analog/digital (A/D) or digital/analog (D/A) converters (ADC/DAC) To interface non-digital devices to embedded systems A typical A/D interface has two major digital inputs
a data port a clock input

33
4/9/2002 The Embedded Computing System C.-F. Kao

DAC

34
4/9/2002 The Embedded Computing System C.-F. Kao

ADC

35
4/9/2002 The Embedded Computing System C.-F. Kao

Keyboards

Switch de-bouncing

Encoded keyboard
An array of switches is read by an encoder

row

36
4/9/2002 The Embedded Computing System C.-F. Kao

LEDs

Light-emitting diodes (LEDs)


+

+5 V

Anode (+) Cathode (-)

37
4/9/2002 The Embedded Computing System C.-F. Kao

Displays

Common use: 7-segment LCD display

Other high-resolution displays


cathode ray tube (CRT)
liquid crystal display (LCD) passive matrix active matrix

38
4/9/2002 The Embedded Computing System C.-F. Kao

Touchscreens

Includes input and output device Input device is a two-dimensional voltmeter

X
39
4/9/2002 The Embedded Computing System C.-F. Kao

Touchscreen position sensing

Push
ADC conductive sheets

voltage

spacer ball

40
4/9/2002 The Embedded Computing System C.-F. Kao

end of chapter 4.5

Design with microprocessors

System architecture Hardware design

The PC as a platform
Debugging Manufacturing testing
The Embedded Computing System C.-F. Kao

41
4/9/2002

System architecture Hardware

Hardware elements
CPU
bus memory I/O devices: networking, sensors, etc.

42
4/9/2002 The Embedded Computing System C.-F. Kao

System architecture Software

Functional description must be broken into pieces:


conceptual organization performance testability maintenance

Consider the H/W-S/W trade-off


using DMA to move data rather than a

programmed loop

43
4/9/2002 The Embedded Computing System C.-F. Kao

Hardware design

Hardware: evaluation board Software:


cross compiler:
compiles code on host for target system.

cross debugger:
displays target state, allows target system to be controlled.

target system host system serial line

44
4/9/2002

The Embedded Computing System C.-F. Kao

Evaluation board

45
4/9/2002 The Embedded Computing System C.-F. Kao

The PC as a platform

Advantages:
cheap and easy to get
rich and familiar software environment

Disadvantages:
requires a lot of hardware resources not well-adapted to real-time high power consumption

46
4/9/2002 The Embedded Computing System C.-F. Kao

Typical PC hardware platform

CPU

memory CPU bus bus interface device high-speed bus low-speed bus device

intr ctrl

DMA controller

timers

bus interface

47
4/9/2002 The Embedded Computing System C.-F. Kao

Typical busses

ISA (Industry Standard Architecture)


original IBM PC bus, low-speed by todays

standard.

PCI (Peripheral Component Interconnect)


standard for high-speed interfacing 33 or 66 MHz.

USB (Universal Serial Bus), IEEE 1394 (Firewire)


relatively low-cost serial interface with high speed.

48
4/9/2002 The Embedded Computing System C.-F. Kao

Software elements

IBM PC uses BIOS (Basic I/O System) to implement low-level functions:


boot-up minimal device drivers

BIOS has become a generic term for the lowestlevel system software

49
4/9/2002 The Embedded Computing System C.-F. Kao

Debugging embedded systems

Challenges:
target system may be hard to observe
target may be hard to control may be hard to generate realistic inputs setup sequence may be complex

50
4/9/2002 The Embedded Computing System C.-F. Kao

Software debuggers

A monitor program residing on the target provides basic debugger functions Debugger should have a minimal footprint in memory User program must be careful not to destroy debugger program, but , should be able to recover from some damage caused by user code

51
4/9/2002 The Embedded Computing System C.-F. Kao

Breakpoints

A breakpoint allows the user to stop execution, examine system state, and change state Replace the breakpointed instruction with a subroutine call to the monitor program

52
4/9/2002 The Embedded Computing System C.-F. Kao

ARM breakpoints

0x400 0x404 0x408 0x40c

MUL r4,r6,r6 ADD r2,r2,r4 ADD r0,r0,#1 B loop

0x400 0x404 0x408 0x40c

MUL r4,r6,r6 ADD r2,r2,r4 ADD r0,r0,#1 BL bkpoint

uninstrumented code

code with breakpoint

53
4/9/2002 The Embedded Computing System C.-F. Kao

Breakpoint handler actions


Save registers Allow user to examine machine Before returning, restore system state
safest way to execute the instruction is to replace

it and execute in place put another breakpoint after the replaced breakpoint to allow restoring the original breakpoint (pp. 222-223)

54
4/9/2002 The Embedded Computing System C.-F. Kao

In-circuit emulators

A microprocessor in-circuit emulator is a specially-instrumented microprocessor Allows you to stop execution, examine CPU state, modify registers

55
4/9/2002 The Embedded Computing System C.-F. Kao

Logic analyzers

A logic analyzer is an array of low-grade oscilloscopes:

56
4/9/2002 The Embedded Computing System C.-F. Kao

Manufacturing testing

Goal: ensure that manufacturing produces defect-free copies of the design Can test by comparing unit being tested to the expected behavior
but running tests is expensive

Maximize confidence while minimizing testing cost

57
4/9/2002 The Embedded Computing System C.-F. Kao

Testing concepts

Yield: proportion of manufactured systems that work


proper manufacturing maximizes yield proper testing accurately estimates yield

Field return: defective unit that leaves the factory.

58
4/9/2002 The Embedded Computing System C.-F. Kao

Faults

Manufacturing problems can be caused by many thing Fault model: model that predicts effects of a particular type of fault Fault coverage: proportion of possible faults found by a set of test
having a fault model allows us to determine fault

coverage

59
4/9/2002 The Embedded Computing System C.-F. Kao

Software vs. hardware testing

When testing code, we have no fault model


we verify the implementation, not the

manufacturing simple tests work well to verify software manufacturing

Hardware requires manufacturing tests in addition to implementation verification

60
4/9/2002 The Embedded Computing System C.-F. Kao

Hardware fault models

Stuck-at 0/1 fault model:


output of gate is always 0/1

01

61
4/9/2002 The Embedded Computing System C.-F. Kao

Combinational testing

Every gate can be stuck-at-0, stuck-at-1 Usually test for single stuck-at-faults
one fault at a time multiple faults can mask each other

We can generate a test for a gate by:


controlling the gates input

observing the gates output through other gates

62
4/9/2002 The Embedded Computing System C.-F. Kao

Sequential testing

A state machine is combinational logic + registers Sequential testing is considerably harder


a single stuck-at fault affects the machine on

every cycle fault behavior on one cycle can be masked by same fault on other cycles

63
4/9/2002 The Embedded Computing System C.-F. Kao

Scan chains

A scannable register operates in two modes:


normal
scan forms an element in a shift register

64
4/9/2002 The Embedded Computing System C.-F. Kao

Scan chain cell

Input pin

Scan output

EXTEST INTEST

SEL

MUX
scan
SEL

Input signal to logic

MUX
Shift clock

BSR
Update clock

PDR

Scan input

65
4/9/2002 The Embedded Computing System C.-F. Kao

Boundary scan

IEEE Std. 1149.1 JTAG boundary scan


Serial data in

Serial data out


Serial test interconnect
66
4/9/2002 The Embedded Computing System C.-F. Kao

System interconnect

Embedded ICE
Microprocessor Core
mode external debug clock

address

data

Interface
breakpoint

ICE

Breakpoint Scan Register

BDU

Bypass Register

Select Unit Instruction Register Decode Logic

MUX

TDO

TDI

TMS TCK
67
4/9/2002

TAP Controller

The Embedded Computing System C.-F. Kao

You might also like