Announcement

Collapse
No announcement yet.

Special Function Unit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Special Function Unit

    There are multiple ways of making a special function unit, including using Taylor series approximations, bipartite table based methods and Cordic algorithms. Since these are scalar operations we can use a "scalarized" version of a vector to implement them in the vector ISA. The instructions for the special function unit will include:

    1. sin
    2. cos
    3. atan
    4. exp
    5. log
    6. sqrt
    7. recip
    8. invsqrt
    9. pow

    Also there are tricks we can use. For example, Log(x) and Exp(x) or Antilog(x) are very useful:

    1. Float(x) mult Float(y): Convert to Log, add and take antilog: Antilog (Log(x) + Log(y)) -> convert mult to add with table lookups
    2. Float(x) div Float(y) = Antilog (Log(x) - Log(y))
    3. X^a = Antilog (a * Log(X))
    4. Sqrt(X) = Antilog (Log(x) / 2)

    Also, 1/sqrt(x) is very useful

    1. 1/x = 1/sqrt(x) * 1/sqrt(x)
    2. Sqrt(x) = 1/sqrt(x) * x

    And Cordic will give all the sines and cosines:

    1. http://www.dcs.gla.ac.uk/~jhw/cordic/
    2. https://people.sc.fsu.edu/~jburkardt...ic/cordic.html
    3. https://people.sc.fsu.edu/~jburkardt...ic/cordic.html

  • #2
    Note that three of those functions are natively supported by RISC-V V as of today:

    - Square-root:
    vfsqrt.v vd, vs2, vm
    - Reciprocal square-root: vfrsqrt7.v vd, vs2, vm
    -Reciprocal: vfrec7.v vd, vs2, vm

    Regarding the other functions, there are many different ways to implement them but very few ways to express those operations as instructions.

    It may be convenient to finish defining all the instructions before you delve into implementation details.

    Comment


    • #3
      Yes I completely agree! Thanks for clarifying the existing instructions. We don't have to specify in the ISA how they should be implemented just what the instructions do.

      The implementation methods are only for us when we decide to build some RTL out of the ISA.

      Comment

      Working...
      X