EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

VHDL and Sin

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - VHDL Language - VHDL and Sin

Goto page Previous  1, 2

HT-Lab
Guest

Wed Feb 09, 2011 11:17 am   



"tommy" wrote in message
news:4d524d36$0$1367$4fafbaef_at_reader1.news.tin.it...

Quote:
Il 08/02/2011 17:55, Tricky ha scritto:
..
This wont be synthesisable, but it is a nice simple behavioural model.
For a synthesisable implementation, a look up table is usually the
best approach, but at 16 bits thats a fair chunk of memory!

This is nice approach but i need help for synthesisable codes... how can I
develop this ?

As Tricky and and others wrote, go for Cordic or look-up table approach.
There are lots of Cordic examples on the web, this paper might also help:

http://www.ht-lab.com/misc/papers/paper_mapld_6.pdf

If you want to use a LUT then try to find a paper by Robert Sutherland which
describes a method of using two much smaller look-up tables. I can't
remember all the details but a picture of the architecture is on slide 16
here:

http://klabs.org/richcontent/MAPLDCon99/Presentations/A2_Vladimirova_S.pdf

Hans
www.ht-lab.com

tommy
Guest

Wed Feb 09, 2011 5:08 pm   



Il 09/02/2011 11:17, HT-Lab ha scritto:
Quote:
"tommy" wrote in message
news:4d524d36$0$1367$4fafbaef_at_reader1.news.tin.it...

Il 08/02/2011 17:55, Tricky ha scritto:
..
This wont be synthesisable, but it is a nice simple behavioural model.
For a synthesisable implementation, a look up table is usually the
best approach, but at 16 bits thats a fair chunk of memory!

This is nice approach but i need help for synthesisable codes... how
can I develop this ?

As Tricky and and others wrote, go for Cordic or look-up table approach.
There are lots of Cordic examples on the web, this paper might also help:

http://www.ht-lab.com/misc/papers/paper_mapld_6.pdf

If you want to use a LUT then try to find a paper by Robert Sutherland
which describes a method of using two much smaller look-up tables. I
can't remember all the details but a picture of the architecture is on
slide 16 here:

http://klabs.org/richcontent/MAPLDCon99/Presentations/A2_Vladimirova_S.pdf

Hans
www.ht-lab.com



this is very hard for me, but thanks :s


David Bishop
Guest

Fri Feb 11, 2011 5:17 am   



On 2/8/2011 11:55 AM, Tricky wrote:

Quote:
Well, there's original sin(), concurrent sin(), sequential (serial?)
sin(), procedural sin(), functional sin()

Let's not forget monadic err... unary sin() and dyadic sin().

Or just "Go Forth and sin() no more."

I've tried a few to solve this problem. The LUT turned out to be the
easiest. My second choice, and the one I used in the floating point
packages was the taylor series done below.

Quote:
I can approximate both the behavioral and structural model with:

e ^ sin (x) with the polynomial P (x) = 1 + x + x ^ 2 / 2! - 3 / 4! x
^ 4 - 8 / 5! x ^ 5 - 3 / 6! x ^ 6

(in the structural relationship, the coefficients are processed in fixed
point and the polynomial is calculated using fixed-point operations).

thanks again in advance

First of all, why not look into the new IEEE fixed point package. For
VHDL '93 compatible version, see here: http://www.vhdl.org/fphdl/

Then you can do nice things like:

port (x: in sfixed (2 downto -13), y: out sfixed(2 downto -13) etc

So the bit numbers represent the real powers of 2 in the fixed point
numbers.

Then for a behavioural model, you can do this:

use ieee.math_real.all;
...
port (clk : in std_logic;
x: in sfixed (2 downto -13);
y: out sfixed(2 downto -13));
....
process
variable x_rl : real;
variable y_rl : real;
begin
wait until rising_edge(clk);
x_rl := to_real(x);
y_rl := math_e ** sin(x_rl);
y<= to_sfixed(y_rl, y'high, y'low);
end process;

This wont be synthesisable, but it is a nice simple behavioural model.
For a synthesisable implementation, a look up table is usually the
best approach, but at 16 bits thats a fair chunk of memory!

Create a look up table for 0 - PI/2, then just reflect it for the other
3 quadrants.

tommy
Guest

Fri Feb 11, 2011 9:20 pm   



Il 11/02/2011 05:17, David Bishop ha scritto:
Quote:
On 2/8/2011 11:55 AM, Tricky wrote:

Well, there's original sin(), concurrent sin(), sequential (serial?)
sin(), procedural sin(), functional sin()

Let's not forget monadic err... unary sin() and dyadic sin().

Or just "Go Forth and sin() no more."

I've tried a few to solve this problem. The LUT turned out to be the
easiest. My second choice, and the one I used in the floating point
packages was the taylor series done below.

I can approximate both the behavioral and structural model with:

e ^ sin (x) with the polynomial P (x) = 1 + x + x ^ 2 / 2! - 3 / 4! x
^ 4 - 8 / 5! x ^ 5 - 3 / 6! x ^ 6

(in the structural relationship, the coefficients are processed in fixed
point and the polynomial is calculated using fixed-point operations).

thanks again in advance

First of all, why not look into the new IEEE fixed point package. For
VHDL '93 compatible version, see here: http://www.vhdl.org/fphdl/

Then you can do nice things like:

port (x: in sfixed (2 downto -13), y: out sfixed(2 downto -13) etc

So the bit numbers represent the real powers of 2 in the fixed point
numbers.

Then for a behavioural model, you can do this:

use ieee.math_real.all;
...
port (clk : in std_logic;
x: in sfixed (2 downto -13);
y: out sfixed(2 downto -13));
....
process
variable x_rl : real;
variable y_rl : real;
begin
wait until rising_edge(clk);
x_rl := to_real(x);
y_rl := math_e ** sin(x_rl);
y<= to_sfixed(y_rl, y'high, y'low);
end process;

This wont be synthesisable, but it is a nice simple behavioural model.
For a synthesisable implementation, a look up table is usually the
best approach, but at 16 bits thats a fair chunk of memory!

Create a look up table for 0 - PI/2, then just reflect it for the other
3 quadrants.

Hello, can you paste your solution please? I can try to study the code,
thanks again

Goto page Previous  1, 2

elektroda.net NewsGroups Forum Index - VHDL Language - VHDL and Sin

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony