计算机组成原理课后答案第五章第1页共9页1.已知X和Y,试用它们的变形补码计算出X+Y,并指出结果是否溢出。(1)X=0.11011,Y=0.11111(2)X=0.11011,Y=-0.10101(3)X=-0.10110,Y=-0.00001(4)X=-0.11011,Y=0.11110解:(1)[X]补=0.11011,[Y]补=0.1111100.11011[X]补+00.11111[Y]补01.11010[X+Y]补结果正溢(2)[X]补=0.11011,[Y]补=1.0101100.11011[X]补+11.01011[Y]补00.00110[X+Y]补X+Y=0.00110(3)[X]补=1.01010,[Y]补=1.1111111.01010[X]补+11.11111[Y]补11.01001[X+Y]补X+Y=-0.10111(4)[X]补=1.00101,[Y]补=0.1111011.00101[X]补+00.11110[Y]补00.00011[X+Y]补X+Y=0.000112.已知X和Y,试用它们的变形补码计算出X-Y,并指出结果是否溢出。(1)X=0.11011,Y=-0.11111(2)X=0.10111,Y=0.11011(3)X=0.11011,Y=-0.10011(4)X=-0.10110,Y=-0.00001解:(1)[X]补=0.11011,[Y]补=1.00001,[-Y]补=0.1111100.11011[X]补+00.11111[-Y]补01.11010[X-Y]补结果正溢(2)[X]补=0.10111,[Y]补=0.11011,[-Y]补=1.0010100.10111[X]补+11.00101[-Y]补11.11100[X-Y]补X-Y=-0.00100(3)[X]补=0.11011,[Y]补=1.01101,[-Y]补=0.1001100.11011[X]补+00.10011[-Y]补计算机组成原理课后答案第五章第2页共9页01.01110[X-Y]补结果正溢(4)[X]补=1.01010,[Y]补=1.11111,[-Y]补=0.0000111.01010[X]补+00.00001[-Y]补11.01011[X-Y]补X-Y=-0.101013.已知:X=0.1011,Y=-0.0101求:[1/2X]补,[1/4X]补,[-X]补,[1/2Y]补,[1/4Y]补,[-Y]补。解:[X]补=0.10111/2X补=0.0101,1/4X补=0.0010,[-X]补=1.0101[Y]补=1.10111/2Y补=1.1101,1/4Y补=1.1110,[-Y]补=0.01014.设下列数据长8位,包括1位符号位,采用补码表示,分别写出每个数据右移或左移2位之后的结果。(1)0.1100100(2)1.0011001(3)1.1100110(4)1.0000111解:(1)[X]补=0.11001001/4X补=0.0011001,[4X]补=0.00100002)[X]补=1.00110011/4X补=1.1100110,[4X]补=1.1100100(3)1.11001101/4X补=1.1111001,[4X]补=1.0011000(4)1.00001111/4X补=1.1100001,[4X]补=1.00111005.证明在全加器里,进位传递函数P=Ai+Bi=Ai⊕Bi。解:并行加法器中的每一个全加器都有一个从低位送来的进位和一个传送给较高位的进位。进位表达式为Ci=AiBi+(Ai⊕Bi)Ci-1欲证明Pi=Ai+Bi=Ai⊕Bi,也就是要证明Ci=AiBi+(Ai⊕Bi)Ci-1=AiBi+(Ai+Bi)Ci-1用卡诺图法,图4唱10(a)和4唱10(b)分别是两个逻辑表达式的卡诺图。两个卡诺图相同,两个逻辑表达式就相等,则进位传递函数的两种形式相等。6.某加法器采用组内并行、组间并行的进位链,4位一组,写出进位信号C6的逻辑表达式。解:最低一组的进位输出C4=G倡计算机组成原理课后答案第五章第3页共9页1+P倡1C0其中:G倡1=G4+P4G3+P4P3G2+P4P3P2G1P倡1=P4P3P2P1C5=G5+P5C4所以C6=G6+P6C5=G6+P6G5+P6P5C47.设计一个9位先行进位加法器,每3位为一组,采用两级先行进位线路。解:C1=G1+PC0C2=G2+P2G1+P2P1C0C3=G3+P3G2+P3P2G1+P3P2P1C0设:G倡1=G3+P3G2+P3P2G1,P倡1=P3P2P1则有:C3=G倡1+P倡1C0C6=G倡2+P倡2G倡1+P倡2P倡1C0C9=G倡3+P倡3G倡2+P倡3P倡2G倡1+P倡3P倡2P倡1C08.分别用原码乘法和补码乘法计算X×Y。(1)X=0.11011,Y=-0.11111(2)X=-0.11010,Y=-0.01110解:(1)原码乘法:所以|X×Y|=0.1101000101X×Y=-0.1101000101补码乘法:所以[X×Y]补=1.0010111011计算机组成原理课后答案第五章第4页共9页X×Y=-0.1101000101(2)X×Y=0.0101101100,过程略。10.根据补码两位乘法规则推导出补码3位乘法的规则。解:先根据补码1位乘法推出补码2位乘法规则,再根据补码2位乘法推出补码3位乘法规则。[Z′]补=2-1{[Z]补+(Yi+1-Yi)[X]补}[Z′′]补=2-1{[Z′]补+(Yi-Yi-1)[X]补}=2-2{[Z]补+(Yi+1+Yi-2Yi-1)[X]补}[Z′′′]补=2-1{[Z′′]补+(Yi-1-Yi-2)[X]补}=2-1{2-2{[Z]补+(Yi+1+Yi-2Yi-1)[X]补}+(Yi-1-Yi-2)[X]补}01=2-3{[Z]补+(Yi+1+Yi-2Yi-1)×[X]补+22×(Yi-1-Yi-2)[X]补}=2-3{[Z]补+(Yi+1+Yi+2Yi-1-4Yi-2)×[X]补}11.分别用原码和补码加减交替法计算X÷Y。(1)X=0.10101,Y=0.11011(2)X=-0.10101,Y=0.11011(3)X=0.10001,Y=-0.10110(4)X=-0.10110,Y=-0.11011解:(1)原码除法:因为Qs=Xs磑Ys=0磑0=0所以XY=0.11000+0.11000×2-50.11011补码除法:所以XY补=0.11001+1.11101×2-50.11011XY=0.11001+-0.00011×2-50.11011(2)中间过程略。原码除法:X÷Y=-0.11000+0.11000×2-50.11011补码除法:X÷Y=-0.11001+0.00011×2-50.11011(3)中间过程略。原码除法:X÷Y=-0.11000+0.10000×2-50.10110补码除法:X÷Y=-0.11001+0.00101×2-50.10110(4)中间过程略。原码除法:X÷Y=0.11010+0.00010×2-50.11011补码除法:X÷Y=0.11011-0.11001×2-50.11011计算机组成原理课后答案第五章第5页共9页12.设浮点数的阶码和尾数部分均用补码表示,按照浮点数的运算规则,计算下列各题:(1)X=2101×(-0.100010),Y=2100×(-0.111110)(2)X=2-101×0.101100,Y=2-100×(-0.101000)(3)X=2-011×0.101100,Y=2-001×(-0.111100)注:此题中阶码用二进制表示。求:X+Y,X-Y。解:(1)X=2101×(-0.100010),Y=2100×(-0.111110)[X]浮=0101;1.011110[Y]浮=0100;1.000010对阶:小阶向大阶看齐,ΔE=EA-EB=1,[Y]浮′=0101;1.100001对阶之后,尾数相加和相减。相加:11.011110+11.10000110.111111需右规一次,[X+Y]浮=0110;1.011111所以X+Y=2110×(-0.100001)相减:11.011110+00.01111111.111101需左规4次,[X-Y]浮=0001;1.010000所以X-Y=2001×(-0.110000)(2)X=2-101×0.101100,Y=2-100×(-0.101000)[X]浮=1011;0.101100[Y]浮=1100;1.011000对阶:小阶向大阶看齐。ΔE=EA-EB=-1[X]浮′=1100;0.010110对阶之后,尾数相加和相减。相加:00.010110+11.01100011.101110需左规一次,[X+Y]浮=1011;1.011100所以X+Y=2-101×(-0.100100)相减:00.010110+00.10100000.111110所以X-Y=2-100×0.111110(3)X=2-011×0.101100,Y=2-001×(-0.1计算机组成原理课后答案第五章第6页共9页11100)[X]浮=__________1101;0.101100[Y]浮=1111;1.000100对阶:小阶向大阶看齐。ΔE=EA-EB=-2[X]浮′=1111;0.001011对阶之后,尾数相加和相减。相加:00.001011+11.00010011.001111所以X+Y=2-001×(-0.110001)相减:00.001011+00.11110001.000111需右规一次,[X-Y]浮=0000;0.100011所以X-Y=2-000×0.10001113.设浮点数的阶码和尾数部分均用补码表示,按照浮点数的运算规则,计算下列各题:(1)X=23×13/16,Y=24×-9/16求:X×Y。(2)X=23×-13/16,Y=25×15/16求:X÷Y。解:(1)X=23×13/16,Y=24×-9阶码相加:EA+EB=3+4=7尾数相乘:由补码乘法规则求得:-0.01110101结果规格化:左规一次,X×Y=-0.11101010×26(2)X=23×-13/16,Y=25×15/16尾数调整:因为|X尾数|≤|Y尾数|,所以无需尾数调整。阶码相减EA-EB=3-5=-2尾数相除:由补码除法规则求得:-0.1101+-0.1101×2-40.1111X÷Y=-0.1101+-0.1101×2-40.1111×2-214.用流程图描述浮点除法运算的算法步骤。解:浮点除法运算的算法流程图如图4唱12所示。图4唱12浮点除法运算流程图15.设计一个1位5421码加法器。解:设1位被加数为A4A3A2A1,加数为B4B3B2B1。5421码的校正关系5421码的校正关系十进制数5421码C4S4S3S2S1校正前的二进制数C′4S′4S′3S′2S′1校正关系计算机组成原理课后答案第五章第7页共9页①0123400000000010001000011001000000000001000100001100100不校正②5678901000010010101001011011000010100110001110100001001若A<5,B<5,则+3校正③1011121314100001000110010100111010001101011100111110000计算机组成原理课后答案第五章第8页共9页10101若A或B≥5,B或A<5,则+3校正④151617181911000110011101011011111001010110110101111100011001若A≥5,B≥5,则+3校正①和在0~4范围内,不用校正,结果正确。②和在6~9范围内,当A<5,B<5,需+3校正,而当A<5,B≥5或A≥5,B<5时,不需校正。故校正函数为:A4B4(S′4+S′3S′2+S′3S′1)③和在10~14范围内,当A<5,B≥5,或A≥