OpenCores
no use no use 1/1 no use no use
Implementaion of log func in verilog
by niladri.s.debnath on Mar 9, 2012
niladri.s.debnath
Posts: 1
Joined: Jun 23, 2011
Last seen: Mar 9, 2012
Hello everybody I want to implement log function in verilog can somebody give me some idea ????
RE: Implementaion of log func in verilog
by motilito on Mar 9, 2012
motilito
Posts: 17
Joined: Jun 10, 2008
Last seen: Nov 17, 2025
Hi,
There is a nice trick to implement a the log function using RTL. if you take any binary value value you can define it using a simple floating point like manner:
value=2^(exponent)*mantissa
The "exponent" can be easily found by looking for the highest bit. the "mantissa" are the bits following the highest bit. calculate the log function of the above:
log(value)=exponent*log(2) + log(mantissa)
The "log(mantissa)" value is best calculated using a simple look up table. the desired result resolution defines the LUT size and thus the number of mantissa bits.
Now, if you want to calculate the log base 2 of the value then ... simple solution. I bet you are more interested in calculating something like log10(value). The math is simple.
Have fun,
Moti
RE: Implementaion of log func in verilog
by jeremybennett on Mar 10, 2012
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

You can find more details of the algorithms described by Moti on the University of Kentucky Aggregate Magic Algorithms page.

HTH

Jeremy

--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com

no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.