Table Of ContentDEDICATED
DIGITAL
PROCESSORS
DedicatedDigitalProcessors:MethodsinHardware/SoftwareSystemDesign. F.Mayer-Lindenberg
(cid:4)C 2004JohnWiley&Sons,Ltd ISBNs:0-470-84444-2
DEDICATED
DIGITAL
PROCESSORS
Methods in Hardware/Software System Design
F. Mayer-Lindenberg
TechnicalUniversityofHamburg-Harburg,Germany
Copyright(cid:2)C 2004 JohnWiley&SonsLtd,TheAtrium,SouthernGate,Chichester,
WestSussexPO198SQ,England
Telephone (+44)1243779777
Email(forordersandcustomerserviceenquiries):cs-books@wiley.co.uk
VisitourHomePageonwww.wileyeurope.comorwww.wiley.com
AllRightsReserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem
ortransmittedinanyformorbyanymeans,electronic,mechanical,photocopying,recording,
scanningorotherwise,exceptunderthetermsoftheCopyright,DesignsandPatentsAct1988
orunderthetermsofalicenceissuedbytheCopyrightLicensingAgencyLtd,90Tottenham
CourtRoad,LondonW1T4LP,UK,withoutthepermissioninwritingofthePublisher.
RequeststothePublishershouldbeaddressedtothePermissionsDepartment,JohnWiley&
SonsLtd,TheAtrium,SouthernGate,Chichester,WestSussexPO198SQ,England,oremailed
topermreq@wiley.co.uk,orfaxedto(+44)1243770620.
Thispublicationisdesignedtoprovideaccurateandauthoritativeinformationinregardto
thesubjectmattercovered.ItissoldontheunderstandingthatthePublisherisnotengaged
inrenderingprofessionalservices.Ifprofessionaladviceorotherexpertassistanceis
required,theservicesofacompetentprofessionalshouldbesought.
OtherWileyEditorialOffices
JohnWiley&SonsInc.,111RiverStreet,Hoboken,NJ07030,USA
Jossey-Bass,989MarketStreet,SanFrancisco,CA94103-1741,USA
Wiley-VCHVerlagGmbH,Boschstr.12,D-69469Weinheim,Germany
JohnWiley&SonsAustraliaLtd,33ParkRoad,Milton,Queensland4064,Australia
JohnWiley&Sons(Asia)PteLtd,2ClementiLoop#02-01,JinXingDistripark,Singapore129809
JohnWiley&SonsCanadaLtd,22WorcesterRoad,Etobicoke,Ontario,CanadaM9W1L1
Wileyalsopublishesitsbooksinavarietyofelectronicformats.Somecontentthatappears
inprintmaynotbeavailableinelectronicbooks.
BritishLibraryCataloguinginPublicationData
AcataloguerecordforthisbookisavailablefromtheBritishLibrary
ISBN0-470-84444-2
Typesetin10/12ptTimesbyTechBooks,NewDelhi,India
PrintedandboundinGreatBritainbyAntonyRoweLtd,Chippenham,Wiltshire
Thisbookisprintedonacid-freepaperresponsiblymanufacturedfromsustainableforestry
inwhichatleasttwotreesareplantedforeachoneusedforpaperproduction.
Contents
Preface ix
1 DigitalComputerBasics 1
1.1 DataEncoding 1
1.1.1 EncodingNumbers 3
1.1.2 CodeConversionsandMoreCodes 7
1.2 AlgorithmsandAlgorithmicNotations 9
1.2.1 FunctionalCompositionandtheDataFlow 10
1.2.2 CompositionbyCasesandtheControlFlow 11
1.2.3 AlternativeAlgorithms 13
1.3 BooleanFunctions 14
1.3.1 SetsofElementaryBooleanOperations 14
1.3.2 GateComplexityandSimplificationofBooleanAlgorithms 16
1.3.3 CombinedandUniversalFunctions 18
1.4 Timing,SynchronizationandMemory 19
1.4.1 ProcessingTimeandThroughputofCompositeCircuits 20
1.4.2 SerialandParallelProcessing 22
1.4.3 Synchronization 25
1.5 AspectsofSystemDesign 29
1.5.1 ArchitecturesforDigitalSystems 29
1.5.2 ApplicationModeling 31
1.5.3 DesignMetrics 35
1.6 Summary 37
Exercises 38
2 HardwareElements 41
2.1 Transistors,GatesandFlip-Flops 41
2.1.1 ImplementingGateswithSwitches 41
2.1.2 RegistersandSynchronizationSignals 50
•
vi CONTENTS
2.1.3 PowerConsumptionandRelatedDesignRules 57
2.1.4 PulseGenerationandInterfacing 61
2.2 ChipTechnology 67
2.2.1 MemoryBusInterface 69
2.2.2 SemiconductorMemoryDevices 71
2.2.3 ProcessorsandSingle-ChipSystems 76
2.2.4 ConfigurableLogic,FPGA 78
2.3 ChipLevelandCircuitBoard-LevelDesign 86
2.3.1 ChipVersusBoard-LevelDesign 88
2.3.2 IP-BasedDesign 91
2.3.3 ConfigurableBoardsandInterconnections 91
2.3.4 Testing 94
2.4 Summary 96
Exercises 96
3 HardwareDesignUsingVHDL 99
3.1 HardwareDesignLanguages 99
3.2 EntitiesandSignals 101
3.3 FunctionalBehaviorofBuildingBlocks 102
3.4 StructuralArchitectureDefinitions 106
3.5 TimingBehaviorandSimulation 107
3.6 TestBenches 109
3.7 SynthesisAspects 111
3.8 Summary 112
Exercises 113
4 OperationsonNumbers 115
4.1 SingleBitBinaryAddersandMultipliers 115
4.2 FixedPointAdd,Subtract,andCompare 116
4.3 AddandSubtractforRedundantCodes 120
4.4 BinaryMultiplication 122
4.5 SequentialAdders,MultipliersandMultiply-AddStructures 124
4.6 DistributedArithmetic 128
4.7 DivisionandSquareRoot 130
4.8 FloatingPointOperationsandFunctions 131
4.9 PolynomialArithmetic 133
4.10 Summary 134
Exercises 135
5 SequentialControlCircuits 137
5.1 MealyandMooreAutomata 137
5.2 Scheduling,OperandSelectionandtheStorageAutomaton 140
5.3 DesigningtheControlAutomaton 142
5.4 SequencingwithCounterandShiftRegisterCircuits 144
5.5 ImplementingtheControlFlow 146
•
CONTENTS vii
5.6 Synchronization 148
5.7 Summary 148
Exercises 149
6 SequentialProcessors 151
6.1 DesigningforALUEfficiency 153
6.1.1 MultifunctionALUCircuits 153
6.1.2 Pipelining 158
6.2 TheMemorySubsystem 159
6.2.1 PipelinedMemoryAccesses,Registers,andthe
VonNeumannArchitecture 160
6.2.2 InstructionSetArchitecturesandMemoryRequirements 162
6.2.3 CachesandVirtualMemory,SoftCaching 165
6.3 SimpleProgrammableProcessorDesigns 168
6.3.1 CPU1–TheBasicControlFunction 168
6.3.2 CPU2–AnEfficientProcessorforFPGA-basedSystems 172
6.4 InterruptProcessingandContextSwitching 179
6.5 InterfacingTechniques 182
6.5.1 PipeliningInputandOutput 182
6.5.2 ParallelandSerialInterfaces,CountersandTimers 183
6.5.3 Input/OutputBuses 185
6.5.4 InterfacesandMemoryExpansionfortheCPU2 192
6.6 StandardProcessorArchitectures 193
6.6.1 EvaluationofProcessorArchitectures 193
6.6.2 MicroControllers 194
6.6.3 AHigh-PerformanceProcessorCoreforASICDesigns 198
6.6.4 Super-ScalarandVLIWProcessors 199
6.7 Summary 203
Exercises 203
7 System-LevelDesign 205
7.1 ScalableSystemArchitectures 205
7.1.1 Architecture-BasedHardwareSelection 205
7.1.2 InterfacingComponentProcessors 206
7.1.3 ArchitectureswithNetworkingBuildingBlocks 208
7.2 RegularProcessorNetworkStructures 211
7.3 IntegratedProcessorNetworks 218
7.4 StaticApplicationMappingandDynamicResourceAllocation 221
7.5 ResourceAllocationonCrossbarNetworksandFPGAChips 224
7.6 CommunicatingDataandControlInformation 226
7.7 Theπ-NetsLanguageforHeterogeneousProgrammableSystems 228
7.7.1 DefiningtheTargetSystem 230
7.7.2 AlgorithmsandElementaryDataTypes 232
7.7.3 ApplicationProcessesandCommunications 235
7.7.4 ConfigurationandReconfiguration 238
7.7.5 HardwareTargets 240
•
viii CONTENTS
7.7.6 SoftwareTargets 243
7.7.7 ArchitecturalSupportforHLLProgramming 244
7.8 Summary 247
Exercises 247
8 DigitalSignalProcessors 249
8.1 DigitalSignalProcessing 249
8.1.1 Analog-to-DigitalConversion 249
8.1.2 SignalSampling 251
8.1.3 DSPSystemStructure 253
8.2 DSPAlgorithms 255
8.2.1 FIRFilters 256
8.2.2 FastFourierTransform 257
8.2.3 FastConvolutionandCorrelation 260
8.2.4 BuildingBlocksforDSPAlgorithms 261
8.3 IntegratedDSPChips 263
8.4 IntegerDSPChips–IntegratedProcessorsforFIRFiltering 266
8.4.1 TheADSP21xxFamily 267
8.4.2 TheTMS320C54xFamily 270
8.4.3 DualMACArchitectures 271
8.5 FloatingPointProcessors 273
8.5.1 TheSharcFamily 273
8.5.2 TheTMS320C67xxFamily 276
8.6 DSPonFPGA 279
8.7 ApplicationstoUnderwaterSound 279
8.7.1 EchoSounderDesign 280
8.7.2 BeamForming 283
8.7.3 PassiveSonar 286
8.8 Summary 288
Exercises 289
References 291
Index 295
Preface
Thisbookisintendedasanintroductiontothedesignofdigitalprocessorsthatarededicatedto
performingaparticulartask.Itpresentsanumberofgeneralmethodsandalsocoversgeneral
purpose architectures such as programmable processors and configurable logic. In fact, the
dedicateddigitalsystemmightbebasedonastandardmicroprocessorwithdedicatedsoftware,
or on an application-specific hardware circuit. It turns out that there is no clear distinction
between hardware and software, and a number of techniques like algorithmic constructions
usinghigh-levellanguages,andautomateddesignusingcompilationapplytoboth.Forsome
time,dynamicallocationmethodsforstorageandotherresourceshavebeencommonforsoft-
warewhilehardwareusedtobeconfiguredstatically.Eventhisdistinctionvanishesbyusing
staticallocationtechniquestooptimizesoftwarefunctionsandbydynamicallyreconfiguring
hardwaresubstructures.
The emphasis in this book is on the common, system-level aspects of hardware and
softwarestructures.Amongthesearethetimingofcomputationsandhandshakingthatneed
to be considered in software but play a more prominent role in hardware design. The same
applies to questions of power consumption. System design is presented as the optimization
task to provide certain functions under given constraints at the lowest possible cost (a task
consideredasoneofthebasiccharacteristicsofengineering).Detailedsampleapplicationsare
takenfromthedomainofdigitalsignalprocessing.Thetextalsoincludessomedetailonrecent
FPGA (field programmable gate arrays), memory, and processor, in particular DSP (digital
signalprocessor)chips.Theselectedchipsservetodemonstratethestateoftheartandvarious
design aspects; there remain interesting others that could not be covered just for reasons of
space.Thestatementsmadeinthetextregardingthesechipsareallconclusionsbytheauthor
thatmaybeerroneousduetoincompleteorwrongdata.Viablecorrectionsmailedtotheauthor
will be posted to a page dedicated to this book at the web site: www.tu-harburg.de/ti6/ddp
alongwithothersupplementaryinformation.
Anon-standardtopicofspecialinterestcoveredinthisbookwillbethedesignofsimple
yet efficient processors that can be implemented on FPGA chips, and, more generally, the
balancebetweenserialandparallelprocessinginapplication-specificprocessors.Aprocessor
designofthiskindispresentedindetail(the‘CPU2’inChapter6),andalsoasystem-level
designtoolsupportingthisprocessorandothers.TheVHDLsourcecodeforaversionofthis
•
x PREFACE
processorcanalsobedownloadedfrom[55]alongwiththesoftwaretoolsforitforfreeusein
FPGAdesignsandforfurtherexperimentation.Licensingandcheckingforpatentprotection
areonlyrequiredforcommercialusage.
The book is the outcome of lectures on digital systems design, DSP, and processor
networksgivenattheTechnicalUniversityofHamburg-Harburg,andisintendedasanintro-
ductorytextbookondigitaldesignforstudentsofelectricalengineeringandcomputerscience.
Itpresentsaparticularselectionoftopicsandproposesguidelinestodesigningdigitalsystems
butdoesnotattempttobecomprehensive;tostudyabroadsubjectsuchasdigitalprocessing,
furtherreadingisneeded.Asanunusualfeatureforanintroductorytext,almosteverychapter
discussessomesubjectthatisnon-standardandshowsdesignoptionsthatmaybeunexpected
tothereader,withtheaimofstimulatingfurtherexplorationandstudy.Theseextrascanalso
serveashookstoattachadditionalmaterialstolecturesbasedonthisbook.
Thebookassumessomebasicknowledgeonhowtoencodenumbers,onBooleanfunc-
tions,algorithmsanddatastructures,andprogramming,i.e.thetopicsusuallycoveredinin-
troductorylecturesandtextbooksoncomputersciencesuchas[13,20].SomeparticularDSP
algorithmsandalgorithmsforconstructingarithmeticoperationsfromBooleanoperationsare
treated.Thesystemdesignerwill,however,needadditionalknowledgeonapplicationspecific,
e.g.DSPalgorithms[14]andmoregeneralalgorithms[15].Also,semiconductorphysicsand
technologyareonlybrieflydiscussedtohavesomeunderstandingoftheelectronicgatecircuits
andtheirpowerconsumption,mostlyconcentratingonCMOStechnology[10].Forthemain
subject of this book, the design of digital systems, further reading is recommended, too. In
bookssuchas[2,49]thereaderwillfindmoredetailonstandardtopicssuchascombinatorial
circuit and automata design. They are treated rather briefly in this book and are focused on
particularapplicationsonlyinordertocovermorelevelsofthedesignhierarchy.Thetextcon-
centratesonthehierarchicalconstructionofefficientdigitalsystemsstartingfromgatelevel
buildingblocksandgivenalgorithmsandtimingrequirements.Evenforthesetopics,further
readingisencouraged.Throughtheadditionalliteraturethereaderwillgainanunderstanding
ofhowtodesignbothhardwareandsoftwareofdigitalsystemsforspecificapplications.The
referencesconcentrateoneasilyaccessiblebooksandonlyoccasionallyciteoriginalpapers.
Chapter1startswithsomegeneralprinciplesonhowtoconstructdigitalsystemsfrom
building blocks, in particular the notion of algorithms, which applies to both hardware and
software.Itdiscussescomplexityissuesincludingminimization,and,inparticular,thetiming
and synchronization of computations. The presentation proceeds at a fairly abstract level
to aspects of system-level specifications and introduces some important metrics for digital
systemstobeusedinthesequel,e.g.thepercentageoftimeinwhichacircuitsuchasanALU
(arithmeticandlogicunit)ofaprocessorperformscomputationalsteps.
Chapter2entersintothetechnologicalbasicsofdigitalcomputers,includingtransistor
circuitsandthepropertiesofcurrentintegratedchips.Itprovidesthemostelementaryhardware
buildingblocksofdigitalsystems,includingauxiliarycircuitssuchasclockgenerators,and
circuits for input and output. Configurable logic and FPGA are introduced. Board and chip
level design are considered, as well as the design of application-specific systems from IP
(intellectualproperty)modules.
Chapter 3 then introduces the method of describing and designing hardware using a
hardwaredescriptionlanguage.VHDLisbrieflyintroducedasastandardlanguage.AllVHDL
examplesandexercisescanbesimulatedandsynthesizedwiththefreedesigntoolsprovided
byFPGAcompaniessuchasXilinxandAltera.
•
PREFACE xi
Chapter4proceedstotherealizationofarithmeticalfunctionsasspecialBooleanfunc-
tions on encoded numbers, including the multiply-add needed for DSP. Serial versions of
thesefunctionsarealsopresented,andsomespecialtopicssuchasthedistributedarithmetic
realizedwithFPGAcells.
Chapter5furtherelaboratesontheaspectsofsequentialcontrol,startingwithschedul-
ing and operand storage. It includes a discussion of those automata structures suitable for
generatingcontrolsequences,and,inparticular,amemory-basedrealizationofthecontroller
automaton.
InChapter6theconceptofaprogrammableprocessorisdiscussed,includingthehandling
ofinputandoutput,interruptprocessingandDMA.Thepresentationofsequentialprocessors
does not attempt to trace the historical development but continues a logical path started in
Chapter5towardswhatisneededforefficientcontrol.Thispathdoesnotalwaysduplicate
contemporarysolutions.Twosimpleprocessordesignsarepresentedtodemonstratevarious
techniques to enhance the ALU efficiency mentioned above. Some standard microproces-
sorsarediscussedaswell,andtechniquesusedtoboostperformanceinmodernhigh-speed
processors.
Chapter7proceedstothesystemlevelwhereprocessorsandFPGAchipsarejustcom-
ponents of a scalable architecture (as defined in Chapter 1), and the systems based on such
an architecture are networks of sequential processors or heterogeneous networks including
both FPGA-based logic circuits and programmable processors. The components need to be
equippedwithinterfacessupportingtheiruseinnetworks.Thechapteralsosketchesasystem-
leveldesigntooltakingupseveraloftheideasandconceptspresentedbefore.Itdemonstrates
aconvenientsettingforacompilersupportsurpassingtheindividualtargetprocessororpro-
grammablelogiccircuit.Thechapteralsoexplainssomeautomaticallocationtechniquesused
bycompilersandFPGAdesigntools.
Chapter 8 discusses the application domain of digital signal processing starting from
thebasicsofsignalsamplingandproceedingtoapplication-specificprocessors.Somerecent
commercialsignalprocessorsarediscussedindetail,andtheuseofFPGAchipsforDSPis
considered.Thefinalsectiondiscussessomespecificexamplesofembeddeddigitalsystems
performinghigh-speedreal-timeDSPofsonar(underwatersound)signals.
Throughoutthisbook,thenotionofa‘system’encompassingcomponentsandsubsystems
playsacrucialrole.Processorswillbeviewedascomplexsystemcomponents,andprocessor-
based systems as sub-systems of a digital system. In general, a digital system will contain
several processor-based sub-systems depending on the performance and cost requirements.
Dedicated digital systems are usually embedded sub-systems of some hybrid supersystem,
andtheoperationsperformedbythesub-systemneedtobeconsistentwiththeoperationof
the entire system. It may not be enough to specify the interfaces with the supersystem, but
necessary to analyze the dependency on other sub-systems of the total system that may be
variable to some degree or be invariable givens. The reader is encouraged to proceed with
thisanalysistofurtherlevels,inparticulartothedependencieswithinthesocialenvironment
of engineering work, even if their analysis becomes more and more complex. It is a shame
toseethebeautifultechnologyofdigitalsystemsbeingappliedtoviolateanddestroygoods
andlives.Thejudgementwill,however,bedifferentifthesametechniquesareusedtocreate
countermeasures.Fortunately,therearemanyapplicationsinwhichthebenefitsofanachieve-
mentarenotasdoubtful,andtheengineermaychoosetoconcentrateonthese.