From: Jacob Lifshay Date: Wed, 17 May 2023 02:10:03 +0000 (-0700) Subject: add bfp_CONVERT_FROM_UI32/64 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5632cf71d4dfd2a711b4e8c43f4f0d8c88042da;p=openpower-isa.git add bfp_CONVERT_FROM_UI32/64 --- diff --git a/openpower/isafunctions/bfp.mdwn b/openpower/isafunctions/bfp.mdwn index 08409e8f..44ac7871 100644 --- a/openpower/isafunctions/bfp.mdwn +++ b/openpower/isafunctions/bfp.mdwn @@ -165,6 +165,60 @@ section 7.6.2.2 result.exponent <- result.exponent - 1 return result + def bfp_CONVERT_FROM_UI32(x): + # x is an integer value represented in unsigned word integer + # format. + + result <- BFPState() + result.sign <- 0 + result.exponent <- 0 + result.significand <- 0 + result.class.SNaN <- 0 + result.class.QNaN <- 0 + result.class.Infinity <- 0 + result.class.Zero <- 0 + result.class.Denormal <- 0 + result.class.Normal <- 0 + + if x = 0x0000_0000 then + result.class.Zero <- 1 + else + result.class.Normal <- 1 + result.sign <- 0 + result.exponent <- 32 + result.significand[0:32] <- 0b0 || x + do while result.significand[0] = 0 + result.significand <- result.significand * 2 + result.exponent <- result.exponent - 1 + return result + + def bfp_CONVERT_FROM_UI64(x): + # x is an integer value represented in unsigned double-word integer + # format. + + result <- BFPState() + result.sign <- 0 + result.exponent <- 0 + result.significand <- 0 + result.class.SNaN <- 0 + result.class.QNaN <- 0 + result.class.Infinity <- 0 + result.class.Zero <- 0 + result.class.Denormal <- 0 + result.class.Normal <- 0 + + if x = 0x0000_0000_0000_0000 then + result.class.Zero <- 1 + else + result.class.Normal <- 1 + result.sign <- 0 + result.exponent <- 64 + result.significand[0:64] <- 0b0 || x + do while result.significand[0] = 0 + result.significand <- result.significand * 2 + result.exponent <- result.exponent - 1 + return result + def bfp_CONVERT_FROM_UI128(x): # x is a 128-bit unsigned integer value.