浮点运算单元PPT演示课件.ppt

上传人:rrsccc 文档编号:10904759 上传时间:2021-06-11 格式:PPT 页数:47 大小:1.46MB
返回 下载 相关 举报
浮点运算单元PPT演示课件.ppt_第1页
第1页 / 共47页
浮点运算单元PPT演示课件.ppt_第2页
第2页 / 共47页
浮点运算单元PPT演示课件.ppt_第3页
第3页 / 共47页
浮点运算单元PPT演示课件.ppt_第4页
第4页 / 共47页
浮点运算单元PPT演示课件.ppt_第5页
第5页 / 共47页
点击查看更多>>
资源描述

《浮点运算单元PPT演示课件.ppt》由会员分享,可在线阅读,更多相关《浮点运算单元PPT演示课件.ppt(47页珍藏版)》请在三一文库上搜索。

1、1,浮点运算单元,2,浮点运算,Floating-Point Numbers IEEE 754 Floating-Point Standard Floating-Point Addition and Subtraction Floating-Point Multiplication,3,浮点数在计算机内的格式,浮点数: X = MS ES Em-1 .E2 E1 M-1M-2.M-n,符号位 阶码位 尾数数码位 总位数,短浮点数: 1 8 23 32,长浮点数: 1 11 52 64,临时浮点数: 1 15 64 80,IEEE 标准:阶码用移码,基为2;尾数用原码,浮点数的阶码的位数决定数的

2、表示范围, 尾数的位数决定数的有效精度。,4,浮点数在计算机内的格式,IEEE 标准:尾数用原码,浮点数是数学中实数的子集合,由一个纯小数乘上一个指数值来组成。在计算机内,其纯小数部分被称为浮点数的尾数,对非 0 值的浮点数,要求尾数的绝对值必须 = 1/2,称满足这种表示要求的浮点数为规格化表示; 把不满足这一表示要求的尾数,变成满足这一要求的尾数的操作过程,叫作浮点数的规格化处理,通过尾数移位和修改阶码实现。,5,浮点数在计算机内的格式,IEEE 标准:尾数用原码,按国际电子电气工程师协会规定的标准,浮点数的尾数要用原码表示,即符号位 Ms: 0 表示正,1 表示负,且非 0 值尾数数值的

3、最高位 M-1 必为 1, 才能满足浮点数规格化表示的要求; 既然非 0 值浮点数的尾数数值最高位必定为 1,则在保存浮点数到内存前,通过尾数右移, 强行把该位去掉, 用同样多的尾数位就能多存一位二进制数,有利于提高数据表示精度,称这种处理方案使用了隐藏位技术。 当然,在取回这样的浮点数到运算器执行运算时,必须先恢复该隐藏位。,6,Floating Point,7,浮点数在计算机内的格式,X = Ms Es Em-1 .E1 E0 M-1 M-2 .M-n,IEEE 标准:阶码用移码,基为2,按国际电子电气工程师协会规定的国际通用标准,浮点数的阶码用整数给出,并且要用移码表示,用作为以 2为底

4、的指数的幂。既然该指数的底一定为 2 ,可以不必在浮点数的格式中明确表示出来, 只需给出阶码的幂值即可。 移码表示只用于表示整数,只用在浮点数的阶码部分,其定义类似于整数的补码定义,差别在符号位。 移码的符号位是 0 表示负,1 表示正,与补码的符号位正好相反,移码是指机器数在数轴上有个移位关系; 移码的数值位则与补码的数值位完全相同。,8,浮点数格式:关于移码的知识,移码表示整数,用在浮点数的阶码部分。 一位符号位和 n 位数值位组成的移码, 其定义为; E移 = 2n + E -2n=E2n 表示范围: 00000000 11111111,9,浮点数格式:关于移码的知识,一位符号位和 n

5、位数值位组成的移码, 其定义为; E移 = 2n + E -2n=E2n 表示范围: 00000000 11111111 负数 正数 机器数,0,移码只执行二数的加减运算与增 1、 减 1 操作。加减运算时,符号位计算结果求反后, 才是加减运算的正确符号位的值。 注意:当用双符号位时,00代表负,01代表正,而不是11代表正,8 位的阶码能表示-128+127,当阶码为-128时,其补码表示为 00000000,该浮点数的绝对值2-128,人们规定此浮点数的值为零,若尾数不为 0 就清其为 0,并特称此值为机器零。,8 位移码表示的机器数为数的真值 在数轴上向右平移了 128 个位置,-128

