The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 17th, 2024, 5:46pm
Pages: 1
Send Topic Print
using branch as a pass-through to measure current of DUT (Read 3732 times)
va_user
New Member
*
Offline



Posts: 6

using branch as a pass-through to measure current of DUT
Jul 06th, 2016, 3:26pm
 
I have a device under test (DUT) and want to use a verilog-A module to monitor the current through the DUT and take actions based on that.  Can I not use a verilog-A module as a pass-through like so:

Code:
`include  "discipline.h"
`include  "constants.h"

module current_meas(vss_pos, vss_neg);

    input vss_pos;
    output vss_neg;

    electrical vss_pos;
    electrical vss_neg;

    branch (vss_pos, vss_neg) input_branch;

    analog begin

	  I(vss_pos) <+ I(vss_neg);
	  V(vss_pos) <+ V(vss_neg);

    end

endmodule

 



I connected this VA module in series between the DUT and a 0V DC supply (VSS) to node 0.

When I do this, the spice simulation runs to completion but when I look at the waveform of the current through the VSS supply it is 0.  I do get non-zero current through the VDD supply connected to the DUT in the spice waveform, but the value does not match what I get when I run the same simulation without the VA module.

I assume I cannot simply use a branch statement as a pass-through (i.e. short circuit) as I have done above?
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2384
Silicon Valley
Re: using branch as a pass-through to measure current of DUT
Reply #1 - Jul 6th, 2016, 7:10pm
 
No you cannot. You cannot assign both the voltage and the current of a branch. In Verilog-A branches are either voltage or current sources, and you specify the voltage or current of the source. In your model you are trying to make the same branch both a voltage and a current source. That is impossible.

Instead, model a short (0-volt voltage source) between the two nodes, like this ...
Code:
module current_probe(p, n);
    electrical p, n;
    branch (p, n) short;

    analog V(short) <+ 0;
endmodule 


Or like this ...
Code:
module current_probe(p, n);
    electrical p, n;
    analog V(p,n) <+ 0;
endmodule 


You seem to have the wrong mental model for Verilog-A. To understand it better, you might want to take a look at this Verilog-A tutorial.

Thanks for providing a simple model and providing the whole model.  It makes it much easier to understand what is going on.

-Ken
Back to top
 
« Last Edit: Jul 14th, 2016, 11:15pm by Ken Kundert »  
View Profile WWW   IP Logged
va_user
New Member
*
Offline



Posts: 6

Re: using branch as a pass-through to measure current of DUT
Reply #2 - Jul 7th, 2016, 9:23am
 
Thanks, that works.  One thing I noticed is that the VSS current waveform of the simulation using the VA module you listed is 7.28% higher than the same current waveform when not using the VA module.  In theory a short circuit in the VA module should not affect the current through the DUT.  

Is there some loss of precision that is occurring due to the current calculations performed by the VA module?
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2384
Silicon Valley
Re: using branch as a pass-through to measure current of DUT
Reply #3 - Jul 8th, 2016, 10:12am
 
The result should be identical to what you would measure if you used a 0V voltage source to measure current, so there is no approximation. Perhaps the approximation is in the way you are measuring current without the Verilog-A module.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: using branch as a pass-through to measure current of DUT
Reply #4 - Jul 14th, 2016, 12:44pm
 
Ken -
You have an extra close-paren ) in your code:
Code:
analog V(p,n) <+ 0); 

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: 2384
Silicon Valley
Re: using branch as a pass-through to measure current of DUT
Reply #5 - Jul 14th, 2016, 11:16pm
 
Whoops. Thanks. I have now fixed it.

-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.