The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Lambert-W function in verilog-A
https://designers-guide.org/forum/YaBB.pl?num=1190362952

Message started by 337see733 on Sep 21st, 2007, 1:22am

Title: Lambert-W function in verilog-A
Post by 337see733 on Sep 21st, 2007, 1:22am

Dear all,

Has anyone implemented Lambert-W function in verilog-a and willing to share ?

Thanks.

Title: Re: Lambert-W function in verilog-A
Post by Marq Kole on Sep 26th, 2007, 1:39am

Hi,

There is a description including Python code for a solution based on a recurrence relation or a solution based on an approximation at Wikipedia. That is if you're using real valued arguments.

http://en.wikipedia.org/wiki/Lambert's_W_function

It is quite trivial to convert this code to Verilog-A: here is the recurrence relation code:


Code:
function real lambertw;
input x, prec, iters, error;
real x, prec;
integer iters, error;

real w, we, w1e;
integer i;

begin
 w = 0;
 for (i = 0; i < iters; i = i + 1) begin
   we = w * exp(w);
   w1e = (w + 1) * exp(w);
   if (prec > abs((x - we) / w1e))
     break;
   w = w - (we - x) / (w1e - (w+2) * (we-x) / (2*w+2));
 end
 error = (i < iters) ? 0 : 1;
 lambertw = w;
end

endfunction // lambertw


I've not actually run this code, but I think you get the idea.

Title: Re: Lambert-W function in verilog-A
Post by 337see733 on Sep 26th, 2007, 6:07pm

Hi Marq,

Will try and see. Thanks.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.