The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 11:26pm
Pages: 1
Send Topic Print
Error in Unary negation operator in VerilogA designing charge pump (Read 78 times)
kankanas
New Member
*
Offline



Posts: 1

Error in Unary negation operator in VerilogA designing charge pump
Feb 02nd, 2022, 11:38pm
 
Hello all,

I need help understanding the reason for the error, that I am getting for using the unary negation operator in VerilogA code. I went through the verilogA reference material, but I am getting no clue.

I will be helpful in getting a reply.
Back to top
 

veriloga.PNG
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2384
Silicon Valley
Re: Error in Unary negation operator in VerilogA designing charge pump
Reply #1 - Feb 3rd, 2022, 8:18pm
 
The model appears to be a Verilog-AMS model, not a Verilog-A model.  Are you really simulating it with Verilog-A?

If you are really using Verilog-A, you might want start with Listing 10 in https://designers-guide.org/analysis/PLLnoise+jitter.pdf and strip out the jitter modeling.

Note the use of cross functions.  Those are important to resolving the exact time when the thresholds are crossed.  Without those you will be subject to high-levels of jitter that stems from finite time steps of the simulator.

Also, notice that the transition function is not in a conditional.  Transition function should not be in conditionals or loops.  Instead, assign the current to a variable, and then use that variable to drive a transition function outside the if statement.

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



Posts: 1998
Massachusetts, USA
Re: Error in Unary negation operator in VerilogA designing charge pump
Reply #2 - Feb 10th, 2022, 1:40pm
 
The (incorrect) indentation of the original model looks like the transition() function is in a conditional (along with the contribution), but it is not. The code should be indented differently for better readability:
Code:
    if(!up && down)
	  out = -cur;
    else if(!down && up)
	  out = cur;
    else
	  out = 0;
    I(pout, nout) <+ transition(out, 0.0, 20p, 20p);
 



But, as Ken notes, this doesn't look like true Verilog-A. You have "up" and "down" appearing in the if conditions, without the access function, and actually you haven't set a discipline for them (you set pout and nout to be electrical). I would expect a true Verilog-A model to have "electrical up, down;" and then access them with V(up) and V(down), perhaps comparing them with a threshold.

Based on the highlighting in the screen-shot, it seems the problem is with up and down, not with the unary minus sign.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
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.