1
\$\begingroup\$

I'm currently doing some tutorials and reading some books on how to write VHDL. As I'm curious and learn better with hands-on tutorials I'm going to start implementing my projects that will serve me well in the future.

For my first real project I'm trying to implement an arctg function followed by an aggregation operator function.

I don't want to reinvent the wheel and I don't want to be further confused and so I'm asking here the following questions:

  1. The integer to float and vice-versa with the bits of the mantissa, exponent and integer is necessary right? Isn't there any website where people have already implemented this kind of things and share with the community?
  2. I've seen somewhere that the package math_real already has an ARCTANfunction which accepts a REAL which I guess is a float. So:

    2.1. Is this synthesizable? If not why is it even coded?

    2.2. If everything needs to be converted from float to integer in order to be passed between functions, why does ARCTAN accept REAL and not an integer?

asked Nov 10, 2015 at 16:31
\$\endgroup\$
13
  • \$\begingroup\$ Real math / types are not synthesizable. Unless you have some vendor-specific smart synthesis tool which is made capable of it. It was coded like many non-synthesizable stuff - for simulation and testing. \$\endgroup\$ Commented Nov 10, 2015 at 16:40
  • 2
    \$\begingroup\$ Yes and no. The no part - it's also for simulating the parts of the system which are not yet implemented, but supposed to do some real math. \$\endgroup\$ Commented Nov 10, 2015 at 16:45
  • 1
    \$\begingroup\$ "opencores" has a library you may find useful. \$\endgroup\$ Commented Nov 10, 2015 at 16:46
  • 1
    \$\begingroup\$ Perhaps a fixed point math would be sufficient for your needs. \$\endgroup\$ Commented Nov 10, 2015 at 16:49
  • 1
    \$\begingroup\$ If you're starting to do something new, and think 'I need to provide all this infrastructure from scratch', then probably you're not using the right tool for the job, or have chosen the wrong first project for the tool. I call it the 'are you riding the horse in the direction it's going?' question, it's much easier to ride it that way than sideways or backwards. FPGAs excel at digital logic, comparisons, storage, and integer maths. DPS ICs tend to be used for maths with reals. For ARCTAN function, look up CORDIC (wikipedia), that's the natural FPGA implementation, and works with integers. \$\endgroup\$ Commented Nov 10, 2015 at 16:54

1 Answer 1

5
\$\begingroup\$

VHDL-2008 has synthesisable fixed-point and floating-point libraries, in addition to ieee.math_real which is strictly for simulation. You can instantiate the float package with any width of mantissa and exponent, or use the pre-defined float types (roughly IEEE P754). The fixed point package is a better choice for DSP, and usually produces smaller hardware.

These libraries should handle question (1) for you.

For question 2)

  1. The math_real ARCTAN is used in simulation, not for synthesis.
  2. Question makes no sense as you can pass reals to and from functions.
answered Nov 10, 2015 at 17:14
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.