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.

Look up table for sine wave generation

Status
Not open for further replies.

Vijay Vinay

Member level 5
Member level 5
Joined
Mar 21, 2014
Messages
85
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
781
Friends,
I am a final year student pursuing ECE. I am currently working with Mission 10x kit through which I am interfacing FPGA programming. I have to generate a sine wave so that I can collect my o/p through DAC . I have generated the sine wave values for one cycle but I have no idea how to generate a look up table so that I can implement the values for generating the sine wave. Please help me friends. Its urgent. I will be happy if my problem gets rectified at the earnest......

Thanks,
Vijay Vinay
 

Thank you andre_teprom for your valuable information.... but I have generated the values for my sine wave... I dont know how to insert the txt file in my verilog code... Please help me....Its urgent.............



Thanks,
Vijay Vinay
 

Hi,
I had used this in an internship project for sine wave generation and was very successful. No need of implementing look-up table and stuff!
You can generate a sine wave using Maclaurin series equation and using up to only 3 terms in the equation. The maximum error percentage between an actual sine function and the Maclaurin representation (using 3 terms) is 0.99%.

You can implement in VHDL/Verilog the following equation to get as output a sine wave:
Code:
f(x) = <Sign_value> * <Amplitude_value> * {x - (x^3/6) + (x^5/120)} + <Offset_value>

Hope this helps.
 


X^5 is very very difficult to synthesize with completely combination logic, if the clock frequency is high and the "x" bit_width is 8 or bigger.
 

Well to reduce the memory utilisation, only the 1/4 of the sinus is required.

after it is like a hardwire rom:
case (address)
begin
"0000" => data_out <= "value0";
"0001" => data_out <= "value1";
...

you replaced the value0/value1/... with your sinus text value.
you have an small state machine to go through all this value by incrementing/decrementing "addr", and a data_out manipulation to inverted or not it (as the memory contains only the 1/4 of the sinus).
 

X^5 is very very difficult to synthesize with completely combination logic, if the clock frequency is high and the "x" bit_width is 8 or bigger.

I agree with you!
I had used it as a simulation model only. Something like a soft fn. gen for my other modules.
 

I have generated the values for my sine wave... I dont know how to insert the txt file in my verilog code...
Most synthesis tools support the system tasks $readmemb (read binary file) and $readmemh (readhex file) to initialize ROM or RAM tables. $fopen/$fread for text files are usually only available for simulation purposes.

A straightforward way to generate a sine lookup table is a to use the $sin function in an initial block.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top