SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
Assembly syntax: | VBINLOG src1, dst |
Operation: | Binary log |
Classification: | 1-input 1-output |
Bit width: | 32-bit |
Delay slot: | one |
C statement: | As follows |
VBINLOG computes an approximate binary log, by detecting the left-most 1 bit in the input, encoding the bit position in bits 31..28, and left-justifying the following input bits in bits 27..0. The detected position of bit 31 is encoded as 15 (bit position minus 16), bit 30 as 14, and so on, and bit 17 as 1. If the left-most 1 bit is not found in bits 31..17, 0 is coded.
The VBINLOG operation is a non-standard floating point representation. Say a 32-bit integer x = 2^exp * (1 + frac/(2^28)), where exp and frac are integers. If (exp >= 16), binlog(x) = (exp – 16) * (2^28) + frac, concatenating the 4-bit adjusted exponent, exp – 16, with the 28-bit fraction. Otherwise, the representation is subnormal, leaving 0 in the exponent and bits 16..0 of input left-justified in the fraction part of output, bits 27..0.
For example, the number 0x0700_0000 has leading 1 in bit 26, so the bit position is coded as 26 – 16 = 10 = 0xA. The subsequent bits, two 1s immediately following the leading 1, left-justified in 28 bits or 7 hex digits, is 0xC00_0000. Thus the VBINLOG outcome of the number is 0xAC00_0000.
For a subnormal example, the number 0x8000 < 2^16 (is half of that), so its VBINLOG outcome is 0x0400_0000.
Input of VBINLOG is 32-bit, and so is the outcome, not 40-bit. VLMBD supports full 40-bit input range leading bit detection. VBINLOG is useful in compressing dynamic range and preserving precision. VBINLOG followed by table lookup can be used to produce the reciprocal of a number.