Giter VIP home page Giter VIP logo

fpu-ieee-754's Introduction

FPU-IEEE-754

Synthesizable Floating point unit written using Verilog. Supports 32-bit (Single-Precision) Multiplication, Addition, Division and Square root Operations based on the IEEE-754 standard for floating point numbers.

  • FloatingAddition.v : For both addition and subtraction of single precision floating point numbers. For subtraction operation, invert the sign bit of the second operand. Values Truncated not rounded.
  • FloatingMultiplication.v : For Multiplication of floating point numbers. Values Truncated not rounded.
  • FloatingDivision.v : Uses Newton Raphson Iterations to find the reciprocal of the Divisor and then Multiplies the Reciprocal with the Dividend. Uses 8 multiplication instances and 3 addition instances
    Division Algorithm : A/B 
        Intial Seed : x0 = 48/17 - (32/17)*D
        where D - Divisor B adjusted to fit 0.5-1 range by replacing the exponent field with 8'd126
        
        Newton Raphson Iterations :
                      x1 = x0*(2-D*x0)
                      x2 = x1*(2-D*x1)
                      x3 = x2*(2-D*x2)
        x3 - Reciprocal of Adusted value D.
        Adjust the exponents to produce the final reciprocal of B 
        1/B : {B[31],x3[30:23]+8'd126-B[30:23],x3[22:0]}
        Final Value A*1/B
    
  • FloatingSqrt.v : Uses Newton Raphson Iterations to find the square root. Uses 3 Division , 3 Addition and 2 Multiplication Instances.
    Square root Algorithm : A^0.5
        A split into two parts -> M * 2^E
        A ^ 0.5 = (M * 2^E) ^ 0.5
                = M^0.5 * 2^(E/2)
        X = M^0.5 ; Z = 2^(E/2)
    M adjusted to fit the range 0.5-1 by replacing exponent with 8'd126 (actual exponent = 126-127 = -1).
        X = ( M * 1 )^0.5
        X = ( M * 2^(126-127) / 2^(126-127) ) ^0.5
        X = ( M* 2^(126-127)) ^ 0.5 / 2^(-0.5)
        X = ( M* 2^(126-127)) ^ 0.5 * 1/ 2^(-0.5)
        C = 1/ 2^(-0.5) is already known and multiplied at the end
        Y =  M* 2^(126-127)) ^ 0.5 is computed using Newton Raphson Iterations and Inserted in the equation
        thus X becomes -> X = Y*C
        2^(E/2) is basically exponent adjust and based on the value of E (Multiple of 2 or not).
        The resulting expression is multiplied by 2^(0.5) if the exponent is not a multiple of 2.
        values readjusted at the end.
        Intial Seed : x0 = 0.853553414345
        Newton Raphson Iterations :
                      x1 = 0.5*(x0 + X/x0)
                      x2 = 0.5*(x1 + X/x1)
                      x3 = 0.5*(x2 + X/x2)
    
        the exponent value of x3 is adjusted and multiplied with sqrt(2) if necessary to produce the 
        final result.
    

Note : Rounding for all the modules in progress, currently the Least significant Bits are truncated to fit the field size.

fpu-ieee-754's People

Contributors

akilm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.