- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I know that there exists a MegaFunction for absolute value in floating point. But I am looking for an implementation to get the absolute value/modulus in fixed point. Another implementation I could go with is to use the altmult_add megafunction and then square root the result. But the problem is similar - Quartus 10.1 has a square root function for floating point only, and I want it for fixed point implementation as I will be needing it for a bigger design on the FPGA. Can anyone please help me getting either a square root implementation for fixed point, and/or an absolute value/modulus implementation? Thank you. :)Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
absolute value of 2's complement is straight forward. For positive numbers it is the number value itself. For negative numbers invert each magnitude bit then add 1.
For square root, there are many iterative methods (google square root in FPGA). You may also consider using the square rather than the its root if your application can do with it.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if you mean abs value of complex number(rectangular to polar) then look here:
http://www.dsprelated.com/showarticle/122.php- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a bunch for the link...very useful algorithm
I have never implemented trigonometric functions in Altera Quartus. Could you please give hints/suggestions on how to go about implementing the "ol' days" conversion (from the link) using block design? Thank you.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suggest using LUT, get values of full cycle sin/tan-1 or 1/2, or1/4 cycle...etc and address it as required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Basically what I am implementing is: a signal is generated (for example, a sine wave) and its modulus (magnitude) is taken as the input to a LUT (RAM). The output of the LUT is then multiplied by the original signal.
so i am looking for a modulus/absolute value implementation (for fpga) to get the magnitude of the signal (in fixed point). I searched google for it and didn't get decent results. Some more help with this will be really appreciated.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If by "absolute" you mean "magnitude" of a signed value then I explained that in my first reply.
There are only two meanings for "absolute" either the magnitude of a signed value or the magnitude of a complex pair. Both have been explained. So I assume you are dealing with real signal (no imaginary component), hence all you have to do is get magnitude of negative value by inverting mag bits then add 1. Then use it to address LUT and then multiply back by your original value.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Small addition, if still useful.
I guess that if you want the magnitube of a 2's complement number and can accept the error of 1LSB you can simply invert the input number if the MSB is '1'. This will cause an error, though. The advantage is that you don't need an adder. Example: 2's complement | decimal | magnitude | magnitude with error 0000 0 0 0 0001 1 1 1 ... 0111 7 7 7 1000 -8 8 7 1001 -7 7 6 1010 -6 6 5 ... 1111 -1 1 0 Hope it helps
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page