Computer composition and design work05 ——fifth verson

Computer Composition and Design Homework 5

3.20

[5] <§3.5> What decimal number does the bit pattern 0×0C000000 represent if it is a two’s complement integer? An unsigned integer?

  1. 首位为0,如果是int类型那么说明是正号,
    计算过程为
    C ( 12 ) × 1 6 6 = 201 , 326 , 592 C(12)\times 16^6 = 201,326,592 C(12)×166=201,326,592
  2. unsigned int的计算同上

3.22

[10] <§3.5> What decimal number does the bit pattern 0×0C000000 represent if it is a floating point number? Use the IEEE 754 standard

表示为2进制为
0   ( 符号位 ) 00011000   ( 指数位 ) 0000000000   0000000000   000 ( 小数部分 ) 0\ (符号位) 00011000\ (指数位)0000000000\ 0000000000\ 000(小数部分) 0 (符号位)00011000 (指数位)0000000000 0000000000 000(小数部分)
不难发现这个数是正数,且偏移量为24 - 127 = -103
所以该数为 1.0 × 2 − 103 1.0\times 2^{-103} 1.0×2103


3.23

[10] <§3.5> Write down the binary representation of the decimal number
63.25 assuming the IEEE 754 single precision format

63.25二进制表示为
111111.01 = 1.1111101 × 2 5 111111.01 = 1.1111101\times 2^{5} 111111.01=1.1111101×25
127+5 = 132 = 10000100(2)
于是表示如下
0 10000100 1111101000   0000000000   000 0\quad 10000100\quad 1111101000\ 0000000000\ 000 0100001001111101000 0000000000 000


3.24

[10] <§3.5> Write down the binary representation of the decimal number
63.25 assuming the IEEE 754 double precision format.

1023+5 = 1028 = 10000000100(2)
0 10000000100 1111101000   0000000000   0000000000   0000000000   0000000000   00 0\quad 10000000100\quad 1111101000\ 0000000000\ 0000000000\ 0000000000\ 0000000000\ 00 0100000001001111101000 0000000000 0000000000 0000000000 0000000000 00

3.25

[10] <§3.5> Write down the binary representation of the decimal number
63.25 assuming it was stored using the single precision IBM format (base 16,
instead of base 2, with 7 bits of exponent).

63.25 = 111111.01 ( 2 ) = 3 F . 40 ( 16 ) = 0.3 F 40 × 1 6 2 63.25 = 111111.01(2) = 3F.40(16) = 0.3F40\times16^2 63.25=111111.01(2)=3F.40(16)=0.3F40×162
标志位为0,指数位为 64 + 2 = 1000001 ( 2 ) 64+2 = 1000001(2) 64+2=1000001(2)
0   1000001 1111101000   0000000000   000 0\quad\ 1000001\quad 1111101000\ 0000000000\ 000 0 10000011111101000 0000000000 000
看答案貌似写指数位是64+2 这个IBM偏移量固定为64


3.26

[20] <§3.5> Write down the binary bit pattern to represent − 1.5625 × 1 0 − 1 -1.5625 \times 10^{-1} 1.5625×101assuming a format similar to that employed by the DEC PDP-8 (the left most 12 bits are the exponent stored as a two’s complement number, and the rightmost 24 bits are the fraction stored as a two’s complement number). No hidden 1 is used. Comment on how the range and accuracy of this 36-bit pattern compares to the single and double precision IEEE 754 standards.

− 1.5625 × 1 0 − 1 = − 0.15625 = − 0.00101 ( 2 ) = − 0.101 × 2 − 2 -1.5625 \times 10^{-1} = -0.15625 = -0.00101(2) = -0.101\times2^{-2} 1.5625×101=0.15625=0.00101(2)=0.101×22

所以指数 2 用补码表示为 000000000010 , − 2 为 111111111110 2用补码表示为000000000010,-2为111111111110 2用补码表示为0000000000102111111111110
总的表示为
111111111110 ( 12 位 ) 101000000000 000000000000 ( 24 位) 111111111110(12位)\quad101000000000\quad000000000000(24位) 111111111110(12)101000000000000000000000(24位)

  1. 指数可以表达的数字为 − 2048 ∼ 2047 -2048\sim2047 20482047
  2. 底数可表达 2 − 24 ∼ 1 − 2 − 24 2^{-24}\sim 1-2^{-24} 2241224
