Title | Computer organization and architecture themes and variations 1st edition alan clements solutions manual |
---|---|
Author | Ceti Mam |
Course | Computer Vision |
Institution | University of Delhi |
Pages | 24 |
File Size | 887.8 KB |
File Type | |
Total Downloads | 33 |
Total Views | 138 |
Computer organization and architecture themes and variations 1st edition alan clements solutions manual...
Computer Organization and Architecture Themes and Variations 1st Edition Alan Clements Solutions Manual Full Download: http://testbanklive.com/download/computer-organization-and-architecture-themes-and-variations-1st-edition-al
Chapter 2: Computer Arithmetic and Digital Logic 1.
2.
Whyisbinaryarithmeticemployedbydigitalcomputers? SOLUTION Binary arithmetic is used entirely because digital systems are constructed with two‐state logic elements. If semiconductor manufacturing processes changed and allowed logic elements with five states, then base‐5 arithmeticwouldbeused. Wesaidthatbinaryvalueshavenointrinsicinformation(thatistrueofallother numberrepresentations).The VoyagerIspacecraft,containingsamplesofhumanmusic andothermessages,wasthefirsthumanartifactto leave the solar system to travel to the stars. How is it possible to communicate with aliens in binary form if thereisnointrinsicmeaningtothedata? SOLUTION
Itis,ofcourse,truethatbinary datahasnointrinsicinformation, anda pattern of1sand0s hasnointrinsic meaningotherthanthatgiventoitby theprogrammer;forexample,we agreethatthebinarycode01000001 representstheletter‘A’inASCIIandrepresents65asan8421‐weighted,unsignedbinary,integer. Science Fiction writers have long thought about how communication might take place between different civilizations.Onepossiblesolutionistoconstructalanguageusinginformationthatcanbeshared.Forexample, there are universal constants such as the speed of light, the spectral lines of the hydrogen spectrum, the periodictableandthenumberof protonsineachelement.Similarly,therearemathematicalconcepts suchas primenumbers,constantssuchasπande,andsoon.So,bytransmitting,say,aseriesofprimenumbersorthe atomicnumbersof membersoftheperiodic table,analienintelligencewouldbeableto guessthesequence andthenworkouthowthenumbershavebeenencoded. An interesting case of decoding in the face of little information took place in WW2. The British had German Enigmamachinesbutneededtoseeatranslationofknowndata beforetheycouldperform generaldecoding. So,theyarrangedforbombstobedroppedontoemptyseanearaGermansubmarine.TheGermansubmarine observed the bombs and transmitted their position back to base. The message was intercepted and the decodingperformedbylookingfortheencodedpositionofthebombsusingtheknownactualposition. 3.
Howmuchmoreinaccurateisbinaryintegerarithmeticthandecimal integerarithmetic? Can the accuracyof binarycomputersbeimprovedtomakethemasaccurateasdecimalcomputers?
SOLUTION Thisisatrickquestion.Intheabsenceofactualerrors(faulty hardwareor software),anydigitallogicsystem is perfectlyaccurate;thatis,acalculationinonebaseyieldsthesameresultasacalculationinanotherbase.Any so‐called inaccuracies result from finite word‐lengths (e.g., a 10‐bit binary value represents a number to one part in 210 (one in in 1,000) whereas a 10‐bit decimal number allows a representation of 1 part in 10,000,000,000). Inaccuracies arise in fractional calculations (remember that a number like π cannot be representedinafinitenumberofdigits).Similarly,notalldecimalfractionscanalwaysberepresentedexactly inbinarybyafinitenumberofbits. 4.
Whyarecomputersbyte‐oriented?
SOLUTION There is no logical reason – it is a matter of custom and historical development. During the development of computers many different wordlengths were used. Some early computers actually had a 6‐bit byte. First‐ 16 © 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
F ll d
l
d ll h
t
i t
tl
l
t S l ti
M
l T tB
k it
t tb
kli
generationmicroprocessorshad8‐bitdataregisters.8bitswerecalledbytes.Byusingthebyteasabasicunitof dataitmeansthat16,32,and 64‐bitaddressesfitexactly inanintegernumberofbytes(which is,ofcourse, whywechoosetheseaddresswidths).Ifanaddresswere34 bits wide in abyte‐orientedworld,thenitwould requirea40‐bitwordof5bytestostoretheaddresswith6bitsunused. Moreimportantly,abyteis8,bitswhichis23andthatfitswellinabinaryword.Anotherreasonforemploying an8‐bitbyteisthatitallows28=256differentcharacters which fit inwell with the extended ASCII character set. Isometimewonderwhetherthebasicunitofdatainacomputershouldhavebeen12bits.Thatwouldpermita widerrangeof representationusingthebasicunit(1in212=4,096)whichwouldhaveprovidedfor(a)greater precision in simple calculations and (b) a greater ability to encode alphabets. Moreover, a 12‐bit unit would allowafeasibleaddressinsimplecontrol applications(4Klocations),whereasan8‐bitunithas tobeused to createa16‐bitaddress. 5.
Calculationsaretobeperformedtoaprecisionof0.001%.Howmanybitsdoesthisrequire?
SOLUTION Aprecisionof0.001%isonepartin100,000.Thenearestpower oftwoabovethisvalueis217.Therefore,17 bitsarerequired. 6.
7.
What are the decimal equivalents of the following values (assume positional notation and unsigned integer formats): a. 110011002 b. 110011003 c. 110011004 d. 11001100‐2 SOLUTION a. 110011002 1×22+1×23+1×26+1×27=4+8+64+128=204 b. 110011003 1×32+1×33+1×36+1×37=2,952 c. 110011004 1×42+1×43+1×46+1×47=20,560 d. 11001100‐2 1×(‐2)2+1×(‐2)3+1×(‐2)6+1×(‐2)7=4–8+64–128=‐68 Whydowehaveoctalandhexadecimalarithmetic?
SOLUTION Computers operate with base 2 arithmetic. However, it is difficult for people to handle binary numbers (for example 29810 is 1001010102) because binary numbers involve long strings of bits and we are not good at remembering long sequences. Hexadecimal arithmetic has 16 digits from 0 to F representing 4 binary bits. Therefore, a binary number can be easily represented in hexadecimal form by replacing each four bits by a hexadecimalcharacter.Forexample,29810is12A16(easierforpeopletorememberthan000100101010). Octalarithmeticusesbase8withthedigits0to7.Eachoctaldigitreplacesthreebits.Ithasthesameadvantage ashexadecimalnumbers;forexamplethe binarynumber111101011is 753inoctal.However,octalarithmetic ishardlyusedtoday.
17 © 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
8.
Convertthefollowingdecimalnumbersinto(a)binaryand(b)hexadecimalforms a. 25 b. 250 c. 2500 d. 25555
SOLUTION
a. b. c. d.
25 250 2500 25555
11001 11111010 100111000100 110001111010011
19 FA 9C4 63D3
Convertthefollowingunsignedbinarynumbersintodecimalform a. 11 b. 1001 c. 10001 d. 10011001
9.
SOLUTION 10.
a. b. c. d.
11 1001 10001 10011001
3 9 17 153
Convertthefollowinghexadecimalnumbersintodecimalform a. AB b. A0B c. 10A01 d. FFAAFF
SOLUTION 11.
a. b. c. d.
AB A0B 10A01 FFAAFF
10101011 101000001011 10000101000000001 111111111010101011111111
171 2571 68097 16755455
Convertthefollowinghexadecimalnumbersintobinaryformat a. AC b. DF0B c. 10B11 d. FDEAF1
SOLUTION
a. b. c. d.
AC DF0B 10B11 FDEAF1
10101100 1101111100001011 10000101100010001 111111011110101011110001 18
© 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
12.
Convertthefollowingfractionaldecimalnumbersinto16‐bitunsignedbinaryform.Useeightbitsofprecision. a. 0.2 b. 0.046875 c. 0.1111 d. 0.1234
SOLUTION
a. b. c. d.
13.
0.2 0.046875 0.1111 0.1234
0.0011001100110011 0.0000110000000000 0.0001110001110001 0.0001111110010111
0.00110011 0.00001100 0.00011100 0.00100000
Performthefollowingcalculationsinthestatedbases a. 001101112 +010110112 b.
001111112 +010010012
c.
0012012116 +0A01503116
d.
00ABCD1F16 +0F00800F16
SOLUTION 14.
a.
001101112 +010110112 100100102
b.
001111112 +010010012 100010002
c.
0012012116 +0A01503116 0A13515216
d.
00ABCD1F16 +0F00800F16 0FAC4D2E16
Whatisarithmeticoverflow?Whendoesitoccurandhowcanitbedetected?
SOLUTION
Arithmetic overflow takes place when one or more two’s complement numbers take part in an arithmetic operation and the sign‐bit of the result is incorrect. For example, arithmetic overflow takes place when two positiveintegersareaddedandtheresult(wheninterpretedasatwo’scomplementvalue)isnegative,orwhen twonegativenumbersareaddedandthe resultispositive. In4‐bitarithmetic,thesignedtwo’scomplement 19 © 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
values1100and 1000 areaddedtogive10100, wherethe most‐significantbit isacarry out. The sign ofthe result, 0100, is 0 indicating a positive value. Since the numbers we added were both negative, arithmetic overflowhasoccurred. Intwo’scomplementaddition,arithmeticoverflowcanbedetectedbysaying,“Ifthesignbitsofthetwosource operandsarethesame,anddifferfromthesignbitoftheresultoperand,thenarithmeticoverflowoccurred.” 15.
Then‐bittwo’scomplementinteger N iswrittenan‐1,an‐2,. . . a1,a0. Provethat(intwo'scomplementnotation) therepresentationofasignedbinarynumberin n +1bits maybederivedfromitsrepresentationinnbits by repeatingtheleftmostbit.Forexample,ifn=‐12=10100infivebits,n=‐12=110100insixbits.
SOLUTION In n bits the positive number N is represented by an‐1, an‐2, . . . a 1, a0. We can extend this to n+1 bits by appendinga0totheleftwithoutchangingitsvalue;thatis0,an‐1,an‐2,...a1,a0. Nowconsiderthevalue‐Ninnbits.Thisisrepresentedas2n‐N.Ifweextendthiston+1bits,itbecomes2n+1‐ Nor2n+2n‐N.Thisis,ofcourse,theoriginalnegativerepresentationwithaleading1totheleft.Consequently, apositivenumberisextendedbyappendinga0,andanegativenumberbyaddinga1;thatis,byextendingthe signbit. 16.
Convert1234.125into32‐bitIEEEfloating‐pointformat. SOLUTION 1234=100110100102 0.125=0.0012 Therefore,1234.125=10011010010.0012
Thisis1.0011010010001×210(normalizedbinary) TheIEEEfloatingpointsignis0(positive) Thefractionalmantissain23bits(withsuppressedleading1)is00110100100010000000000 Thebiasedexponentis10+127=137or100010012 Thefloatingpointnumberis01000100100110100100010000000000or449A420016 17.
Whatisthedecimalequivalentofthe32‐bitIEEEfloating‐pointvalueCC4C0000? SOLUTION ThebinaryequivalentofCC4C0000is11001100010011000000000000000000 Thiscanbesplitintosign,biasedexponent,andfractionalmantissa.Thatis S=1,E=10011000,F=10011000000000000000000 The sign is negative, and the exponent is 100110002 ‐ 127 = 110012 = 25 (remember the stored exponent is biasedby127,whichhastobesubtracted) Themantissa,aftertheinsertionoftheleading1,is1.10011000000000000000000 Combiningmantissaandexponentweget 1.10011000000000000000000×225=11001100000000000000000000.0=53,477,37610
20 © 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
18.
What is the difference between overflow in the context of two’s complement numbers and overflow in the contextoffloating‐pointnumbers?
SOLUTION In two’s complement arithmetic, arithmetic overflow occurs when a result goes out of range (that is, more positive than 2n‐1‐1 or more negative than ‐2n‐1. When arithmetic overflow occurs, the sign of the computed resultisdifferenttothecorrectresult. Infloating‐pointarithmetic, overflowoccurs whentheexponentofafloating‐pointnumber becomes toolarge toberepresentedintheformat inuse.The numberisnowtoobig tobestoredand, usually, an exception is generated. 19.
20.
Inthenegabinarysystemani‐bitbinaryinteger,N,isexpressedusingpositionalnotationas: N=a0×(‐1)0×20+a1×(‐1)1×21+…+ai‐1×(‐1)i‐1×2i‐1 Thisisthesameasconventionalnatural8421 binaryweightednumbers, exceptthat alternatepositionshave theadditionalweighting+1and‐1.Forexample,1101=(‐1×1×8)+(+1×1×4)+(‐1×0×2)+(+1×1×1)=‐8 +4 +1 =‐3.Thefollowing4‐bitnumbersarerepresentedinnegabinaryform. Convertthemintotheirdecimal equivalents. a. 0000 b. 0101 c. 1010 d. 1111 SOLUTION a. 0 b. +4++1=5 c. ‐8+‐2=‐10 d. ‐8++4+‐2+1=‐5 Performthefollowingadditionson4‐bitnegabinarynumbers.Theresultisa6‐bitnegabinaryvalue. a. 0000 b. 1010 c. 1101 d. 1111 +0001 +0101 +1011 +1111
SOLUTION
a.
0000 +0001 000001
b. 1010 +0101 001111
c. 1101 1011 110100
d. 1111 1111 001010
21 © 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
21.
Arithmetic overflow occurs during a two's complement addition if the result of adding two positive numbers yieldsanegativeresult,orifaddingtwonegativenumbersyieldsapositiveresult.IfthesignbitsofAandBare thesamebutthesignbitoftheresultisdifferent,arithmeticoverflowhasoccurred.Ifan‐1isthesignbitofA,bn‐ 1isthesignbitofB,andsn‐1isthesignbitofthesumofAandB,thenoverflowisdefinedby V=an‐1⋅bn‐1⋅sn‐1+an‐1⋅bn‐1⋅sn‐1
Inpractice,realsystemsdetectoverflowfromCin≠Couttothelaststage.Thatis,wedetectoverflowfrom V=cn⋅cn‐1+cn⋅cn‐1. Demonstratethatthisexpressioniscorrect.
SOLUTION Thediagramillustratesthemost‐significantstage ofaparalleladderthataddstogetherbitsan‐1,bn‐1,andcn‐1 togenerateasumbit,sn‐1,andacarry‐out,cn.There arefourpossiblecombinationsof A and B whichcanbe addedtogether: +A++B +A+‐B ‐A++B ‐A+‐B Becauseaddingtwonumbersofdifferingsigncannot resultin arithmeticoverflow,weneedconsideronlythe caseswhereAandBarebothpositive,andwhereAandBarebothnegative. Case1:AandBarepositive;thatis,an‐1=0,bn‐1=0 Thefinalstageadds an‐1+bn‐1 +cn‐1togetcn.Because an‐1andbn‐1areboth0(bydefinitionifthenumbersare positive),thecarry‐out,cn,is0,andsn‐1=cn‐1. Weknowthatoverflowoccursifsn‐1=1(i.e.,thesignbitofthesumisnegative),thereforeoverflowoccursifcn⋅ Cn‐1=1. Case2:AandBarenegative;thatis,an‐1=1,bn‐1=1. Thefinalstageaddsan‐1+bn‐1+cn‐1=1+1+cn‐1,togetasum,Sn‐1=cn‐1,andacarry‐outcn=1. Overflowoccursifsn‐1=0.Consequently,overflowoccurswhencn‐1=0andcn⋅cn‐1=1. Consideringbothcases,overflowoccursifcn⋅cn‐1+cn⋅cn‐1=1. 22 © 2014 Cengage Learning. All Rights Reserved. May not be scanned, copied, or duplicated, or posted to a publicly available website, in whole or in part.
22.
Whatisthedifferencebetweenatruncationerrorandaroundingerror?
SOLUTION Atruncationerroroccurswhenanumberisroundedbychoppingoffbits; forexample,0.1110111istruncated tofivebitsas0.11101bychoppingoffthelasttwo bits(11).Roundingis similar totruncationinthesensethat bitsareremoved.Whenanumberistruncated,the bitsremoved areexamined. If they are less than halfthe value of the least‐significant bit, then the bits are just dropped. If they are equal to or greater than half the least‐significantdigit,theleastsignificantdigitisroundedup. Forexample0.1110111wouldberoundedupto0.11101+1=0.11110,whereas0.1110001wouldberounded down to 0.11100. Truncation leads to a systematic or biased error (the rounding is always down). Rounding leads to an unbiased error (the error is sometimes positive and sometimes negative). However, rounding is moredifficulttoperformasitrequiresanextraaddition. 23.
Positive and negative numbers can be represented in many ways in a computer. List some of the ways of representingsignednumbers.Canyouthinkofanyotherwaysofrepresentingsignedvalues? SOLUTION Therearefourcommonwaysofrepresentingsignednumbersincomputing: a. One’scomplement;thenumber begins with 0 forpositive values and1 for negativevalues. If thenumber has n bits, n‐1 bits are used for the number and one for its polarity (i.e., sign). A negative number is obtained from a positive number by inverting bits; for example, if 12 in six bits is 001100 then ‐12 is 110011. One’s complement is little used today. It has thedisadvantagethat therearetwo valuesforzero: 000…0is+0and111…1is‐0. b. Two’scomplement:like1’scomplement,themost‐significantbitisasignbit.Atwo’scomplementnumber isformedbyinvertingthe bitsand thenadding 1 (i.e.,one’s and two’s complement negativevaluesdiffer by1).If12is001100,‐12is110011+1=110100.Atwo’scomplementnumberhasasinglevalueforzero, 000...0,andisatruecomplementbecause × +‐x=0(e.g.,12+‐12=001100 +110100 =1000000).The addition of...