52
© 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors Architectures and components: software; hardware. Debugging. Manufacturing testing.

© 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

Embed Size (px)

Citation preview

Page 1: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Designing with microprocessors

Architectures and components: software; hardware.

Debugging.Manufacturing testing.

Page 2: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Hardware platform architecture

Contains several elements:CPU;bus;memory;I/O devices: networking, sensors,

actuators, etc.How big/fast much each one be?

Page 3: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 4: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Typical PC hardware platform

CPU

CPU bus

memory

DMAcontroller

timers

businterface

bus

inte

rfac

e

high-speed bus

low-speed bus

device

device

intrctrl

Page 5: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Typical busses

ISA (Industry Standard Architecture): original IBM PC bus, low-speed by today’s standard.

PCI: standard for high-speed interfacing 33 or 66 MHz.

USB (Universal Serial Bus), Firewire: relatively low-cost serial interface with high speed.

Page 6: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

PC platform software

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 lowest-level system software.

Page 7: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Example: StrongARM

StrongARM system includes: CPU chip (3.686 MHz clock) system control module (32.768 kHz

clock).• Real-time clock;• operating system timer• general-purpose I/O;• interrupt controller;• power manager controller;• reset controller.

Page 8: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Pros and cons

Plentiful hardware options.Simple programming semantics.Good software development

environments.Performance-limited.

Page 9: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Apple Newton hardware architecture

ARM 610 ROM RAM

RuntASIC

LCD

speaker

serial I/F

A/D

tablet

PCMCIA

infrared

Design Automation for Embedded Systems

Page 10: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Motorola Envoy hardware architecture

PCMCIA 1 MB DRAM 4 MB flash

AstrosystemASIC

68439CPU

audio

modem

infrared

power supply

A/Dtouchscreen

Magicbus

Design Automation for Embedded Systems

Page 11: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

InfoPad hardware architecture

Wireless networkinterface

Speechcodec

Videodecompressor

ARM 60

display

Keyboard/pointer

other I/O

IEEE Trans. Computers

Page 12: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Hardware vs. software

Special-purpose hardware often consumes much less power.

Need to think about communication between units, multiprocessing.

Accelerators often require limits on parameters. May be OK if standards limit

parameters.

Page 13: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Philips set-top box hardware architecture

Networkinterface

MPEGdemux

MPEGaudio

MPEGvideo

NTSCCD-I

graphicsPCMCIA

DRAM

I/O

NVRAM

DRAM

DRAM

Philips journal

Page 14: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Viper set-top-box chip

MIPS Trimedia

Off-chip SDRAM

bridge bridge

devices devices

Page 15: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

TI Open Multimedia Applications Platform

Dual-processor shared memory system:

GPPOS

DSPmanager

General-purposeprocessor

DSP

DSPOS

DSPtask

& I/Octrl

bridge

Memctrl

external memory

http://www.ti.com/sc/docs/apps/wireless/omap/overview.htm

Page 16: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Agere StarPro platform

http://www.lucent.com/micro/starpro/arch.html

Page 17: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

C-Port C5 network processor

HDLCengine

HDLCengine

Memoryctrl

… (16 total)

to mem

toframer

600 Mbps

RISCexecutivecontroller

fabricprocessor

to ATM

otherchannel processors

http://www.cportcorp.com/products/digital.htm

Page 18: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Hardware and software architectures

Hardware and software are intimately related:

software doesn’t run without hardware;how much hardware you need is

determined by the software requirements: speed; memory.

Page 19: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Software architecture

Functional description must be broken into pieces:

division among people;conceptual organization;performance;testability;maintenance.

Page 20: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Software components

Need to break the design up into pieces to be able to write the code.

Some component designs come up often.

A design pattern is a generic description of a component that can be customized and used in different circumstances.

Page 21: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Software state machine

State machine keeps internal state as a variable, changes state based on inputs.

Uses: control-dominated code; reactive systems.

Page 22: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

State machine specification

A B

C D

in1=1/x=a

in1=0/x=b

r=0/out2=1

r=1/out1=0

s=1/out1=1

s=0/out1=0

Page 23: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

C code structure

Current state is kept in a variable.State table is implemented as a

switch. Cases define states. States can test inputs.