DEC PDP-8单精度双精度
最小正数 2 − 24 × 2 − 2048 2^{-24}\times2^{-2048} 224×22048 1 × 2 − 126 1\times2^{-126} 1×2126 1 × 2 − 1022 1\times2^{-1022} 1×21022
最大正数 ( 1 − 2 − 24 ) × 2 2047 (1-2^{-24})\times2^{2047} (1224)×22047 ( 1 + 1 − 2 23 ) × 2 127 (1+1-2^{23})\times2^{127} (1+1223)×2127 ( 1 + 1 − 2 52 ) × 2 1023 (1+1-2^{52})\times2^{1023} (1+1252)×21023

应该为DEC PDP-8能表示的范围更大

3.27

[20] <§3.5> IEEE 754-2008 contains a half precision that is only 16 bits
wide. Th e left most bit is still the sign bit, the exponent is 5 bits wide and has a bias
of 15, and the mantissa is 10 bits long. A hidden 1 is assumed. Write down the
bit pattern to represent − 1.5625 × 1 0 − 1 -1.5625 \times 10^{-1} 1.5625×101
assuming a version of this format, which
uses an excess-16 format to store the exponent. Comment on how the range and
accuracy of this 16-bit fl oating point format compares to the single precision IEEE
754 standard.

− 1.5625 × 1 0 − 1 = − 0.15625 = − 0.00101 ( 2 ) = − 1.01 × 2 − 3 -1.5625 \times 10^{-1} = -0.15625 = -0.00101(2) = -1.01\times2^{-3} 1.5625×101=0.15625=0.00101(2)=1.01×23

  1. 符号位为1表示负数
  2. 指数可表达的部分为1-30,偏移量为15,所以指数用12(01100)表示-3
  3. 底数部分以0100 0000 00
    1 01100 0100000000 1\quad 01100\quad 0100000000 1011000100000000

3.29

[20] <§3.5> Calculate the sum of 2.6125 × 1 0 1 2.6125\times 10^1 2.6125×101and 4.150390625 × 1 0 − 1 4.150390625\times 10^{-1} 4.150390625×101by hand, assuming A and B are stored in the 16-bit half precision described in Exercise 3.27. Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps.

2.6125 × 1 0 1 = 26.125 = 1.1010001 × 2 4 2.6125 \times 10^1=26.125 = 1.1010001\times 2^4 2.6125×101=26.125=1.1010001×24

4.150390625 × 1 0 − 1 = 1.1010100111 × 2 − 2 4.150390625\times 10^{-1} = 1.1010100111\times 2^{-2} 4.150390625×101=1.1010100111×22
向左移动6位以对齐指数

于是有(注意半精度只有11位用于保存)

1.1010001000

1.0000011010100111 /需要注意开头是1,剩下的部分需要舍去

1.1010100010

额外的位(有6位)超过有效位(11)位的一半,应该是进位

最后
1.1010100011 ( 进位 ) × 2 4 = 26.546875 1.1010100011(进位)\times 2^4 = 26.546875 1.1010100011(进位)×24=26.546875

3.32

[20] <§3.9> Calculate ( 3.984375 × 1 0 − 1 + 3.4375 × 1 0 − 1 ) + 1.771 × 1 0 3 (3.984375 \times 10^{-1} + 3.4375\times 10^{-1})+ 1.771 \times 10^3 (3.984375×101+3.4375×101)+1.771×103by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit fl oating point format and in decimal.

  保留位(Guard bit)、近似位(Round bit)和粘滞位(Sticky bit)。
  保留位:近似后的最低位
  近似位:保留位的后一位
  粘滞位:近似位后的所有位进行或运算后视作一位

3.984375 × 1 0 − 1 = 1.1001100000 × 2 − 2 3.984375 \times 10^{-1} = 1.1001100000\times 2^{-2} 3.984375×101=1.1001100000×22

