Anda di halaman 1dari 19

CSN221:COMPUTERARCHITECTURE

ANDMICROPROCESSORS
Computer Organization, CPU Structure and Functions

(Lecture - 5)

Dr.Sudip Roy
CourseWebsite:http://faculty.iitr.ac.in/~sudiproy.fcs/csn221_2015.html
PiazzaSite:https://piazza.com/iitr.ac.in/fall2015/csn221

Datapath andControl:
Instruction
e.g.,ADDA,B,C
Operator/Control
Operand/Data

Datapath:
Memory,registers,adders,ALU,andcommunicationbuses
Eachstep(fetch,decode,execute,saveresult)requirescommunication(data
transfer)pathsbetweenmemory,registersandALU
Control:
Datapath foreachstepissetupbycontrolsignalsthatsetupdataflow
directionsoncommunicationbusesandselectALUandmemoryfunctions
Controlsignalsaregeneratedbyacontrolunitconsistingofoneormore
finitestatemachines
Dr.SudipRoy

Arithmetic&LogicUnit(ALU):
Doesallthecalculationsfortheprocessor
Everythingelseinthecomputeristheretoservicethisunit
Handlesintegers
Mayhandlefloatingpoint(real)numbers
MaybeseparateFPU(mathcoprocessor)
MaybeonchipseparateFPU(486DX+)
ALUInputs&Outputs:

Dr.SudipRoy

Whatdoesaprocessorwork?

Instructioncycle:
1. Fetchinstructions
2. Interpret(decode)instructions
3. Fetchdata
4. Process(Execute)data
5. Writedata
Dr.SudipRoy

Oncethecomputerhasbeenstarted
(bootstrapped)itcontinuallyexecutes
instructions(untilthecomputeris
stopped)
Differentinstructionstakedifferent
amountsoftimetoexecute(typically)
4

ProgramCounter(PC):
Sometimescalledasinstructionpointer(IP)orinstructionaddressregister
(IAR)orinstructioncounter(IC)
Inmostprocessors,thePCisincrementedafterfetchinganinstruction,and
holdsthememoryaddressof(pointsto)thenextinstructionthatwouldbe
executed
Inaprocessorwherethisincrementprecedesthefetch,thePCpointstothe
currentinstructionbeingexecuted

Dr.SudipRoy

Example:InstructionExecution
MULT x,y,product
1. FetchtheinstructioncodefromMemory[PC]
2. Decodetheinstruction.Thisrevealsthatit'samultiplyinstruction,andthat
theoperandsarememorylocationsx,y,andproduct.
3. Fetchxandyfrommemory.
4. Multiplyxandy,storingtheresultinaCPUregister.
5. SavetheresultfromtheCPUtomemorylocationproduct.

Dr.SudipRoy

InstructionCycle:
Start

Acompleteinstructionconsistsof
operationcode
addressingmode

Fetch
Instruction

zeroormoreoperands
immediatelyavailabledata
(embeddedwithintheinstruction)
theaddresswherethedatacanbe
foundinmainmemory

Decode
Instruction

Fetch
Operand

Execute
Instruction

Dr.SudipRoy

InstructionSetArchitecture(ISA):
Softwaredesign

Hardwarecircuits

Dr.SudipRoy

InstructionSetArchitecture:SoftwareDesign
EachcomputerCPUmustbedesignedtoaccommodateandunderstand
instructionsaccordingtospecificformats.
Examples:
Allinstructionsmusthaveanoperationcodespecified
NOP

nooperation

TSTST

testandset

OpCode

Mostinstructionswillrequireone,ormore,operands
Thesemaybe(immediate)datatobeuseddirectly
or,addressesofmemorylocationswheredatawillbefound(including
theaddressofyetanotherlocation)
OpCode
Dr.SudipRoy

Operand(Address)
9

InstructionSetArchitecture:SoftwareDesign
Sometimestheinstructionformatrequiresacode,calledtheMode,
thatspecifiesaparticularaddressingformattobedistinguishedfrom
otherpossibleformats
directaddressing
indirectaddressing
indexedaddressing
relativeaddressing
doublyindirectaddressing
etc.

OpCode

Dr.SudipRoy

Mode

Op.(Addr.)

Mode

Op.(Addr.)

10

InstructionSetArchitecture:HardwareCircuits
Everythingthatthecomputercandoistheresultofdesigningandbuilding
devicestocarryouteachfunction nomagic!
Atthemostelementarylevelthedevicesarecalledlogicgates.
Therearemanypossiblegatetypes,eachperformaspecificBoolean
operation(e.g.AND,OR,NOT,NAND,NOR,XOR,XNOR)
ALLcircuits,henceallfunctions,aredefinedintermsofthebasicgates
WeapplyBooleanAlgebraandBooleanCalculusinordertodesigncircuits
andthenoptimizeourdesigns