Switch is repeatedly evaluated in a while loop.

Page 24: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

C state machine structure

while (TRUE) {

switch (state) {

case state1: …

}

}

Page 25: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

C state table

switch (state) {case A: if (in1==1) { x = a; state = B; } else { x = b; state = D; }break;

case B: if (r==0) { out2 = 1; state = B; } else { out1 = 0; state = C; }break;

case C: if (s==0) { out1 = 0; state = C; } else { out1 = 1; state = D; }break;

Page 26: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Data stream

Commonly used in signal processing: new data constantly arrives; each datum has a limited lifetime.

Use a circular buffer to hold the data stream.

d1 d2 d3 d4 d5 d6 d7

time ttime t+1

Page 27: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Circular buffers

Indexes locate currently used data, current input data:

d1

d2

d3

d4

time t1

use

input d5

d2

d3

d4

time t1+1

use

input

Page 28: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

C circular buffer

To compute FIR filter value f:

for (f=0, ic=0, ibuff = circ_buff_head;

ic < N;

ibuff = (ibuff = N-1 ? 0 : ibuff++) )

f = f + c[ic] * circ_buff[ibuff]

Page 29: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Software design techniques

Want to develop as much code as possible on a standard platform: friendlier programming environment; easier debugging.

May need to devise software stubs to allow testing of software elements without the full hardware/software platform.

Page 30: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Host/target design

Use a host system to prepare software for target system:

targetsystem

host systemserial line

Page 31: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Host-based tools

Cross compiler: compiles code on host for target

system.Cross debugger:

displays target state, allows target system to be controlled.

Page 32: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Evaluation boards

Designed by CPU manufacturer or others.Includes CPU, memory, some I/O devices.May include prototyping section.CPU manufacturer often gives out

evaluation board netlist---can be used as starting point for your custom board design.

Page 33: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Adding logic to a board

Programmable logic devices (PLDs) provide low/medium density logic.

Field-programmable gate arrays (FPGAs) provide more logic and multi-level logic.

Application-specific integrated circuits (ASICs) are manufactured for a single purpose.

Page 34: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 35: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 36: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 37: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

ARM breakpoints

0x400 MUL r4,r6,r60x404 ADD r2,r2,r40x408 ADD r0,r0,#10x40c B loop

uninstrumented code

0x400 MUL r4,r6,r60x404 ADD r2,r2,r40x408 ADD r0,r0,#10x40c BL bkpoint

code with breakpoint

Page 38: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 39: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

In-circuit emulators

A microprocessor in-circuit emulator is a specially-instrumented microprocessor.

Allows you to stop execution, examine CPU state, modify registers.

Page 40: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Logic analyzers

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

Page 41: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Logic analyzer architecture

UUT samplememory

microprocessor

controller

system clock

clockgen

state ortiming mode

vectoraddress

displaykeypad

Page 42: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

How to exercise code

Run on host system.Run on target system.Run in instruction-level simulator.Run on cycle-accurate simulator.Run in hardware/software co-

simulation environment.

Page 43: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 44: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 45: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 46: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Software vs. hardware testing

When testing code, we have no fault model. We verify the implementation, not the

manufacturing. Simple tests (e.g., ECC) work well to verify

software manufacturing.Hardware requires manufacturing tests

in addition to implementation verification.

Page 47: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Hardware fault models

Stuck-at 0/1 fault model: output of gate is always 0/1.

0 01 0

Page 48: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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 gate’s input; observing the gate’s output through other

gates.

Page 49: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

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.

Page 50: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Scan chains

A scannable register operates in two modes: normal; scan---forms an element in a shift register.

Using scan chains reduces sequential testing to combinational testing. Unloading/unloading scan chain is slow. May use partial scan.

Page 51: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Test generation

Automatic test pattern generation (ATPG) programs: produce a set of tests given the logic structure.

Some faults may not be testable---redundant. Timeout on a fault may mean hard-to-

test or untestable.

Page 52: © 2000 Morgan Kaufman Overheads for Computers as Components Designing with microprocessors zArchitectures and components: ysoftware; yhardware. zDebugging

© 2000 Morgan Kaufman

Overheads for Computers as Components

Boundary scan

Simplifies testing of multiple chips on a board. Registers on pins can be configured as a

scan chain.