Variable bint : std_logic_vector ( 7 downto 0 ) := bin įor i in 0 to 7 loop - repeating 8 times.īcd ( 11 downto 1 ) := bcd ( 10 downto 0 ) -shifting the bits.īint ( 7 downto 1 ) := bint ( 6 downto 0 ) Variable bcd : std_logic_vector ( 11 downto 0 ) := ( others => ' 0' ) Exponent too small, floating point underflow, set to zero.Įnd else begin // // Case 2b: Adjust significand and exponent.Įnd end else begin // // Case 3: Sum is zero.Function to_bcd ( bin : std_logic_vector ( 7 downto 0 ) ) return std_logic_vector is if ( aneg ) asig = -asig īegin // / Step 6: Take absolute value of sum. If it were would need to set bexp = aexp īegin // / Step 4: If necessary, negate significands. Compute amount to shift significand and reduce exponent. Find position of first non-zero digit.įor (i = 52 i >= 0 i = i - 1 ) if ( !pos & sumsig ) pos = i Right shift significand and increment exponent.Įnd else if ( sumsig ) begin: A // // Case 2: Sum is nonzero and did not overflow. (Three cases.) // if ( sumsig ) begin // // Case 1: Sum overflow. / Step 4: If necessary, negate significands. If it were would need to set bexp = aexp 31: S: Sign bit: 1 negative, 0 positive. / IEEE 754 Single Format // // Format: SEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFF Significand may not include MSB (if not, it's 1). // Slight Complications (but for good reason): Can use signed integer magnitude and equality tests. + and - Infinity, and other special values. // Keep things simple for an introductory computer class. / Objectives of Standard // // Represent range of numbers in common use. Results of arithmetic operations, including rounding. / Standard Specifies // // Formats of FP numbers. / Multiplication Using Scientific Notation // // Consider: That is, right-shift b_scand by (a_exp - b_exp) bits. // Set b'scand = b_scand / 2^(a_exp - b_exp) // To convert decimal number x, 0 = 1/2, digit is 1, x = x - 1/2 // // Fixed Point Decimal to Binary Conversion / Binary Fixed Point Representation // // // Each digit position has a multiplier. // Computer representations for FP numbers covered in the next section, // Among other things, that means the number of bits needed to store a IEEE 754) are NOT computer representations. / Binary Floating-Point (FP) Representations // // The floating-point (FP) representations in this section (before / Binary Floating-Point Representation and Arithmetic // :PH: 3.5 / References // // :PH: Patterson & Hennessy, "Computer Organization & Design", 4th Edition L08.v // / LSU EE 3755 - Fall 2012 - Computer Organization // // / Verilog Notes 8 - Floating Point // Time-stamp: // / Contents // // Binary Floating-Point Representation and Arithmetic
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |