Forum Discussion
5 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I need to get the quarter sine LUT --- Quote End --- Hope you got it :) What exactly the question is? - Altera_Forum
Honored Contributor
According to this equation :
i=[0:i-1]; x= (i-1)*sin ((pi/2)*i/i-1)+ 1/2*(i-1)); The result that I got is not the sine wave shape (the LUT values inverted in minus when it pass the half of (pi/2) range ). herewith the attached sine wave file - Altera_Forum
Honored Contributor
As far as i know MATLAB uses floating point representation, which is not implemented in HDL by default. Maybe if you give more information (LUT input,output width, precision, what language you use) I could help you out.
- Altera_Forum
Honored Contributor
The Quarter sine wave LUT code for 8 bits:
i=[0:255]; x= 255*sin ((pi/2) *i /255); y=str(x,8) ; but when i used it in DDS simulation , I got no sine wave((note: i applied all the other requirment)) - Altera_Forum
Honored Contributor
There is some error in your sine values but almost correct.
Try this: x = round(255*sin(2*pi*(0:1023)/1024)); x = x(1:256); You should get proper quarter sine from x otherwise tell us what you do with x. you can also just use: x = round(255*sin(2*pi*(0:255)/1024));