For a log function the easiest method is a look up table...
I am a newbie in verilog programming. So can you please explain with example.?
What is desired type of variable n?What i need to do is to simply calculate the log base 10 of a variable n.
I can write it in C programming but i dont know how to do with verilog? Can any one help e to write the below C code to write in verilog?
If you say so, then I guess that you don't understand what look up table method means.I need to calculate log for a particular given input value. So I guess lookup table method is not need.
Your program works only for some values that give integer results: for every n that is not a power of r, you will get only the integer part. What you are trying to do?
you can declare the base r as an integer but n and the log must be declared float (or double).
You wanted to calculate log10, right? you can have n=1, 10, 100 and so on...
Any other value of n will return a wrong result.
You need to begin at the beginning: start from the log...
If you say so, then I guess that you don't understand what look up table method means.
Make a table in Block ROM with log10results for positive and integer n.
Then input 'n' is the index, where you are looking up a value to get from that table.
The output is the value from this table under index 'n'.
That's the definition for the look up table and I think it suits perfectly yours need.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?