附英文阅读材料Word文档格式.docx
《附英文阅读材料Word文档格式.docx》由会员分享,可在线阅读,更多相关《附英文阅读材料Word文档格式.docx(41页珍藏版)》请在冰豆网上搜索。
(选自M.MORRISMANO《COMPUTERSYSTEMARCHITECTURE》THIRDEDITION)
INTHISCHAPTER
2-1DataTypes
2-2Complements
2-3Fixed-PointRepresentation
2-4Floating-PointRepresentation
2-5OtherBinaryCodes
2-6ErrorDetectionCodes
Binaryinformationindigitalcomputersisstoredinmemoryorprocessorregisters.Registerscontaineitherdataorcontrolinformation.Controlinformationisabitoragroupofbitsusedtospecifythesequenceofcommandsignalsneededformanipulationofthedatainotherregisters.Dataarenumbersandotherbinary-codedinformationthatareoperatedontoachieverequiredcomputationalresults.Inthischapterwepresentthemostcommontypesofdatafoundindigitalcomputersandshowhowthevariousdatatypesarerepresentedinbinary-codedformincomputerregisters.
Thedatatypesfoundintheregistersofdigitalcomputersmaybeclassifiedasbeingoneofthefollowingcategories:
(1)numbersusedinarithmeticcomputations,
(2)lettersofthealphabetusedindataprocessing,and(3)otherdiscretesymbolsusedforspecificpurposed.Alltypesofdata,exceptbinarynumbers,arerepresentedincomputerregistersinbinary-codedform.Thisisbecauseregistersaremadeupofflip-flopsandflip-flopsaretwo-statedevicesthatcanstoreonly1’sand0’s.Thebinarynumbersystemisthemostnaturalsystemtouseinadigitalcomputer.Butsometimesitisconvenienttoemploydifferentnumbersystems,especiallythedecimalnumbersystem,sinceitisusedbypeopletoperformarithmeticcomputations.
NumberSystems
Anumbersystemofbase,orradix,risasystemthatusesdistinctsymbolsforrdigits.Numbersarerepresenteedbyastringofdigitsymbols.Todeterminethequantitythatthenumberrepresents,itisnecessarytomultiplyeachdigitbyanintegerpowerofrandthenformthesumofallweighteddigits.Forexample,thedecimalnumbersystemineverydayuseemploystheradix10system.The10symbolsare0,1,2,3,4,5,6,7,8,and9.Thestringofdigits724.5isinterpretedtorepresentthequantity.
7102+2101+4100+510-1
thatis,7hundreds,plus2tens,plus4units,plus5tenths.Everydecimalnumbercanbesimilarlyinterpretedtofindthequantityitrepresents.
Thebinarynumbersystemusestheradix2.Thetwodigitsymbolsusedare0and1.Thestringofdigits101101isinterpretedtorepresentthequantity
125+024+123+122+021+120=45
Todistinguishbetweendifferentradixnumbers,thedigitswillbeenclosedinparenthesesandtheradixofthenumberinsertedasasubscript.Forexample,toshowtheequalitybetweendecimalandbinaryforty-fivewewillwrite(101101)2=(45)10
Besidesthedecimalandbinarynumbersystems,theoctal(radix8)andhexadecimal(radix16)areimportantindigitalcomputerwork.Theeightsymbolsoftheoctalsystemare0,1,2,3,4,5,6,and7.The16symbolsofthehexadecimalsystemare0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,andF.Thelastsixsymbolsare,unfortunately,identicaltothelettersofthealphabetandcancauseconfusionattimes.However,thisistheconventionthathasbeenadopted.Whenusedtorepresenthexadecimaldigits,thesymbolsA,B,C,D,E,Fcorrespondtothedecimalnumbers10,11,12,13,14,15,respectively.
Anumberinradixrcanbeconvertedtothefamiliardecimalsystembyformingthesumoftheweighteddigits.Forexample,octal736.4isconvertedtodecimalasfollows:
(736.4)8=782+381+680+48-1
=764+38+61+4/8=(478.5)10
TheequivalentdecimalnumberofhexadecimalF3isobtainedfromthefollowingcalculation:
(F3)16=F16+3=1516+3=(243)10
Conversionfromdecimaltoitsequivalentrepresentationintheradixrsystemiscarriedoutbyseparatingthenumberintoitsintegerandfractionpartsandconvertingeachpartseparately.Theconversionofadecimalintegerintoabaserrepresentationisdonebysuccessivedivisionsbyrandaccumulationoftheremainders.Theconversionofadecimalfractiontoradixrrepresentationisaccomplishedbysuccessivemultiplicationsbyrandaccumulationoftheintegerdigitssoobtained.Figure2-1demonstratestheseprocedures.
Theconversionofdecimal41.6875intobinaryisdonebyfirstseparatingthenumberintoitsintegerpart41andfractionpart.6875.Theintegerpartisconvertedbydividing41byr=2togiveanintegerquotientof20andaremainderof1.Thequotientisagaindividedby2togiveanewquotientandremainder.Thisprocessisrepeateduntiltheintegerquotientbecomes0.Thecoefficientsofthebinarynumberareobtainedfromtheremainderswiththefirstremaindergivingthelow-orderbitoftheconvertedbinarynumber.
Thefractionpartisconvertedbymultiplyingitbyr=2togiveanintegerandafraction.Thenewfraction(withouttheinteger)ismultipliedagainby2togiveanewintegerandanewfraction.Thisprocessisrepeateduntilthefractionpartbecomeszerooruntilthenumberofdigitsobtainedgivestherequiredaccuracy.Thecoefficientsofthebinaryfractionareobtainedfromtheintegerdigitswiththefirstintegercomputedbeingthedigittobeplacednexttothebinarypoint.Finally,thetwopartsarecombinedtogivethetotalrequiredconversion.
OctalandHexadecimalNumbers
Theconversionfromandtobinary,octal,andhexadecimalrepresentationplaysandimportantpartindigitalcomputers.Since23=8and24=16,eachoctaldigitcorrespondstothreebinarydigitsandeachhexadecimaldigitcorrespondstofourbinarydigits.Theconversionfrombinarytooctaliseasilyaccomplishedbypartitioningthebinarynumberintogroupsofthreebitseach.Thecorrespondingoctaldigitisthenassignedtoeachgroupofbitsandthestringofdigitssoobtainedgivestheoctalequivalentofthebinarynumber.Consider,forexample,a16-bitregister.Physically,onemaythinkoftheregisterascomposedof16binarystoragecells,witheachcellcapableofholdingeithera1ora0.Supposethatthebitconfigurationstoredintheregisterisasshowninfig.2-2.Sinceabinarynumberconsistsofastringof1’sand0’s,the16-bitregistercanbeusedtostoreanybinarynumberfrom0to216-1.Fortheparticularexampleshown,thebinarynumberstoredintheregisteristheequivalentofdecimal44899.Startingfromthelow-orderbit,wepartitiontheregisterintogroupsofthreebitseach(thesixteenthbitremainsinagroupbyitself).Eachgroupofthreebitsisassigneditsoctalequivalentandplacedontopoftheregister.Thestringofoctaldigitssoobtainedrepresentstheoctalequivalentofthebinarynumber.
Conversionfrombinarytohexadecimalissimilarexceptthatthebitsaredividedintogroupsoffour.ThecorrespondinghexadecimaldigitforeachgroupoffourbitsiswrittenasshownbelowtheregisterofFig.2-2.Thestringofhexadecimaldigitssoobtainedrepresentsthehexadecimalequivalentofthebinarynumber.Thecorrespondingoctaldigitforeachgroupofthreebitsiseasilyrememberedafterstudyingthefirsteightentrieslistedintable2-1.Thecorrespondencebetweenahexadecimaldigitanditsequivalent4-bitcodecanbefoundinthefirst16entriesofTable2-2.
Table2-1listsafewoctalnumbersandtheirrepresentationinregistersinbinary-codedform.Thebinarycodeisobtainedbytheprocedureexplainedabove.Eachoctaldigitisassigneda3-bitcodeasspecifiedbytheentriesofthefirsteightdigitsinthetable.Similarly,Table2-2listsafewhexadecimalnumbersandtheirrepresentationinregistersinbinary-codedform.Herethebinarycodeisobtainedbyassigningtoeachhexadecimaldigitthe4-bitcodelistedinthefirst16entriesofthetable.
Comparingthebinary-codedoctalandhexadecimalnumberswiththeirbinarynumberequivalentwefindthatthebitcombinationinallthreerepresentationsisexactlythesame.Forexample,decimal99,whenconvertedtobinary,becomes1100011.Thebinary-codedoctalequivalentofdecimal99is001100011andthebinary-codedhexadecimalofdecimal99is01100011.Ifweneglecttheleadingzerosinthesethreebinaryrepresentations,wefindthattheirbitcombinationisidentical.Thisshouldbesobecauseofthestraightforwardconversionthatexistsbetweenbinarynumbersandoctalorhexadecimal.Thepointofallthisisthatastringof1’sand0’sstoredinaregistercouldrepresentabinarynumber,butthissamestringofbitsmaybeinterpretedasholdinganoctalnumberinbinary-codedform(ifwedividethebitsingroupsofthree)orasholdingahexadecimalnumberinbinary-codedform(ifwedividethebitsingroupsoffour).
Theregistersinadigitalcomputercontainmanybits.Specifyingthecontentofregistersbytheirbinaryvalueswillrequirealongstringofbinarydigits.Itismoreconvenienttospecifycontentofregistersbytheiroctalorhexadecimalequivalent.Thenumberofdigitsisreducedbyone-thirdintheoctaldesignationandbyone-fourthinthehexadecimaldesignation.Forexample,thebinarynumber111111111111has12digits.Itcanbeexpressedinoctalsas7777(fourdigits)orinhexadecimalasFFF(threedigits).Computermanualsinvariablychooseeithertheoctalorthehexadecimaldesignationforspecifyingcontentsofregisters.
Decimalrepresentation
Thebinarynumbersystemisthemostnaturalsystemforacomputer,butpeopleareaccustomedtothedecimalsystem.Onewaytosolvethisconflictistoconvertallinputdecimalnumbersintobinarynumbers,letthecomputerperformallarithmeticoperationsinbinaryandthenconvertthebinaryresultsbacktodecimalforthehumanusertounderstand.However,itisalsopossibleforthecomputertoperformarithmeticoperationsdirectlywithdecimalnumbersprovidedtheyareplacedinregistersinacodedform