Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to implement y=sinx in VHDL?

Status
Not open for further replies.

sachinmaheshwari

Member level 4
Joined
Aug 7, 2007
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,743
can any one tell me how to impliment
y=sinx in VHDL

please be sure whatever you r saying
 

shawndaking

Full Member level 3
Joined
Jun 20, 2001
Messages
187
Helped
12
Reputation
24
Reaction score
6
Trophy points
1,298
Activity points
1,075
Re: VHDL code

you can do it by :

1. preparing ROM for the calculation with all values defined.

2. in xilinx you can use CORDIC core for generating this function.

3. if your input is more limited to specific values, you can even use a decoder to
decode the values.
 

lordsathish

Full Member level 5
Joined
Feb 11, 2006
Messages
246
Helped
33
Reputation
66
Reaction score
3
Trophy points
1,298
Location
Asia
Activity points
2,698
Re: VHDL code

if you want to design some core then you can try using the cordic algorithm...
there references available in the net about this algorithm which uses only shift and add operatios to compute sine as well as cos...
 

sachinmaheshwari

Member level 4
Joined
Aug 7, 2007
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,743
Re: VHDL code

what exactly is CORDIC algorithm?
is their some pdf regarding this?
 

shawndaking

Full Member level 3
Joined
Jun 20, 2001
Messages
187
Helped
12
Reputation
24
Reaction score
6
Trophy points
1,298
Activity points
1,075
Re: VHDL code

this is from xilinx coregen lib :
 
  • Like
Reactions: ypasha

    ypasha

    Points: 2
    Helpful Answer Positive Rating

apavan4u

Newbie level 1
Joined
Mar 14, 2008
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,285
Re: VHDL code

thanks

Added after 2 minutes:

Yes u can use CORDIC or look up table...

but any one tried the results??

I mean, what input u r giving , and wat iutput u r getting?? Coz, i m trying with cordic, and look up table, both i m unable to analyze the results..
 

kalyansrinivas

Advanced Member level 4
Joined
Jul 7, 2007
Messages
100
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,298
Activity points
1,910
VHDL code

hi
Is cordic Cordic algorithm is advantageous over the LUT based method ? Please let me know
 

sachinmaheshwari

Member level 4
Joined
Aug 7, 2007
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,743
Re: VHDL code

how to impliment
y=sinx

inputs as angles in degree represented by IEEE 32-bit floating-point no.
and produces output as IEEE 32-bit floating number

sign(1-bit) Exponent(8-bit) Mantissa(23 bit)
0/1 [(2^8 -1)- 127]=+128 to (0-127)=-127

floating point number = (+-)[1.mantissa]*2^exponent
 

suru

Full Member level 3
Joined
Aug 31, 2007
Messages
157
Helped
4
Reputation
14
Reaction score
1
Trophy points
1,298
Activity points
1,934
VHDL code

use vhdl_Ams for the same. it becomes very simple.
 

sachinmaheshwari

Member level 4
Joined
Aug 7, 2007
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,743
Re: VHDL code

what is vhdl_ams
can u be more specific
n do u have any example?
i just have to write the behavioral code of it.
 

linkfox

Member level 2
Joined
Dec 18, 2007
Messages
50
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Activity points
1,495
Re: VHDL code

kalyansrinivas said:
hi
Is cordic Cordic algorithm is advantageous over the LUT based method ? Please let me know

LUT method is faster, you generate the address using the input data, and pick the value from the ROM; but the accuracy depends on the LUT size, or sampling density. Since sin/cos is periodic, you can combine LUT with some taylor interpolations to improve the accuracy.

CORDIC is relatively slow, the accuracy depends on the number of iterations, so higher accuracy means longer latency. But it only requires add/shift, very area efficient.
 

dmk

Full Member level 3
Joined
Nov 14, 2005
Messages
187
Helped
44
Reputation
88
Reaction score
7
Trophy points
1,298
Location
Bg
Activity points
2,210
VHDL code

VHDL-AMS is VHDL for Analog & Mixed Signal Modeling. Use the following link to download "The Designer's Guide to AMS Modeling", author: R. Scott Cooper, Published by Synopsys, 2004, 356 pages:
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
50,808
Helped
14,603
Reputation
29,481
Reaction score
13,688
Trophy points
1,393
Location
Bochum, Germany
Activity points
290,925
Re: VHDL code

Please notice, that VHLD AMS or any other HDL that can calculate sine and other mathematical function, don't help somehow to get synthesizable code for a FPGA calculating sine function. They just support this function for simulation or can calculate a ROM table.

I understand, that you want the sine function for float numbers. Known Cordic cores are using fixed point only, e. g. from opencores.org or Xilinx. In contrast, usual FPGA floating point packages have 4 fundamentals and squareroot only.

I think, if full floating point resolution is needed, you should implement an usual numerical math iterative alrorithm. That's also done by processor FPU supporting higher math functions. A lot of literature can be found regarding implementation details.
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,933
Helped
638
Reputation
1,274
Reaction score
90
Trophy points
1,328
Location
USA
Activity points
33,176
VHDL code

Here's a nice web page describing CORDIC algorithms:
**broken link removed**
 

    V

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top