Danh mục

Bài giảng Computer Organization and Architecture: Chapter 9

Số trang: 41      Loại file: ppt      Dung lượng: 604.50 KB      Lượt xem: 7      Lượt tải: 0    
Hoai.2512

Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Computer Arithmetic thuộc Chapter 9 của "Bài giảng Computer Organization and Architecture" tập trung trình bày các vấn đề cơ bản về Arithmetic & Logic Unit; ALU Inputs and Outputs; Integer Representation; Sign-Magnitude;...
Nội dung trích xuất từ tài liệu:
Bài giảng Computer Organization and Architecture: Chapter 9William StallingsComputer Organizationand Architecture6th EditionChapter 9Computer ArithmeticArithmetic & Logic Unit• Doesthecalculations• Everythingelseinthecomputeristhereto servicethisunit• Handlesintegers• Mayhandlefloatingpoint(real)numbers• MaybeseparateFPU(mathscoprocessor)• MaybeonchipseparateFPU(486DX+)ALU Inputs and OutputsInteger Representation• Onlyhave0&1torepresenteverything• Positivenumbersstoredinbinary —e.g.41=00101001• Nominussign• Noperiod• SignMagnitude• Two’scomplimentSign-Magnitude• Leftmostbitissignbit• 0meanspositive• 1meansnegative• +18=00010010• 18=10010010• Problems —Needtoconsiderbothsignandmagnitudein arithmetic —Tworepresentationsofzero(+0and0)Two’s Compliment• +3=00000011• +2=00000010• +1=00000001• +0=00000000• 1=11111111• 2=11111110• 3=11111101Benefits• Onerepresentationofzero• Arithmeticworkseasily(seelater)• Negatingisfairlyeasy —3=00000011 —Booleancomplementgives 11111100 —Add1toLSB 11111101Geometric Depiction of Twos ComplementIntegersNegation Special Case 1• 0=00000000• Bitwisenot11111111• Add1toLSB+1• Result100000000• Overflowisignored,so:• 0=0Negation Special Case 2• 128=10000000• bitwisenot01111111• Add1toLSB+1• Result10000000• So:• (128)=128X• MonitorMSB(signbit)• ItshouldchangeduringnegationRange of Numbers• 8bit2scompliment —+127=01111111=271 —128=10000000=27• 16bit2scompliment —+32767=01111111111111111=2151 —32768=10000000000000000=215Conversion Between Lengths• Positivenumberpackwithleadingzeros• +18=00010010• +18=0000000000010010• Negativenumberspackwithleadingones• 18=11101110• 18=1111111111101110• i.e.packwithMSB(signbit)Addition and Subtraction• Normalbinaryaddition• Monitorsignbitforoverflow• Taketwoscomplimentofsubstahendandadd tominuend —i.e.ab=a+(b)• Soweonlyneedadditionandcomplement circuitsHardware for Addition and SubtractionMultiplication• Complex• Workoutpartialproductforeachdigit• Takecarewithplacevalue(column)• AddpartialproductsMultiplication Example• 1011Multiplicand(11dec)• x1101Multiplier(13dec)• 1011Partialproducts• 0000Note:ifmultiplierbitis1copy• 1011 multiplicand(placevalue)• 1011 otherwisezero• 10001111Product(143dec)• Note:needdoublelengthresultUnsigned Binary MultiplicationExecution of ExampleFlowchart for Unsigned Binary MultiplicationMultiplying Negative Numbers• Thisdoesnotwork!• Solution1 —Converttopositiveifrequired —Multiplyasabove —Ifsignsweredifferent,negateanswer• Solution2 —Booth’salgorithm

Tài liệu được xem nhiều: