Finite State MachineWith Datapath Design
FIXED-POINT REPRESENTATION
Convert an unsigned decimal number to a X.Y fixed-point binary format
To convert an unsigned decimal number to a X.Y fixed-point format, multiply the decimal
number by 2^Y, drop any fractional remainder, and then convert this to its unsigned binary value using a N.0 format, where N = X + Y.
Convert an X.Y unsigned binary number to its decimal representation
To convert an X.Y unsigned binary number to its decimal representation, first convert the
number to its decimal representation assuming an N.0 format, where N = X + Y. Then divide this number by 2^Y to produce the final decimal result.
Example:
5.3 format
4.625*(2^3)(decimal) = 37(decimal) = 8'b00100101(binary)
8'b1000111(binary) = 143(decimal) = 143/(2^3)(decimal) = 17.875(decimal)
文章评论(0条评论)
登录后参与讨论