GraduateComputerArchitecture(GCA2012)Prof.Chun-yuanZhangComputerSchool,NUDTFall,2012Lecture2ISA&BasicPipelineOctober18,20123ComputerSchool,NUDTFall,2012Mottos•Chapter1:BillGates,February24,2004☺–Ithinkit’sfairtosaythatpersonalcomputershavebecomethemostempoweringtoolwe’veevercreated.They’retoolsofcommunication,they’retoolsofcreativity,andtheycanbeshapedbytheiruser.•AppendixA:SelectionfromtheListof18MachineInstructionsfortheEDSAC(1949)–AnAddthenumberinstoragelocationnintotheaccumulator–EnIfthenumberintheaccumulatorisgreaterthanorequaltozeroexecutenexttheorderwhichstandsinstoragelocationn;otherwiseproceedserially.–ZStopthemachineandringthewarningbell.4ComputerSchool,NUDTFall,2012DeeperReading:BooksofMIPSCPU•DavidMoneyHarrisandSarahL.Harris:DigitalDesignandComputerArchitecture,2007byElsevierInc.–数字设计和计算机体系结构(英文版),-北京:机械工业出版社,2007.10–HowtobuildaMIPSprocessorofH&PwithHDL(VHDLandVerilog)inthesecondhalfofthetextbook•DominicSweetman:SeeMIPSRun...Linux,secondedition,2007byElsevierInc.–MIPS体系结构透视(英文版·第2版),-北京:机械工业出版社,2007.2–UnderstandingMIPS(microprocessor)fromapeogrammer'spointofview(oldarchitecture)5ComputerSchool,NUDTFall,2012BooksLookLike6ComputerSchool,NUDTFall,20127ComputerSchool,NUDTFall,2012IfYouStillLike…•硅谷热,1985。EarlyyearsofSiliconValley–SiliconValleyFever•我看英特尔,1995。BriefhistoryofIntel–InsideIntel•只有偏执狂才能生存,1997。TheothersidesindevelopmentofsemiconductormicrocomputersformDr.AndyS.Grove’spointofview–OnlytheParanoidSurvive–生于忧患•电脑史话,1999。Computerstorieswrittenby赵奂辉,adoctorofPKU•计算机技术发展史[一]、[二],胡守仁,国防科技大学出版社8ComputerSchool,NUDTFall,2012WhatisPerformance?•Latency(orresponsetimeorexecutiontime)–timetocompleteonetask•Bandwidth(orthroughput)–taskscompletedperunittime9ComputerSchool,NUDTFall,2012SummarizingPerformance•Whichsystemisfaster?SystemRate(Task1)Rate(Task2)A1020B201010ComputerSchool,NUDTFall,2012…DependsWho’sSellingSystemRate(Task1)Rate(Task2)A1020B2010Average1515AveragethroughputSystemRate(Task1)Rate(Task2)A0.502.00B1.001.00Average1.251.00ThroughputrelativetoBSystemRate(Task1)Rate(Task2)A1.001.00B2.000.50Average1.001.25ThroughputrelativetoA11ComputerSchool,NUDTFall,2012PerformanceDependson•CPUtime=Seconds/Program=Instructions/Program×Cycles/Instruction×Seconds/CycleXTechnologyXXOrganizationXXXISA(X)XCompilerXProgramClockCPIICInst.CountCPICycletime12ComputerSchool,NUDTFall,2012ArchitectureandMicro-13ComputerSchool,NUDTFall,2012WhatisOurArchitectureNowInstructionSetPrinciplesWehavereviewedChapter1InstructionSetArchitecture(ISA)—theportionofthecomputervisibletotheprogrammerorcompilerwriter15ComputerSchool,NUDTFall,2012AppendixAInstructionSetPrinciplesA.1IntroductionA.2ClassifyingInstructionSetArchitecturesA.3MemoryAddressingA.4TypeandSizeofOperandsA.5OperationsintheInstructionSetA.6InstructionsforControlFlowA.7EncodinganInstructionSetA.8CrosscuttingIssues:TheRoleofCompilersA.9PIAT:TheMIPSArchitectureA.10FallaciesandPitfallsA.11ConcludingRemarksA.12HistoricalPerspectiveandReferences16ComputerSchool,NUDTFall,2012FocusonFourTopicsinTheSection•Taxonomyofinstructionsetalternatives–Givesomequalitativeassessmentoftheadvantagesanddisadvantagesofvariousapproaches•Presentandanalyzesomeinstructionsetmeasurementsthatarelargelyindependentofaspecificinstructionset•Theissueoflanguagesandcompilersandtheirbearingoninstructionsetarchitecture•TheMIPSinstructionset–AppendixK:11examplesofISA17ComputerSchool,NUDTFall,2012ApplicationAreasandRequirementsofISA•Manydifferentmicroarchitectureexitsforasinglearchitecture–Optimizedortrade-offs•TheISAverysimilar,butdifferent–Desktopcomputing•EmphasizesintegerandFP•Littleregardforprogramsizeorchippower–Server•FPislessimportantthanintandcharstring–PMDandEmbeddedapplication•Cost,powerandcodesize18ComputerSchool,NUDTFall,2012TraditionalTaxonomyofInst.Sets:AC•AccumulatorarchitectureALUMemoryA19ComputerSchool,NUDTFall,2012TraditionalTaxonomyofInst.Sets:Stack•Stackarchitecture:stackProcessorMainStoreALUMemorytop20ComputerSchool,NUDTFall,2012AStackMachine•AStackmachinehasastackasapartoftheprocessorstate•typicaloperations:–push,pop,+,*,...•specifythetop2elementsofthestackasoperandsabapushbcbapushcbapop21ComputerSchool,NUDTFall,2012EvaluationofExpressions(a+b*c)/(a+d*c-e)/+*+ae-acdc*b22ComputerSchool,NUDTFall,2012EvaluationofExpressions:ReversePolish(a+b*c)/(a+d*c-e)/+*+ae-acdc*bReversePolishabc*+adc*+e-/23ComputerSchool,NUDTFall,2012EvaluationofExpressions:pusha(a+b*c)/(a+d*c-e)/+*+ae-acdc*bReversePolishabc*+adc*+e-/pushaEvaluationStack24ComputerSchool,NUDTFall,2012aEvaluationofExpressions:ainstack(a+b*c)/(a+d*c-e)/+*+ae-acdc*bReversePolishabc*+adc*+e-/EvaluationStack25ComputerSchool,NUDTFall,2012aEvaluationofExpressions:pushb(a+b*c)/(a+d*c-e)/+*+ae-acdc*bReversePolishabc*+adc*+e-/pushbEvaluationStack26ComputerSchool,NUDTFall,2012abEvaluationofExpressions:pushc(a+b*c)/(a+d*c-e)/+*+ae-acdc*bReversePolishabc*+adc*+e-/pushcEvaluationStack27ComputerSchool,NUDTFall,2012abcEvaluationofExpressions:multiply(a+b*c)/(a+d*c-e)/+*+ae-acdc*bReversePolishabc*+adc*+e-/multiplyEvaluationStack28ComputerSchool,N