Dr.SudipRoy

11

InstructionSetArchitecture:HardwareCircuits
Dataisrepresentedbyvarioustypesofsignals,includingelectrical,
magnetic,opticalandsoon.

Datamovesthroughthecomputeralongwiresthatformthevariousbus
networks(address,data,control)andwhichinterconnectthegates.
Combinationsofgatesarecalledintegratedcircuits(IC).

Dr.SudipRoy

12

InstructionSetArchitecture:CU(ControlUnit)
Thecontrolunitmustdecodeinstructions,setupforcommunicationwith
RAMaddressesandmanagethedatastoredinregisterandaccumulator
storages.
Eachsuch(CU)operationrequiresseparatecircuitrytoperformthe
specializedtasks.
Itisalsonecessaryforcomputerexpertstohaveknowledgeofthevarious
datarepresentationstobeusedonthemachineinordertodesign
componentsthathavethedesiredbehaviors.

Dr.SudipRoy

13

InstructionSetArchitecture:ALU
Allinstructionstogetherarecalledtheinstructionset
CISC complexinstructionsetcomputer
RISC reducedinstructionsetcomputer
EachALUinstructionrequiresaseparatecircuit,althoughsomeinstructions
mayincorporatethecircuitlogicofotherinstructions

Dr.SudipRoy

14

RISCvs.CISC:
MostcommonmicroprocessordesignssuchastheIntel80x86andMotorola
68KseriesfollowedtheCISCphilosophy.

Butrecentchangesinsoftwareandhardwaretechnologyhaveforcedare
examinationofCISCandmanymodernCISCprocessorsarehybrids,
implementingmanyRISCprinciples.

ThefirstRISCprojectscamefromIBM,Stanford,andUCBerkeleyinthelate
70sandearly80s.TheIBM801,StanfordMIPS,andBerkeleyRISC1and2
werealldesignedwithasimilarphilosophywhichhasbecomeknownasRISC.

Dr.SudipRoy

15

RISCvs.CISC:
CertaindesignfeatureshavebeencharacteristicofmostRISCprocessors:
onecycleexecutiontime:RISCprocessorshaveaCPI(clockperinstruction)of
onecycle.ThisisduetotheoptimizationofeachinstructionontheCPUanda
techniquecalledPIPELINING
pipelining:atechniquethatallowsforsimultaneousexecutionofparts,or
stages,ofinstructionstomoreefficientlyprocessinstructions;
largenumberofregisters:theRISCdesignphilosophygenerallyincorporatesa
largernumberofregisterstopreventinlargeamountsofinteractionswith
memory
CISCwasdevelopedtomakecompilerdevelopmentsimpler.Itshiftsmostofthe
burdenofgeneratingmachineinstructionstotheprocessor.Forexample,
insteadofhavingtomakeacompilerwritelongmachineinstructionsto
calculateasquareroot,aCISCprocessorwouldhaveabuiltinabilitytodothis.
E.g.PentiumisconsideredamodernCISCprocessor
Dr.SudipRoy

16

RISCvs.CISC:
MostcommonmicroprocessordesignssuchastheIntel80x86andMotorola
68KseriesfollowedtheCISCphilosophy.
Butrecentchangesinsoftwareandhardwaretechnologyhaveforcedare
examinationofCISCandmanymodernCISCprocessorsarehybrids,
implementingmanyRISCprinciples.
CISC

RISC

Complex instructionsrequiremultiple
cycles

Reducedinstructionstake1cycle

Many instructionscanreferencememory

OnlyLoadandStoreinstructionscan
referencememory

Instructionsareexecuted oneatatime

Usespipeliningtoexecute instructions

Fewgeneral registers

Manygeneralregisters

Dr.SudipRoy

17

RISCvs.CISC:
CISC
EffectivelyrealizesoneparticularHighLevelLanguageComputerSystem
inHW recurringHWdevelopmentcostswhenchangeneeded
RISC
AllowseffectiverealizationofanyHighLevelLanguageComputerSystem
inSW recurringSWdevelopmentcostswhenchangeneeded
Hybridsolutions
RISCcore&CISCinterface
Stillhasspecificperformancetuning
OptimalISA
BetweenRISC&CISC
Few,carefullychosen,usefulcomplexinstructions
Stillhascomplexityhandlingproblems
Dr.SudipRoy

18

MemoryHierarchyinaComputer:

DuetosizeofDRAM
Duetocostandwiredelays(wiresonchipcostmuchless,andarefaster)

KeytoyourArchitecturalDesign:

Dr.SudipRoy

19

Anda mungkin juga menyukai