Forum Discussion
LookUp Tables
Hello, I want to implement sine and cosine signals in vhdl to check a part of my code but i don't know how to initialize these sin and cos signals? please tell me what is the way to do it?
i have read that it is possible through LUT but i don't know what LUT is ???12 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I did it, but it didn't fix my problem. --- Quote End --- your mif file is set to unsigned radix but the data ia signed so keep it signed and change radix in mif file to signed - Altera_Forum
Honored Contributor
The wave screenshot posted above already shows a different problem than what you have reported initially. The negative values are not replaced with zeros anymore, rather you seem to be missing the sign bit this time. You need to inspect the values shown in the diagram to be able to tell what's happening - for example, what is the value at the peak of the sinusoid? For 16bit signed integer, your values in the LUT/MIF should be in the [-32768;+32767] interval, are they?
- Altera_Forum
Honored Contributor
I want to create a sin, so the best way (as I understand) is to make nco (I need digital sin-wave). Please, can you advice me some examples about implementation nco in verilog.
- Altera_Forum
Honored Contributor
no changes, yesterday I wrote about it, but massage didn't post.
I also try -radix signal q signed. - Altera_Forum
Honored Contributor
You are displaying the wave form as hexadecimal. Change the draw type to "signed". Right click -> radix -> signed
- Altera_Forum
Honored Contributor
sorry, can you show me how to do it, i don't understand.
- Altera_Forum
Honored Contributor
I did it, but it didn't fix my problem.
http://s7.hostingkartinok.com/uploads/images/2014/11/c82d65b2ad13d7b4b3412aaadc4a4fce.png (http://hostingkartinok.com/show-image.php?id=c82d65b2ad13d7b4b3412aaadc4a4fce) - Altera_Forum
Honored Contributor
Not sure if this will fix your problem, but try replacing the "signed" declarations with "integer" in your main code and testbench.
- Altera_Forum
Honored Contributor
--- Quote Start --- I don't about your tools habits but you can convert negative numbers to positive (bit equivalent): e.g. for n bits negative values (signed) data = data + 2^n --- Quote End --- Thank's for your answer, but I did it and I got the following picture it Questa. I can't submit it like a signed number. In radix I use decimal, but it also ansigned. How can i transform it into unsigned? http://s7.hostingkartinok.com/uploads/images/2014/11/504de2f5c58eae37f09eb5c10191f761.png (http://hostingkartinok.com/show-image.php?id=504de2f5c58eae37f09eb5c10191f761) - Altera_Forum
Honored Contributor
I don't about your tools habits but you can convert negative numbers to positive (bit equivalent):
e.g. for n bits negative values (signed) data = data + 2^n