LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Sponsors
  • Mirrors
  • Logos
  • Contact us
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cores > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: unneback at opencores.org<unneback@o...>
    Date: Tue Sep 21 10:56:54 CEST 2004
    Subject: [oc] Logs in hardware?
    Top
    Hi,

    I did a log2 implementation a couple of years ago. This
    implementation is rather rough and not very accurate,
    on the other hand it is small and efficient. ;-)

    Lets look on a number with 8 bits:
    ex=0110_0000 (=96)
    we number the bits from 7 downto 0 (left to right)

    Lets assume we want the answer to be unsigned binary
    number with decimal point on the form nnn.nnnnnnn

    Start looking on the bits from left. Find the first bit='1'
    In this case ex(7)='0' but ex(6)='1'. This means that
    the integer part of the answer is 2^6.

    answer = 110.1000000 (=6+64/128=6.5)

    If you need log10 instead of log2 multiply with log10(2)
    log10(96)=6.5*log10(2)=1.957

    Maybe not that accurate but efficient ...
    regards
    /Michael





    ----- Original Message -----
    From: Michael M Delaney<mmdst23+@pitt.edu>
    To:
    Date: Mon Sep 20 22:41:41 CEST 2004
    Subject: [oc] Logs in hardware?

    > Can anyone suggest any websites, books, or papers on how a log is
    > actaully
    > calcuated? So far, I haven't had much luck with google, and after
    > looking
    > at the list archives for the FPU, it seems like it was decided that
    > doing
    > logs and trigs in hardware wasn't worth the time and effort (I
    > could be
    > wrong, I only took a quick glance through the source).
    > Thanks,
    > Mike
    >
    >

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.