I need an Exponential function!!!

Discussion in 'VHDL' started by LeirbaG, Dec 20, 2007.

  1. LeirbaG

    LeirbaG Guest

    I'm new in vhdl and i need urgent to find the way to implement an exponential function in my code. i'm totally desperated!!! i'm trying to implement an exponential function like e^x.
    I'm trying to writte thiS:

    --BABEL and ARMY are elements of an array of std_logic_vector(11 downto 0)
    PROCESS (BABEL,ARMY)
    VARIABLE A: integer range -100000000 to 100000000;
    VARIABLE B: integer range -100000000 to 100000000;
    VARIABLE ARMY1: integer range -100000000 to 100000000;
    VARIABLE ARMY2: integer range -100000000 to 100000000;
    VARIABLE BABEL1: integer range -100000000 to 100000000;
    VARIABLE BABEL2: integer range -100000000 to 100000000;
    VARIABLE e: REAL := 2.7182818284;

    BEGIN
    ARMY1:= CONV_INTEGER(ARMY(1));
    ARMY2:= CONV_INTEGER(ARMY(2));
    BABEL1:= CONV_INTEGER(BABEL(1));
    BABEL2:= CONV_INTEGER(BABEL(2));
    A := CONV_INTEGER(BABEL(1) - (BABEL(2)-BABEL(1))* CONV_STD_LOGIC_VECTOR(e**(ARMY2 - ARMY1),12));
    B := CONV_INTEGER((BABEL(2) - BABEL(1))* CONV_STD_LOGIC_VECTOR((e**ARMY2 - e**ARMY1),12));
    peak <= CONV_STD_LOGIC_VECTOR((A + B),12);

    END PROCESS PEAK_CALCULATION;

    the error is:
    Error (10512): VHDL type mismatch at RISE_UP_DETECTOR.vhd(177): object(s) associated with operator ""**"" must have std_ulogic type

    I really don't understand what this mean..please i need help!!!
    i know my code is very archaic, but is all that i know....
    what do i need? please if anyone can help me
    LeirbaG, Dec 20, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Lawrence [MSFT]

    Re: See data in exponential format

    Eric Lawrence [MSFT], Mar 1, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    567
    =?Utf-8?B?Sm9yZ2UgTWFnYW50bw==?=
    Mar 2, 2004
  2. Exponential

    , Feb 10, 2005, in forum: C++
    Replies:
    1
    Views:
    975
    Victor Bazarov
    Feb 11, 2005
  3. Timothy Fitz

    Exponential Notation and integers

    Timothy Fitz, Nov 18, 2004, in forum: Python
    Replies:
    4
    Views:
    1,057
    =?ISO-8859-1?Q?F=E1bio?= Mendes
    Nov 19, 2004
  4. Neal Becker

    unusual exponential formatting puzzle

    Neal Becker, Sep 21, 2005, in forum: Python
    Replies:
    5
    Views:
    502
    Neal Becker
    Sep 22, 2005
  5. blue39

    exponential function

    blue39, Jan 16, 2013, in forum: VHDL
    Replies:
    7
    Views:
    361
    Gabor
    Jan 20, 2013
Loading...

Share This Page