01-28-2011 05:23 AM
01-28-2011 05:33 AM
There's no such thing as a "fixed point FPGA". Is your intention to a implement trig. functions using a set of fixed point IP cores? Please provide more details.
Adrian
01-28-2011 05:40 AM - edited 01-28-2011 05:43 AM
Your request is a bit broad for an FPGA user technical support forum, don't you think?
OK, let's play this out. Suggestions:
1. Read a book on computer arithmetic, specifically gate-level floating point arithmetic design. There are lots of books on computer arithmetic.
2. Read a book on trigonometric (sometimes called transcendental) functions.
3. Learn how to incorporate a PPC or MicroBlaze processor in your FPGA design, and write (or adapt) math C language routines for processor execution.
Are you new to FPGA design? If this is your first FPGA design, you are well advised to learn FPGAs and the design tools (and digital logic design) before you take on a project as challenging as high-level math implementation. FPGA design is not a software project, it's a hardware design project. If you don't understand the hardware, you run the risk of disappointment and discouragement.
If you walked into your very first machine shop class, it would be premature to ask your fellow students - on your first day - how cars are built from steel ingots. This is the sort of question you have posed.
- Bob Elkind
01-28-2011 05:43 AM
As to my understanding some FPGAs support Floating point and some not.
If you therefore want to use floating point values in a design.
Say for example hypothetically:
cos_data <= cos_function(x);
How can I design this in VHDL when I only have Fixed value support?
01-28-2011 05:46 AM
I am not a newbie to FPGAs or VHDL.
I did my Masters Degree in Engineering using the Virtex5.
I know the tools, code etc.
01-28-2011 05:51 AM - edited 01-28-2011 06:01 AM
As to my understanding some FPGAs support Floating point and some not.
Sadly, this is not the case. FPGAs provide low-level logic functions and a few types of arithmetic building blocks, which designers assemble into higher-level functions and systems.
cos_data <= cos_function(x);
This is not a native FPGA function. It can be realised only by a library or macro or module which has already been written or designed. In most cases such as this, there are multiple levels of libraries or modules between a trig function and an FPGA's fundamental capabilities.
When you buy a floating point capable processor from Intel or Freescale or AMD, its FP math capabilities have been carefully design and crafted. The math functions did not magically appear with the press of a mouse-click.
- Bob Elkind
01-28-2011 05:53 AM - edited 01-28-2011 06:07 AM
I am not a newbie to FPGAs or VHDL.
I did my Masters Degree in Engineering using the Virtex5.
I know the tools, code etc.
From where did you get the impression that "floating point math" is a synthesisable class of VHDL (or Verilog) constructs or expressions?
Floating point math functions CAN be synthesised... but you must spell out to the synthesis tool how to perform the synthesis. In other words, you create the math functions library.
If you want to learn floating point data path design from the gate level, you have a non-trivial project ahead of you. If you are less interested in the design process, and more interested in using such math functions, then the previous suggestion for instantiating a processor (and providing the math functions as executed SW routines) is by far a quicker and more reliable approach than gate level hardware design.
- Bob Elkind
01-28-2011 06:11 AM
I know very well that Floating point math is not synthesisable with an FPGA. (Thats why I posted this thread)
I also know that the function is not impossible to implement. There are ways around the logic cells of the FPGA.
End.
If anyone has any experience with or examples of this, please assist.
I will update this thread when I find the solution
Thanx in advance
01-28-2011 06:31 AM
I also know that the function is not impossible to implement.
Yes, floating-point arithmetic is implementable on FPGAs. But probably not in such a way that you can just call a function and your cosine core is instantiated. Well, most likely not, because it can only be in a function if it is combinational (as opposed to sequential). Good luck implementing cos() in a combinational circuit.
There are ways around the logic cells of the FPGA.
I don't understand the meaning of this. Please explain.
Before we get sidetracked by a possibly unnecessary problem: have you had a look at the cores provided by the IP core generator? Maybe you'll find what you need.
Adrian
01-28-2011 06:48 AM
You can bypass floating point values by up scaling or down scaling values, and adjusting the values in higher level programming.
I had good results with this when we had to do real-time position sensor measurements in the value range of approx. 300 microns.
We all know cos(x) = (e*exp(ix) + e*exp(-ix))/2
We can easily calculate the reel and imaginary components of a cosinus function.
From what I have read is that these two methods can be combined in a lookup table to implement a cosinus function.
I do not however have experience with this second method.
Any ideas?
01-28-2011 07:31 AM
You can bypass floating point values by up scaling or down scaling values, and adjusting the values in higher level programming.
This sounds like you're describing fixed-point numbers?
We all know cos(x) = (e*exp(ix) + e*exp(-ix))/2
And how do you plan to implement the exp() function for complex arguments in a combinational circuit?
From what I have read is that these two methods can be combined in a lookup table to implement a cosinus function.
Of course, if you don't need a high input precision, then you can simply implement your cosine function in a large lookup-table. For example, you can get 18 bits of output precision at 11 bits of input precision with a single RAMB36. Is that what you wanted?
Adrian
01-28-2011 07:39 AM
Until you have developed a set of algorithms, verified them, and sized the data precision requirements; it's premature to be discussing FPGA implementations.
The biggest risk in conceptual design and simulation is that you might come up with a brilliant set of ideas which are completely unworkable. However, you already have enough background in FPGA technology to steer your algorithm design ideas away from approaches which are clearly impractical.
For example, you already understand that a straightforward sin(x) lookup table might be impractical if x is a floating point number which exceeds the addressing range of on-chip memory.
Being aware of such FPGA limitations without being unduly restrained by them seems like the right time and place for creative - yet useful - design.
- Bob Elkind
01-30-2011 10:53 PM
Now that everybody have stated ALL the problems and no solutions...
For anybody looking for a solution i suggest you look at the following:
1. CORDIC
2. Power series
3. Look up tables
Each have different processing time and you should look into this for a time-critical calculation.
I will post my implementation as soon as its finished
01-30-2011 11:06 PM
Now that everybody have stated ALL the problems and no solutions...
For anybody looking for a solution i suggest you look at the following:
1. CORDIC
2. Power series
3. Look up tables
Each have different processing time and you should look into this for a time-critical calculation.
I will post my implementation as soon as its finished
We knew you could figure it out! We just didn't want to spoil the moment for you.
- Bob Elkind
01-30-2011 11:38 PM
Now that everybody have stated ALL the problems and no solutions...
Well, maybe that's because your problem description was vague ("I want to implement trigonometry functions") and confusing ("on a Fixed Point FPGA").
Besides, one can't find a solution without knowing the problem. You're welcome.
Adrian