The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:27am
Pages: 1
Send Topic Print
current limiter in Verilog-A (Read 1273 times)
icdes321
New Member
*
Offline



Posts: 2

current limiter in Verilog-A
May 25th, 2008, 4:02am
 
I am writing a current limiter in Verilog-A. Should be simple but in simulation the results are not as expected. Any suggestions will be appreciated.

`include "discipline.h"
`include "constants.h"

module current_limiter(in,out);
inout in, out;
current in,out;
parameter imax = 100e-3;

analog
begin
  @(initial_step)  if (I(in,out) > imax) I(in,out) <+ imax;


end
endmodule



Thanks.
Back to top
 
 
View Profile   IP Logged
Stefan
Senior Member
****
Offline



Posts: 124

Re: current limiter in Verilog-A
Reply #1 - May 25th, 2008, 5:08am
 
@(initial step) makes the simulator evaluate the next statement only once at the beginning of the simulation.
Your limiter simply does nothing for the rest of the simulation time.
Back to top
 
 
View Profile 16731287   IP Logged
icdes321
New Member
*
Offline



Posts: 2

Re: current limiter in Verilog-A
Reply #2 - May 25th, 2008, 6:18am
 
Stefan, Thank you. But adding "if (I(in,out) > imax) I(in,out) <+ imax; " does also not work.

module current_limiter(in,out);
inout in, out;
current in,out;
parameter imax = 100e-3;

analog
begin
  @(initial_step)  if (I(in,out) > imax) I(in,out) <+ imax;

if (I(in,out) > imax) I(in,out) <+ imax;

end
endmodule
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: current limiter in Verilog-A
Reply #3 - May 27th, 2008, 5:30am
 
Yikes!  I don't think you've got the idea here at all.  What about:

module current_limiter(in,out);
inout in, out;
current in,out;
parameter imax = 100e-3;
real iout;

analog
begin
 iout = I(in);
 if (iout > imax) iout = imax;
 I(out) <+ iout;

end
endmodule
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: current limiter in Verilog-A
Reply #4 - May 27th, 2008, 11:54am
 
The problem is more subtle than that. To build a reliable current limiter you cannot simply compare the output current against Imax, and then if above Imax, set the output current to Imax. Once you override the output current, it is no longer over Imax. This results in the state switching back and forth between limiting and not limiting on every iteration, which would cause convergence problems. A robust model can be found in the Verilog-AMS section of this site (www.verilog-ams.com). It is called "Current limited voltage regulator" and can be found in the functional Verilog-A models section.

-Ken
Back to top
 
 
View Profile WWW   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.