- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
There are somoene that release a vhdl code for log or have any idea about it. I need any tutorial or helps to start release it. Thank you.Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
like log base 2?
this function will return the nearest log2 of a number (but I wouldnt recommend synthesising as a real time function) Its useful for determining how many bits you need for a vector.
function log2(x : integer) return integer is
variable temp : integer :=x;
variable n : integer := 1;
begin
while temp > 1 loop
temp := temp/2;
n := n + 1;
end loop;
return n;
end function log2;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- like log base 2? this function will return the nearest log2 of a number (but I wouldnt recommend synthesising as a real time function) Its useful for determining how many bits you need for a vector.
function log2(x : integer) return integer is
variable temp : integer :=x;
variable n : integer := 1;
begin
while temp > 1 loop
temp := temp/2;
n := n + 1;
end loop;
return n;
end function log2;
--- Quote End --- Think you very much for your reply, ok for this function it is clear, but that i need is a function that can execute during a minimum of clock cycle. ThAnk you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if you need a synthesisable version, I suggest you use a look-up table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- if you need a synthesisable version, I suggest you use a look-up table. --- Quote End --- Ok thank you, already i use LUT, but i search if it is possible to find a synthetisable code for log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LUT is the easiest. But you should be able to generate the table using a function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- LUT is the easiest. But you should be able to generate the table using a function. --- Quote End --- I generate the LUT through Matlab. And i initialize memory with the generated data.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page