Вы находитесь на странице: 1из 84

The High Density Learning

HDL Solutions, Madurai

What is an Embedded system?


ASpecialpurposeComputersystemdesignedto performoneormorededicatedfunctions Realtimecomputingconstraints ItconsistsofbothHardware&Softwarewithmore functionalitytobeworkedonrealtime

Why Embedded?
Becausetheprocessorisinsidesomeothersystem. AmicroprocessorisembeddedintoyourTV,car,or appliance li Theconsumerdoesnotthinkaboutperforming processing Considersrunningamachineormakingsomething work work Consideredpartofthethingratherthanthething

How are embedded systems different than traditional software?


HardwareandSoftware(inonesystem) Concurrency(severalprocessesworkingatthesame time) i ) Timing(oftenrealtime) I Interactionwithsensorsandactuators(forinputsand i i h d (f i d outputs)

Goals
AttheconclusionofthisLecture,youshouldbe

ableto:
Recognizedifferencesbetweengeneralpurpose

computersandembeddedcomputersystems Identifymodernembeddedsystemsbytheir characteristics Discusskeyissuesofembeddedsystemdesign Discusstheembeddedsystemsdevelopment methodology

Introduction to Embedded Systems

Embedded Systems
EmbeddedSystems ThewordsEMBEDDEDandSYSTEMareboth Important p Theyinteractstrongly Ifyoufocusonone,youwillseelotsofdetail,butfail

toseetheanimal Andyoumaygetsteppedon Wildelephantsstronglyaffecttheirenvironment Theshapeoftheelephantisnotatallclear So, WhatisEmbeddedorSystem,anyway?


Introduction to Embedded Systems

Various Views of the System


SystemtoDOWHAT?,WhatisEmbeddedinit. HowdoIdesignthesystem?.HowdoIrealizethe

system? Isitallabout?
RTOS,C++,Microprocessors,MicroControllers, , , p , ,

AssemblyLanguage I/Odevices Keyboards,DisplayTechnology,ADCs/ DAC s, DACs Architectures,VONNeuman,Havard,RISC,CISC ????????manymore.


Introduction to Embedded Systems

Components
Theelephant'spartsinteract YouneedtousebothCandAssemblyLanguage RTOScontrolsboth. YouneedtodecideonanArchitectureVONNeuman, Havard,RISC,CISC H d RISC CISC Microprocessors,MicroControllersareasubsetofone oftheabove YouneedlotsofI/Odevices RealworldisANALOG
Introduction to Embedded Systems

A Computer
Thecomputeriscomposedofinputdevices,a centralprocessingunit,amemoryunitandoutput devices. devices
Input Device Input Device

Central l Processing Unit

Output Device Auxiliary Storage Device

Memory

Components of a GP Computer
MemoryAnorderedsequenceofstoragecells,each

capableofholdingapieceofdata.
Volatile MemoryRAM RandomAccessMemory Nonvolatile MemoryROM ReadOnlyMemory

CentralProcessingUnit(CPU)ithas2Components: ArithmeticandLogicUnit(ALU)performsArithmetic/ Logicaloperations ControlUnit Controlstheactionofothercomponents sothatinstructionsareexecutedinthecorrect sequence


Introduction to Embedded Systems

Components of a GP Computer
Input/Output(I/O)Devices arethecomponents

thatacceptdatatobeprocessedandpresentsthe resultsoftheprocessing
InputDeviceExamples Keyboard,Mouse OutputDeviceExamples Videodisplay,Printer

Auxiliarystoragedevice Hard/Floppydiskdrives,

Zip/Tapedrivesetc
PeripheralDevices accessoriesthatoffersome

valueaddedfeatures
Scanners,CDROM,DVD,DigitalCamerasetc. O l
Introduction to Embedded Systems

Others
InteractiveandBatchSystems Aninteractivesystemfacilitatesthedirectcommunication betweenthecomputerandthecomputeruser. betweenthecomputerandthecomputeruser Abatchsystemrequiresthatalldatabeenteredpriorto programexecutionandtheresultsareviewableonlyafterthe programhascompletedexecuting h l d i TheOperatingSystem(OS) Isasetofprogramsthatmanagesallofthecomputers Isasetofprogramsthatmanagesallofthecomputer s resources Unix,Linux,Windows98,Me,NT,2000,XPetcareall examplesofmodernoperatingsystems
Introduction to Embedded Systems

The Embedded Computer System


Definition:byWayneWolf Anysortofdevicewhichincludesaprogrammable computerbutitselfisnotintendedtobeageneralpurpose p g p p computer Thereasonfordesigningandbuildingembeddedsystems

istoobserveorcontrolsomethingintherealworld(i.e. i t b t l thi i th l ld(i analog)


Determinetheinternaltemperatureofanoven Controlthemotorspeedofarobot

Embeddedsystemsmustbeabletotranslatebetweenthe

digitalandanalogworldsinordertobeeffective
Introduction to Embedded Systems 13

Embedded System Composition


Control (Output)
System Bus

Motor/Light Temperature Sensor

Processor P

Observe (Input) (I p t)

mem

Introduction to Embedded Systems

Embedded Systems Examples


Personaldigitalassistant(PDA) Consumerelectronics(e.g.digitalcamerasandhouseholdappliances) Mobilephone Automobileengines,fuelcontrol,etc. Grocerystorecheckoutscanners GlobalPositioningSystem(GPS)units Gl b lP iti i S t (GPS) it

Telematics S Tl i System f A for Automobiles bil


Hand-held GPS Units
Introduction to Embedded Systems 15

Cruise Missile Guidance

Spider robot
Introduction to Embedded Systems

Automotive Control
Carwithanautomaticheadlightlevelingsystem. 1:ReardistanceSensor,2:Controlunit,3:Speedsignal 4:Frontdistancesensor,5:Motor,6:Lamps. Source:Gmehlich,R.,SpecificationandValidationofEmbeddedSystemsusing LUSTREandARGOS. CaseStudy:TheAutomaticHeadlightLevelingSystem, DesignAutomationforEmbeddedSystems,6,151175(2001)

Introduction to Embedded Systems

BMW 850i Brake and Stability Control


Antilockbrakesystem(ABS):pumpsbrakestoreduceskidding. Automaticstabilitycontrol(ASC+T):controlsenginetoimprovestability. ABSandASC+Tcommunicate. sensor brake ABS brake sensor


Introduction to Embedded Systems

sensor brake hydraulic pump brake sensor

Smart Toys

Introduction to Embedded Systems

Characteristics of Embedded Systems


Applicationspecificfunctionality specializedfor

oneoroneclassofapplications Deadlineconstrainedoperation systemmayhave Deadlineconstrainedoperation toperformitsfunction(s)withinspecifictimeperiods toachievesuccessfulresults Resourcechallenged systemstypicallyare configuredwithamodestsetofresourcestomeetthe performanceobjectives Powerefficient manysystemsarebatterypowered andmustconservepowertomaximizetheusablelife ofthesystem. fth t
Introduction to Embedded Systems

Characteristics of Embedded Systems


Formfactor manysystemsarelightweightandlowvolumetobeused ascomponentsinhostsystems Manufacturable usuallysmallandinexpensivetomanufacturebased onthesizeandlowcomplexityofthehardware. onthesizeandlowcomplexityofthehardware Functionalcomplexity Oftenhavetorunsophisticatedalgorithmsormultiple

algorithms. algorithms Cellphone,laserprinter. Oftenprovidesophisticateduserinterfaces.

RealtimeoperationMustfinishoperationsbydeadlines. R l ti ti M tfi i h ti b d dli


Hardrealtime: missingdeadlinecausesfailure. Softrealtime: missingdeadlineresultsindegradedperformance.

Manysystemsaremultirate:musthandleoperationsatwidelyvarying rates.
Introduction to Embedded Systems

Non-functional requirements/ Non functional Constraints


Manyembeddedsystemsaremassmarketitemsthatmust

havelowmanufacturingcosts.
Limitedmemory,microprocessorpower,etc. ted e o y, c op ocesso po e , etc.

Powerconsumptioniscriticalinbatterypowereddevices. Excessivepowerconsumptionincreasessystemcostevenin wallpowereddevices. Designteams g Oftendesignedbyasmallteamofdesigners. Oftenmustmeettightdeadlines.

6monthmarketwindowiscommon. 6monthmarketwindowiscommon
Introduction to Embedded Systems

Embedded Systems Evolution

1940

1970

1980

1990

2000

2002

time

Introduction to Embedded Systems

23

Why use microprocessors?


Alternatives:fieldprogrammablegatearrays(FPGAs),

customlogic,etc. Mi Microprocessorsareoftenveryefficient:canusesame f ffi i logictoperformmanydifferentfunctions. Microprocessorssimplifythedesignoffamiliesof products.

Introduction to Embedded Systems

Microprocessor varieties
Microcontroller: includesI/Odevices,onboard

memory. Di i l i Digitalsignalprocessor(DSP): microprocessor l (DSP) i optimizedfordigitalsignalprocessing. Typicalembeddedwordsizes:8 bit 16 bit 32 bit Typicalembeddedwordsizes:8bit,16bit,32bit.

Introduction to Embedded Systems

The performance paradox


Microprocessorsusemuchmorelogictoimplementa

functionthandoescustomlogic. P Power
Customlogicisaclearwinnerforlowpowerdevices. Modernmicroprocessorsofferfeaturestohelpcontrol

powerconsumption. Softwaredesigntechniques canhelpreducepower g q p p consumption.

Introduction to Embedded Systems

Embedded System D i E b dd d S Design

Introduction to Embedded Systems

Challenges
Howmuchhardwaredoweneed? HowbigistheCPU?Memory? Howdowemeetourdeadlines? Fasterhardwareorcleverersoftware? Howdoweminimizepower? Turnoffunnecessarylogic?Reducememoryaccesses? Doesitreallywork? Isthespecificationcorrect?/ImplementationmeetsSpecs??? Howdowetestforreal timecharacteristicswithrealdata? Howdowetestforrealtimecharacteristicswithrealdata? Howdoweworkonthesystem? Observability,controllability? Wh i Whatisourdevelopmentplatform? d l l f ?
Introduction to Embedded Systems

Design
GOALS Performance. Overallspeed,deadlines. Functionalityanduserinterface. y Manufacturingcost. Powerconsumption. Otherrequirements(physicalsize etc ) Otherrequirements(physicalsize,etc.) Methodologies Topdowndesign:
startfrommostabstractdescription;worktomostdetailed.

Bottomupdesign: workfromsmallcomponentstobigsystem. Realdesignusesbothtechniques.


Introduction to Embedded Systems

Functional vs. Non-functional requirements


Functionalrequirements: outputasafunctionofinput. Nonfunctionalrequirements: timerequiredtocomputeoutput; size,weight,etc.; i i ht t powerconsumption; reliability; etc.

Introduction to Embedded Systems

Levels of abstraction
requirements specification ifi i architecture component design system integration i i
Introduction to Embedded Systems

Microprocessor Architectures Mi A hi

Introduction to Embedded Systems

32

Computer Architecture
Thecomputerarchitectureencompassestheusers

viewofthecomputer.
Thisincludesthingssuchas, Theassemblylanguageinstructionset. y g g Thenumberandtypesofinternalregisters. Thememorymanagementsystemand Th Themodelforexceptionhandling. d lf i h dli
manymore yourperception manymore
Introduction to Embedded Systems

von Neumann architecture


Memoryholdsdata,instructions. Centralprocessingunit(CPU)fetchesinstructions

frommemory. f
SeparateCPUandmemorydistinguishes

programmablecomputer. programmablecomputer

CPUregistershelpout:programcounter(PC),

instructionregister(IR),generalpurposeregisters, g ( ) g p p g etc.

Introduction to Embedded Systems

Harvard architecture
address data d t memory data address program memory data PC CPU

Introduction to Embedded Systems

von Neumann vs. Harvard


Harvardcantuseselfmodifyingcode. Harvardallowstwosimultaneousmemoryfetches. MostDSPsuseHarvardarchitectureforstreaming

data:
greatermemorybandwidth; t b d idth morepredictablebandwidth.

Introduction to Embedded Systems

Micro-Embedded Systems
ApplicationSpecificInstructionProcessors(ASIPs) FieldProgrammableGateArrays(FPGAs) SystemonaChip(SoC) DesigningwithIntellectualProperty(IP)components

Introduction to Embedded Systems

CISC Processors
Complexinstructionsetcomputer(CISC): manyaddressingmodes; manyoperations. Instructiondecodingisperformedwithlarge

microcodeROMs Someinstructionsrequiremorethanasingle instructioncycletoexecute Manyaddressingmodessupported Registersetwasdesignedtosupportspecificfunctions g g pp p


Introduction to Embedded Systems

RISC Processors
Reducedinstructionsetcomputer(RISC): load/store; pipelinedinstructions pipelinedinstructions. Instructiondecodingisperformedwithstatic(hardwired)

logicforamuchfasterresult I Instructionsaredesignedtoexecuteinasingleinstruction i d i d i i l i i cycle Dataprocessinginstructionsoperateonlyonregisters. p g p y g Loadandstoreinstructionsweredesignatedtoaccess memory Registersetislargeandgeneralpurpose(inmanycases)


Introduction to Embedded Systems

Microcontrollers
Containsessentialfeaturestoperform: Computations I/Odeviceinterfacing Simpleandcomplexaddressing C t i Containsonchipmemory(volatileandnonvolatile) hi ( l til d l til ) Containsavarietyofbuiltinperipherals Maynotrequireoff chipperipheralstoexpandI/O MaynotrequireoffchipperipheralstoexpandI/O

capabilities(mostfunctionsarenativetothechip)

Introduction to Embedded Systems

Summary
MicroprocessorsarefastandefficientCPUsthat

requireseveralexternalcomponentstoformausable system
Microcontrollersusuallycontainsufficientonchip

resourcestoperformmanyembeddedsystem functions
MemorysystemsandI/Oareimportantfeaturesthat

mustbetakenintoaccountwhendesigningyour systems
Introduction to Embedded Systems

What you need to know about a processor as an embedded engineer?

Introduction to Embedded Systems

Processor Characteristics
Instructionsetcharacteristics Fixedvs.variablelength. Addressingmodes Addressingmodes. Numberofoperands. Typesofoperands. P Programmingmodel: i d l registersvisibletotheprogrammer. Someregistersarenotvisible(IR). g ( ) Onetoonewithinstructions(moreorless). Programmingmodel Registerfiles A AssemblyLanguage bl L
Introduction to Embedded Systems

Processor Characteristics
Addressingmodes,DataTypes Fixed/Floatingpoint,precision. 32bitintegers. PC/Stack Fl Flagoperations i Fixed/Floatingpointoperations St t bit Statusbits:negative,under/overflow,invalid,fixed ti d / fl i lid fi d pointunderflow,floatingpointunderflow,floating pointinvalid.
Introduction to Embedded Systems

Processor Characteristics
Endianness Relationshipbetweenbitandbyte/wordordering definesendianness: d fi di Instructionsetcharacteristics Fixedvs.variablelength. Addressingmodes. dd ess g odes. Numberofoperands. Typesofoperands.
Introduction to Embedded Systems 45

Processor Characteristics
MemoryOrganization
short word addressing 0x40000 normal word addressing 0x20000 interrupt t r 0 20000 i t rr pt vectors forbidden IOP registers 0x0
Introduction to Embedded Systems

256

Input / Output B i I O Basics

Introduction to Embedded Systems

47

I/ O devices
Usuallyincludessomenondigitalcomponent. TypicaldigitalinterfacetoCPU:

CPU

status reg data d reg

mechani ism

Introduction to Embedded Systems

Examples
UART Universalasynchronousreceivertransmitter Providesserialcommunication. UARTfunctionsareintegratedintostandardPC interfacechip. Allowsmanycommunicationparameterstobe programmed. ParallelPortInterface

Introduction to Embedded Systems

Programming Interface

I/OMappedDevices
TheuseofexplicitINorOUTassemblyinstructionsareused

withtheIntelmicroprocessorstodirectlycontrolanI/O mappeddevice SpecialsignalsarealsoassertedwiththeINandOUT instructions i i

MemoryMappedDevices IfallI/Odevicesarememorymapped,themethodsusedto accessandcontrolthesedevicesismadeuniform InstructionSupportdifferentforBoth


Introduction to Embedded Systems

Real Time
Busy/WaitProcessing TheCPUisfocusedonlyontheI/Oactivityofthe system t AllotherpendingactivitiesareonholduntiltheI/O activitiesareconcluded Busy/waitisveryinefficient.

CPUcantdootherworkwhiletestingdevice. HardtodosimultaneousI/O.

Introduction to Embedded Systems

Real Time
Interrupts

AllowadevicetochangetheflowofcontrolintheCPU.
Causessubroutinecalltohandledevice.

Prioritiesandvectors

Twomechanismsallowustomakeinterruptsmorespecific:
Priorities determinewhatinterruptgetsCPUfirst. p g Vectors determinewhatcodeiscalledforeachtypeofinterrupt.

Mechanismsareorthogonal:mostCPUsprovideboth. Interruptprioritization Masking:interruptwithprioritylowerthancurrentpriorityisnot recognizeduntilpendinginterruptiscomplete. Nonmaskableinterrupt (NMI):highestpriority,nevermasked. Non maskableinterrupt (NMI):highest priority,nevermasked. Oftenusedforpowerdown.
Introduction to Embedded Systems

Timers and Counters


Verysimilar: atimer isincrementedbyaperiodicsignal; acounter isincrementedbyanasynchronous, occasionalsignal. Rollovercausesinterrupt Rollovercausesinterrupt. Watchdogtimerisperiodicallyresetbysystemtimer. Ifwatchdogisnotreset itgeneratesaninterruptto Ifwatchdogisnotreset,itgeneratesaninterruptto resetthehost Thisisveryimportantfortimecriticalembedded systems.
Introduction to Embedded Systems

Interfacing
Switchdebouncing Aswitchmustbedebouncedtomultiplecontacts causedbyeliminatemechanicalbouncing: db li i h i lb i KeyboardDecoding
Output Signal

Input Signal
Introduction to Embedded Systems 54

Interfacing
LEDMustuseresistortolimitcurrent: 7segmentLEDdisplayMayuseparallelormultiplexed

input.
Highresolutiondisplays Cathoderaytube(CRT) Liquidcrystaldisplay(LCD) Plasma,etc. , Touchscreen

Ou pu Output Port

Includesinputandoutputdevice. Inputdeviceisatwo dimensionalvoltmeter: Inputdeviceisatwodimensionalvoltmeter:

Introduction to Embedded Systems

Interfacing
DigitaltoAnalogConversion(DAC) AnalogtoDigitalConversion(ADC) FlashA/Dconversionthefastest S SampleandholdRequiredinanyA/D: l d h ldR i di A/D
Vin converter

Introduction to Embedded Systems

The Embedded System Platform


Architecturesandcomponents: software; hardware. Debugging. M Manufacturingtesting. f i i

Introduction to Embedded Systems

Hardware and software architectures


Hardwareandsoftwareareintimatelyrelated: softwaredoesntrunwithouthardware; howmuchhardwareyouneedisdeterminedbythe softwarerequirements:
speed; d memory.

Introduction to Embedded Systems

Hardware and Software architectures


Hardwareplatformarchitecture Containsseveralelements:
CPU b CPU;bus;memory; I/Odevices:networking,sensors,actuators,etc.

Howbig/fastmucheachonebe?

Softwarearchitecture Functionaldescriptionmustbebrokenintopieces: ld b b k
divisionamongpeople;conceptualorganization;

p performance;testability;maintenance. ; y;
Introduction to Embedded Systems

Software design techniques


Wanttodevelopasmuchcodeaspossibleona

standardplatform:
f i dli friendlierprogrammingenvironment; i i easierdebugging.

Mayneedtodevisesoftwarestubstoallowtestingof

softwareelementswithoutthefullhardware/software p platform.

Introduction to Embedded Systems

Host/Target design
Useahostsystemtopreparesoftwarefortarget

system:

target system host system serial line

Introduction to Embedded Systems

Design Tools
Hostbasedtools Crosscompiler:
compilescodeonhostfortargetsystem. p g y

Crossdebugger: displaystargetstate,allowstargetsystemtobecontrolled.

Evaluationboards DesignedbyCPUmanufacturerorothers. IncludesCPU,memory,someI/Odevices. M i l d Mayincludeprototypingsection. t t i ti CPUmanufactureroftengivesoutevaluationboardnetlist whichcanbeusedasstartingpointforyourcustomboard design. d i


Introduction to Embedded Systems

Adding logic to a board


Programmablelogicdevices(PLDs)provide

low/mediumdensitylogic. Fi ld Fieldprogrammablegatearrays(FPGAs)provide bl (FPGA ) id morelogicandmultilevellogic. Application specificintegratedcircuits(ASICs)are Applicationspecificintegratedcircuits(ASICs)are manufacturedforasinglepurpose.

Introduction to Embedded Systems

Software Elements
Bootup; Minimaldevicedrivers. BIOShasbecomeagenerictermforthelowestlevel

systemsoftware.

Introduction to Embedded Systems

Debugging embedded systems

Challenges: targetsystemmaybehardtoobserve; targetemaybehardtocontrol; maybhardtogeneraterealisticinputs; setupsequencemaybecomplex. Softwaredebuggers Amonitorprogramresidingonthetargetprovidesbasicdebugger functions. Debuggershouldhaveaminimalfootprintinmemory. Userprogrammustbecarefulnottodestroydebuggerprogram,but, shouldbeabletorecoverfromsomedamagecausedbyusercode. shouldbeabletorecoverfromsomedamagecausedbyusercode Breakpoints Abreakpointallowstheusertostopexecution,examinesystemstate, andchangestate.

Introduction to Embedded Systems

Debugging Tools
Incircuitemulators Amicroprocessorincircuitemulatorisaspecially instrumentedmicroprocessor. i t t d i Allowsyoutostopexecution,examineCPUstate, modifyregisters. y g Logicanalyzers Alogicanalyzerisanarrayoflowgradeoscilloscopes:

Introduction to Embedded Systems

How to exercise code


Runonhostsystem. Runontargetsystem. Runininstructionlevelsimulator. Runoncycleaccuratesimulator. Runinhardware/softwarecosimulation

environment.

Introduction to Embedded Systems

Compiler Support for Embedded Systems

Introduction to Embedded Systems

Structure of a Compiler

Frontend
Parsing Machineindependentoptimizations

Backend B k d
Machinedependentoptimizations Registerallocation InstructionScheduling

Introduction to Embedded Systems

Program design and analysis for Embedded Systems


Optimizingforexecutiontime. Motivation
Embeddedsystemsmustoftenmeetdeadlines.

Fastermaynotbefastenough. Worstcase,nottypical.

Needtobeabletoanalyzeexecutiontime Needtobeabletoanalyzeexecutiontime.

Needtechniquesforreliablyimprovingexecutiontime. q y p g

Introduction to Embedded Systems

Energy/ Power optimization


Energy:abilitytodowork.
Mostimportantinbatterypoweredsystems.

Power:energyperunittime.
Importanteveninwall plugsystems powerbecomesheat Importanteveninwallplugsystemspowerbecomesheat.

P=FCV2

CapacitiveLoad
Loadfixedinhardware Externaldevicespresenthigherloads Minimizeaccessestoexternalmemory Usecodeprofilingtoidentifyfrequentlyexecutedtracesandmovetointernal PROM Maximizeutilizationofonchipregisters Avoidcachemisses Penaltyoffillinganentirecacheline BewareofwritepolicyWritethroughaccessesexternalmemoryonevery write i

Introduction to Embedded Systems

Design for Power Efficiency


Useoptimizedalgorithmsandcompilers Shorterdynamicrunlengthresultsinfewergates switching it hi Useclockgatingtodisablefunctionalunitsthatare

notneededforthecurrentinstruction BitcorrelationNumberofgatesswitchingisa functionofthepreviousstateandthecurrentinputs p p Asynchronousdesign


Independentlyclockeachfunctionalunit

Introduction to Embedded Systems

Design for Power Efficiency


ClockFrequency Unlessidletimedominates,clockfrequencyis detrimentaltoenergyefficiency d ti t lt ffi i Clockfrequencyreductionisbeneficialduringidle p periods Manyprocessorshaveasleepmodeavailabletoreduce ordisabletheclockduringidleperiods Bewareofthetransitionpenalty

Introduction to Embedded Systems

Considerations
Whichtechniquesareappropriateforincorporationintoa

compiler?
CodeOptimization Code Opt at o ClockGating VoltageScaling BitCorrelation Memorypowerconsumption

Whatotherbenefitscanbederivedfromthese

techniques?
Heatandcomponentreliability EMInoisereduction

Introduction to Embedded Systems

Cache behavior is important


Energyconsumptionhasasweetspotascachesize

changes:
cachetoosmall:programthrashes,burningenergyon cac e too s a : p og a t as es, bu g e e gy o

externalmemoryaccesses; cachetoolarge:cacheitselfburnstoomuchpower.Do numberofaccessestocachematter?

Morepowerconsumedwhenfullaccesstodatacacheas

opposedtonoaccess Doesvalueaccessedfromcachematter?
Implementationdetailsofcacheplayrole Savingsduetolessswitchingareperceptiblebutnot

significant f
Introduction to Embedded Systems

Optimizing for energy


Firstorderoptimization: highperformance=lowenergy. Notman instructionstradespeedforenerg Notmanyinstructionstradespeedforenergy. Useregistersefficiently. Identifyandeliminatecacheconflicts Identifyandeliminatecacheconflicts. Moderateloopunrollingeliminatessomeloop

overheadinstructions. Eliminatepipelinestalls. Inliningproceduresmayhelp:reduceslinkage,but mayincreasecachethrashing. mayincreasecachethrashing


Introduction to Embedded Systems

Key Insights: Literature


Doesreductioninswitchingactivityreducepower? Comparecode(a)minimalswitchingand(b)maximalswitching MeasureHammingdistance(num.Ofbitflipsbetweentwo values)toestimatemeasureofswitching Wasseenthattherewasnonoticeableimprovementinenergyor powersavings DoalltypeofALUinstructionsconsumesameamountofpower

Rundifferenttypeofinstructionsandcollectpowernumbers Observedthatadd/subtakemuchlessthanmultiply Trytoreplacemultiplyinstructionswithseriesofadditionsand

shifts(strengthreduction) However,caremustbetakensincetimepenaltyincurredcanoffset savingsinenergy!


Introduction to Embedded Systems

Key Insights: Registers


Doesnumberofaccessestoregisterfileplayarolein

powerconsumption?
C Comparecode(a)accessingvaluesfromregistersand d ( ) i l f i d

(b)immediateoperands Measurementsshowednosignificantdifference

Doesvalueaccessedaffectpower? Themoretheswitchingofthevalueintheregisterfile, g g , themorepowerconsumed Sotrytominimizeswitchinginregisterfileaccesses

Introduction to Embedded Systems

Key Insights: Memory


Donumberofaccessestomemorymatter Majorimpactontimingandthereforeenergy Doeslocationinmemoryplayarole? Effectonnumberofmemorymodulesthatneedtobe active active Placingdataintomemorycanbeusedtoswitch memorymodulesonoroffandhavebigsavingsin power

Introduction to Embedded Systems

Optimizing for Program Size


Goal: reducehardwarecostofmemory; reducepowerconsumptionofmemoryunits reducepowerconsumptionofmemoryunits. Twoopportunities: Data,Instructions. DatasizeminimizationReuseconstants,variables,data bl d

buffersindifferentpartsofcode.
Requirescarefulverificationofcorrectness. q

Generatedatausinginstructions. Mayneedtolimitamountofoptimization E Exampleofloopunrolling l fl lli


Introduction to Embedded Systems

Reducing code size


Avoidfunctioninlining. ChooseCPUwithcompactinstructions. Usespecializedinstructionswherepossible. Codecompression Usestatisticalcompressiontoreducecodesize, decompressonthefly:

Introduction to Embedded Systems

The Big Picture


Partitioned Source High-level Optimizations (parallelism)

Intermediate Representation
To (ILP) processor Core

Memory/Cache Optimizations p

Compiler ILP Optimizations Scheduler


Code Generation Performance Feedback
Introduction to Embedded Systems

ILP Architecture/HW CCE RLA Core

Visit us at
ANNA NAGAR MAIN ROAD SUGUNA STORES JUNCTION 80 FEE ROAD ET BUS TERMINUS BAN NK O OF IND DIA AMBIKA THEATRE

HDL SOLUTONS
19A, Pandian Complex, 9th North Cross Street, (Opp. to Ambika Theatre Road), Anna Nagar, Madurai 625020 Ph: +91-452-4375502, 909 505 1010, Email: training@hdl.co.in, Website: www.hdl.co.in

Вам также может понравиться