6、,+127,10,Biased Exponent,Value of exponent = val(E) = E Bias (Bias is a constant) 8 bits for single precision E can be in the range 0 to 255 E = 0 and E = 255 are reserved for special use E = 1 to 254 are used for normalized floating point numbers Bias = 127 (half of 254), val(E) = E 127 val(E=1) =

7、126, val(E=127) = 0, val(E=254) = 127,11,Example of Exponent,12,Example of Normalized Mantissa,13,Biased Exponent,14,Example of Floating Point,15,Largest Normalized Float,16,Smallest Normalized Float,17,Zero Infinity NaN,18,Denormalized numbers,19,Zero can be implemented in various ways (e.g., carry

8、-look-ahead or conditional sum) Round-to-nearest-even - use rounding bits to determine which of the two should be selected These two are sufficient even if a single bit overflow occurs In case of overflow, 1 is added in R position (instead of LSB position), and since R=1 if rounding needed, a carry

9、will propagate to LSB to generate correct sum+1 Directed roundings - R not necessarily 1 - sum+2 may be needed,40,Effective Subtraction,Massive cancellation of most significant bits may occur - resulting in lengthy postnormalization Happens only when exponents of operands are close (difference 1) -

10、pre-alignment can be eliminated Two separate procedures - (1) exponents are close (difference 1) - only a postnormalization shift may be needed (2) exponents are far (difference1) - only a pre-alignment shift may be needed,41,CLOSE Case,Exponent difference predicted based on two least significant bi

11、ts of operands - allows subtraction of significands to start as soon as possible If 0 - subtract executed with no alignment If 1 - significand of smaller operand is shifted once to the right (using a multiplexor) and then subtracted from other significand In parallel - true exponent difference calcu

12、lated If 1 - procedure aborted and FAR procedure followed If 1 - CLOSE procedure continued In parallel with subtraction - number of leading zeros predicted to determine number of shift positions in postnormalization,42,CLOSE Case - Normalization and Rounding,Next - normalization of significand and c

13、orresponding exponent adjustment Last - rounding - precomputing sum, sum+1 - selecting the one which is properly rounded - negation of result may be necessary Result of subtraction usually positive - negation not required Only when exponents equal - result of significand subtraction may be negative

14、(in twos complement) - requiring a negation step Negation and rounding steps - mutually exclusive,43,FAR Case,First - exponent difference calculated Next - significand of smaller operand shifted to right for alignment Shifted-out bits used to set sticky bit Smaller significand subtracted from larger

15、 -result either normalized. Last step - rounding,44,Leading Zeros Prediction Circuit,Predict position of leading non-zero bit in result of subtract before subtraction is completed Allowing to execute postnormalization shift immediately following subtraction Examine bits of operands (of subtract) in

16、a serial fashion, starting with most significant bits to determine position of first 1 This serial operation can be accelerated using a parallel scheme similar to carry-look-ahead,45,Leading Zeros Prediction Circuit,Predict position of leading non-zero bit in result of subtract before subtraction is

17、 completed Allowing to execute postnormalization shift immediately following subtraction Examine bits of operands (of subtract) in a serial fashion, starting with most significant bits to determine position of first 1 This serial operation can be accelerated using a parallel scheme similar to carry-

18、look-ahead,46,Alternative Prediction of Leading 1,Generate in parallel intermediate bits ei - ei=1 if ai = bi and ai-1 and bi-1 allow propagation of expected carry (at least one is 1) Subtract executed by forming ones complement of subtrahend and forcing carry into least significant position - carry

19、 expected,47,ei = (ai bi) (ai-1 + bi-1) - ei=1 if carry allowed to propagate to position i If forced carry propagates to position i - i-th bit of correct result will also be 1 If not - correct result will have a 1 in position i-1 instead Position of leading 1 - either same as ei or one to the right Count number of leading zeros in ei - provide count to barrel shifter for postnormalization - at most one bit correction shift (left) needed,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1