计算机组成原理第2章习题答案

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

第2章习题及解答2-2将下列十进制表示成二进制浮点规格化的数(尾数取12位,包括一位符号位;阶取4位,包括一位符号位),并写出它的原码、反码、补码三和阶移尾补四种码制形式;(1)7.75解:X=7.75=(111.11)2=0.11111×211[X]原=0011×0.11111000000[X]反=0011×0.11111000000[X]补=0011×0.11111000000[X]阶称,尾补=1011×0.11111000000(2)–3/64解:X=-3/64=(-11/26)2=(-0.00001)2=-0.11×2-100[X]原=1100×1.11000000000[X]反=1011×1.00111111111[X]补=1100×1.01000000000[X]阶称,尾补=0100×1.01000000000(3)83.25解:X=-3/64=(1010011.01)2=0.101001101×2111[X]原=0111×0.101001101[X]反=[X]补=[X]原[X]阶称,尾补=1111×0.10100110(4)–0.3125解:X=(–0.3125)10=(-0.0101)2=-0.101×2-1[X]原=1001×1.10100000000[X]反=1110×1.01011111111[X]补=1111×1.01100000000[X]阶称,尾补=0111×1.011000000002-4已知x和y,用变形补码计算x+y,并对结果进行讨论。(2)x=0.11101,y=-0.10100解:[X]补=00.11101,[Y]补=11.01100,[-Y]补=00.10100[X]补+[Y]补=00.11101+11.01100=00.01001X+Y=0.01001[X]补-[Y]补=[X]补+[-Y]补=00.11101+00.10100=01.10001X+Y正溢(3)x=-0.10111,y=-0.11000解:[X]补=11.01001,[Y]补=11.01000,[-Y]补=00.11000[X]补+[Y]补=11.01001+11.01000=11.10001X+Y=-.011111[X]补-[Y]补=[X]补+[-Y]补=11.01001+00.11000=00.00001X-Y=0.000012-5已知x和y,用变形补码计算x-y,并对结果进行讨论。(1)x=0.11011,y=0.11101解:[X]补=00.11011,[Y]补=00.11101,[-Y]补=11.00011[X]补+[Y]补=00.11011+00.11101=01.11000X+Y正溢[X]补-[Y]补=[X]补+[-Y]补=00.11011+11.00011=11.11110X-Y=-0.00010(2)x=0.11111,y=-0.11001解:[X]补=00.11111,[Y]补=11.00111,[-Y]补=00.11001[X]补+[Y]补=00.11111+11.00111=00.00110X+Y=0.00110[X]补-[Y]补=[X]补+[-Y]补=00.11111+00.11001=01.1100X-Y正溢2-6用原码一位乘法和补码一位乘法计算x×y=?(2)x=-0.11010,y=-0.01011解|x|=00.11010(用双符号表示),|y|=0.01011(用单符号表示)部分积乘数yn说明00.0解|x|=00.11010(用双符号表示),|y|=0.01011(用单符号表示)部分积乘数yn说明00.000000.01011yn=1,加|x|+00.1101000.1101000101100.0110100.0101右移一位得p1+00.11010yn=1,加|x|01.0011100.010100.10011100.010右移一位得p2+00.00000yn=0,加000.10011100.01000.010001100.01右移一位得p3+00.11010yn=1,加|x|01.000101100.0100.1000111100.0右移一位得p4+00.00000yn=1,加|x|00.1000111100.100.01000111100.右移一位得p5ps=xs⊕ys=1⊕1=0|p|=|x|•|y|=0.0100011110所以[x•y]原=0.100011110解[x]补=11.00110,[–x]补=00.11010(用双符号表示),[y]补=1.10101(用单符号表示)部分积乘数ynyn+1说明00.000001.101010+00.11010ynyn+1=10.加[–x]补00.1101000.0110101.10101右移一位得p1+11.00110ynyn+1=01.加[x]补11.1001111.11001101.1010右移一位得p2+00.11010ynyn+1=10.加[–x]补00.1001100.010011101.101右移一位得p311.00110ynyn+1=01加[x]补11.0111111.1011111101.10右移一位得p4+00.11010ynyn+1=10.加[–x]补001000111101.100001000111101.1ynyn+1=11右移00001000111101.最后不移位[x•y]补=0.01000111102-7用补码两位乘法计算x×y=?(1)x=0.10110,y=-0.00011答案为:[x•y]补=1.1110111110解解[x]补=000.10110,[-x]补=111.01010,2[-x]补=110.10100,2[x]补=001.01100[y]补=1.11101(尾数为5,是偶数,用单符号位表示)部分积乘数ynyn+1说明000.000001.111010000.10110yn-1ynyn+1=010加[x]补000.10110000.00101101.1110右移两位111.01010yn-1ynyn+1=110加[-x]补111.01111101.1110111.1101111101.11右移两位000.00000yn-1ynyn+1=1110111.1101111101.11最后的位移一位111.11101111101.1故[x×y]补=1.11101111102-8用原码不恢复余数法和补码不恢复余数法计算x÷y=?(1)x=0.10101,y=0.11011原码不恢复余数法[|x|]补=00.10101,[|y|]补=00.11011,[–|y|]补=11.00101(用双符号表示)被除数x/余数r商数q说明00.10101+[–|y|]补11.00101减去除数11.110100余数为负,商上0←11.101000r和q左移一位+[|y|]补00.11011加上除数00.011110.1余数为正,商上1←00.111100.1r和q左移一位+[–|y|]补11.00101减去除数00.000110.11余数为正,商上1←00.001100.11r和q左移一位+[–|y|]补11.00101减去除数11.010110.110余数为负,商上0←10.101100.110r和q左移一位+[|y|]补00.11011加上除数11.100010.1100余数为负,商上0←11.000100.110r和q左移一位+[|y|]补00.11011加上除数11.111010.11000余数为负,商上0QS=XS⊕YS=0⊕0=0答案为:[x/y]原=0.11000,解[x]补=00.10101,[y]补=00.11011,[–y]补=11.00101(用双符号表示)被除数x/余数r商数q说明00.10101+[-y]补11.00101x和y同号,[x]补+[-y]补11.110100余数与y异号,商上0←11.101000r和q左移一位+[y]补00.110110.1加上除数00.011110.1余数与y同号,商上1,←0.0111100.1r和q左移一位+[y]补11.0010101减去除数00.000110.11余数与y同号,商上1←0.0001100.11r和q左移一位+[–y]补11.00101减去除数11.010011.110余数与y异号,商上0←10.100101.011r和q左移一位+[y]补00.11011加上除数11.100011.0110余数与y异号,商上0←11.000101.011r和q左移一位+[y]补00.11011加上除数11.111011.01100余数与y异号,商上0不能除尽,商为正,不需校正:[x/y]补=[x/y]补=0.11000,答案为:[x/y]原=0.11000,[x/y]补=0.11000,2-9设数的阶码为3位,尾数为6位(均不包括符号位),按机器补码浮点运算步骤,完成下列[x+y]补,和[x-y]补的运算;(1)x=2-011×0.100100,y=2-010×(-0.011010)解:为了便于直观理解,假设两数均以补码表示,阶码采用双符号位,尾数采用双符号位,则它们的浮点表示分别为:[X]补=11.101,00.100100[Y]补=11.110,11.100110[-Y]补=11.110,00.011010(1)求阶差并对阶:[-Ey]补=00.010ΔE=Ex–Ey=[Ex]补+[-Ey]补=11.101+00.010=11111即ΔE为–1,x的阶码小,应使Mx右移1位,Ex加1,[X]浮=11.110,00.010010(2)尾数和差[Mx]补+[My]补=00.010010+11.100110=11.111000[Mx]补-[My]补=00.010010+00.011010=00.101100(3)规格化处理尾数运算结果的符号位与最高数值位为同值,[Mx]补+[My]补应执行左规3位,阶减3,结果为11.000000,阶码为11011。[Mx]补-[My]补不要规格化(4)判溢出阶码符号位为11,不溢出,故得最终结果为x+y=2-101×(-1)=2-5×(-1)x-y=2-010×(0.101100)2-10如何判断浮点数据运算的溢出?答:用阶的降号位2-12影响加法器速度的主要因素是什么?如何提高加法器的工作速度?答:是生产进位传递时间,采用分组进位的方法,组内并行进位,组间并行进位。2-13某加法器最低进位为第0位,分别按串行进位方式和并行进位方式写出进位信号C4的逻辑表达式(从原始输入到产生C4)。串行进位C1=G1+P1C0,C1=G2+P2C1,C3=G3+P3C2,C4=G4+P4C3,并行进位C1=G1+P1C0C2=G2+P2C1=G2+P2(G1+P1C0)=G2+P2G1+P2P1C0C3=G3+P3C2=G3+P3(G2+P2C1)=G3+P3G2+P3P2G1+P3P2P1C0C4=G4+P4G3+P4P3G2+P4P3P2G1+P4P3P2P1C02-14某加法器采用组内并行、组间并行的进位链,四位一组,写出进位信号C6的逻辑表达式。C6=G6+P6G5+P6P5(G*1+P*1C0)2-15利用74181和74182芯片构成一个32位的ALU,采用多级分组并行进位链。SN741814GP4SN741813G3PSN741812G2PSN741814A1A1G1PSN741821G1P△△C128CC4SN74182△2△G2P17A17B32A32B16CC32C2028C24C同右边~~B1B4~F1F4FF58~BAAB~5~858FF~1613FF~129B~16B13A~B16A13B~A91212A~9********C032位三重进位方式

1 / 6
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功