Questions and Answers

0 Like 0 Dislike

Geoffrey Coram

ln vs log

Do you want the natural logarithm ln() or the base-10 log() in this equation?

    lch_var = 22e-7*(1.0-1.0/(log(1.0+limexp(15.0)))*log(1.0+limexp(15.0*(1.0-lch/22e-7))));

 

Note that Verilog-A uses "ln" for the natural logarithm (in contrast to Matlab and C).

Report abuse

1 Responses

  1. 0 Like 0 Dislike

    Alexander Kloes

    Thanks for your feedback.

    In this line, there is no difference in the result in case of using "log" or "ln". That's because it's a division of 2 log's. That is the reason why it hasn't been changed during manual import from Matlab. 

    Other code lines correctly use "ln" instead of "log" of the Matlab code.

    Reply Report abuse

    Please login to answer the question.

    1. 0 Like 0 Dislike

      Geoffrey Coram

      Hmm, OK. It does look a little odd, since a similar formulation is used for Vgs but uses ln():

       Vgs   = Vgs_sat_on*(1.0-1.0/(ln(1.0+limexp(A_Vgs_sat)))*ln(1.0+limexp(A_Vgs_sat*(1.0-Vgs_tmp/Vgs_sat_on))));

      Reply Report abuse

      Please login to answer the question.

      1. 0 Like 0 Dislike

        Hedge hoax

        Thanks for the information.

        Report abuse

    2. 0 Like 0 Dislike

      Geoffrey Coram

      Also: why are you using limexp(15)? Per the Language Reference Manual, "The apparent behavior of limexp() is not distinguishable from exp()" and "Thus, the simulator can only converge when the output of limexp() equals the exponential of the input." limexp() is useful for improving convergence when used on bias-dependent arguments like Vgs_tmp, but is not helpful for constant arguments (and may be detrimental, if the simulator allocates an internal state variable to track the iteration-to-iteration change in the argument).

      Reply Report abuse

      Please login to answer the question.

      1. 0 Like 0 Dislike

        Alexander Kloes

        For reason of simplicity, while doing the import from Matlab code exp(x) has been replaced by limexp(x). But this may not be the best option in any case, as you indicate.

        Report abuse