| |||
fcsr(floating-point control and status register)是32位可读可写的寄存器,
它选择浮点运算操作的动态取整模式,保持精确的exception flags;
fcsr.frm(Rounding Mode) [7:5]
--------------------------------------------------------------------------------------------------------------------------------------------
Rounding Mnemonic Meaning
Mode
--------------------------------------------------------------------------------------------------------------------------------------------
000 RNE Round to Nearest, ties to Even 向偶舍入,舍入的值保证最靠近原浮点数值,
如果舍入为中间值,即舍还是入距离相等,
那么按其最末尾一位是奇数,则入,如果为偶数,则舍
001 RTZ Round towards Zero 向零取整;正数向小,负数向大取整;也是绝对值向小取整;
010 RDN Round Down (towards −∞) 向小取整;正负数向值小方向;正数绝对值向小,负数向绝对值大取整;
011 RUP Round Up (towards +∞) 向大取整;正负数向值大方向;正数绝对值向大,负数向绝对值小取整;
100 RMM Round to Nearest, ties to Max Magnitude 向最近的最大值舍入
101 Invalid. Reserved for future use.
110 Invalid. Reserved for future use.
111 DYN In instruction’s rm field, selects dynamic rounding mode; In Rounding Mode register, Invalid.
--------------------------------------------------------------------------------------------------------------------------------------------
fcsr.fflags [4:0]
--------------------------------------------------------------------------------------------------------------------------------------------
Flag Mnemonic Flag Meaning
--------------------------------------------------------------------------------------------------------------------------------------------
NV Invalid Operation 无效操作
DZ Divide by Zero 被零除
OF Overflow 上溢
UF Underflow 下溢
NX Inexact 非精确
--------------------------------------------------------------------------------------------------------------------------------------------