The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 1:49am
Pages: 1
Send Topic Print
Reading current value in VerilogAMS (Read 925 times)
sanforyou
Junior Member
**
Offline



Posts: 17

Reading current value in VerilogAMS
Sep 06th, 2019, 6:33am
 
I always seem to have trouble reading current's in VerilogAMS.
I have "IBP2U" input pin which stays at 2uA from time zero until the end of simulation, however in below code, IBP2U_ok signal never changes to "1" from "0". Any ideas why?


Code:
reg IBP2U_ok=1'b0;
parameter real IBP2U_high=4.0u;
parameter real IBP2U_low=1.0u;
always @(cross(I(IBP2U,AGND)-IBP2U_high,0) or cross(I(IBP2U,AGND)-IBP2U_low,0) or above(I(IBP2U,AGND)-IBP2U_low)) begin
	if( (I(IBP2U,AGND) > 1.0u) && (I(IBP2U,AGND) < 4.0u) )
		IBP2U_ok=1'b1;
	else
		IBP2U_ok=1'b0;
  end 

Back to top
 

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



Posts: 2384
Silicon Valley
Re: Reading current value in VerilogAMS
Reply #1 - Sep 6th, 2019, 1:16pm
 
Try copying the currents into local variables in the analog block and then reference the variable from the digital code.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
sanforyou
Junior Member
**
Offline



Posts: 17

Re: Reading current value in VerilogAMS
Reply #2 - Sep 6th, 2019, 1:54pm
 
Thanks Ken for the pointer. I did create a real variable and used inside analog block and then I realized real variable had (-2uA) value even though Simvision was showing (2uA) value when I plot the waveform.
Anyway I was able to use my original code for current probing once I reversed the polarity while threshold checking.




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