The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 18th, 2024, 12:17pm
Pages: 1
Send Topic Print
Lambert-W function in verilog-A (Read 709 times)
337see733
Community Member
***
Offline



Posts: 39
Singapore
Lambert-W function in verilog-A
Sep 21st, 2007, 1:22am
 
Dear all,

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

Thanks.
Back to top
 
 
View Profile gilbertsee   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Lambert-W function in verilog-A
Reply #1 - 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.
Back to top
 
 
View Profile   IP Logged
337see733
Community Member
***
Offline



Posts: 39
Singapore
Re: Lambert-W function in verilog-A
Reply #2 - Sep 26th, 2007, 6:07pm
 
Hi Marq,

Will try and see. Thanks.
Back to top
 
 
View Profile gilbertsee   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.