3.4375 × 1 0 − 1 = 1.0110000000 × 2 − 2 3.4375\times 10^{-1} =1.0110000000\times 2^{-2} 3.4375×101=1.0110000000×22

1.771 × 1 0 3 = 1.1011101011 × 2 10 1.771 \times 10^3 = 1.1011101011\times 2^{10} 1.771×103=1.1011101011×210

(A)1.1001100000 × 2 − 2 \times 2^{-2} ×22
(B)+1.0110000000 × 2 − 2 \times 2^{-2} ×22
=10.1111100000 × 2 − 2 \times 2^{-2} ×22
=1.0111110000 × 2 − 1 \times 2^{-1} ×21
(A+B)1.0111110000 × 2 − 1 \times 2^{-1} ×21
=0.000000000010111110000 × 2 10 \times 2^{10} ×210
C1.1011101011 × 2 10 \times 2^{10} ×210(A+B多余的部分是101,超过0.5,应进位)
(A+B)+C=1.1011101100 × 2 10 \times 2^{10} ×210
=1772

3.33

[20] <§3.9> Calculate 3.984375 × 1 0 − 1 + ( 3.4375 × 1 0 − 1 + 1.771 × 1 0 3 ) 3.984375 \times 10^{-1} + (3.4375 \times 10^{-1} + 1.771 \times 10^3) 3.984375×101+(3.4375×101+1.771×103)by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit fl oating point format and in decimal.

3.984375 × 1 0 − 1 = 1.1001100000 × 2 − 2 3.984375 \times 10^{-1} = 1.1001100000\times 2^{-2} 3.984375×101=1.1001100000×22

3.4375 × 1 0 − 1 = 1.0110000000 × 2 − 2 3.4375\times 10^{-1} =1.0110000000\times 2^{-2} 3.4375×101=1.0110000000×22

1.771 × 1 0 3 = 1.1011101011 × 2 10 1.771 \times 10^3 = 1.1011101011\times 2^{10} 1.771×103=1.1011101011×210

(B)0.0000000000010110000000 × 2 10 \times 2^{10} ×210
©+1.1011101011 × 2 10 \times 2^{10} ×210
=1.1011101011 × 2 10 \times 2^{10} ×210
(A)0.0000000000011001100000 × 2 10 \times 2^{10} ×210
©+1.1011101011 × 2 10 \times 2^{10} ×210
=1.1011101011 × 2 10 \times 2^{10} ×210
=1771

3.34

[10] <§3.9> Based on your answers to 3.32 and 3.33, does ( 3.984375 × 1 0 − 1 + 3.4375 × 1 0 − 1 ) + 1.771 × 1 0 3 = 3.984375 × 1 0 − 1 + ( 3.4375 × 1 0 − 1 + 1.771 × 1 0 3 ) (3.984375 \times 10^{-1} + 3.4375 \times 10^{-1}) + 1.771 \times 10^3 = 3.984375 \times 10^{-1} + (3.4375\times 10^{-1} + 1.771 \times10^3) (3.984375×101+3.4375×101)+1.771×103=3.984375×101+(3.4375×101+1.771×103)?

并不相同,第一个为1772

第二个是1771

精确的解应该为1771.742187

《COMPUTER ORGANIZATION AND DESIGN.pdf》是一本关于计算机组织与设计的书籍。该书由图灵奖得主David A. Patterson和John L. Hennessy合著,于2017年出版。它提供了关于计算机硬件和软件接口的详细介绍,旨在帮助读者理解计算机系统的工作原理和设计方法。此书的PDF版本包含了高清的内容,可以复制文本,便于读者进行学习和参考。另外,还有一份单文件版的《Solution for Computer Organization and Design , Fifth Edition》也可以在其中找到。这个版本是由阅读者自行合并的,目的是为了方便阅读,并去除了批注水印。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [Computer Organization and Design 5th 习题答案(去水印单文件版)](https://download.csdn.net/download/mathscmc/11231852)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [Computer.Organization.and.Design.The.Hardware.Software.Interface.ARM.Edition.pdf](https://download.csdn.net/download/huntwin/11294211)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值