- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
is there a way to calculate the logarithm to the basis 2 of a generic parameter? I don't need a synthesizeable circuit. I just want the compiler to to calculate an integer and asign it to another generic parameter of a submodule. Thanks! SörenLink Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In VHDL:
function log2 (x : positive)
return natural
is
begin
if x = 1 then
return 0 ;
else
return log2(x / 2) + 1;
end if;
end function log2 ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks!
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