The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Reading current value in VerilogAMS
https://designers-guide.org/forum/YaBB.pl?num=1567776820

Message started by sanforyou on Sep 6th, 2019, 6:33am

Title: Reading current value in VerilogAMS
Post by sanforyou on Sep 6th, 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

Title: Re: Reading current value in VerilogAMS
Post by Ken Kundert on 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

Title: Re: Reading current value in VerilogAMS
Post by sanforyou on 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.





The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.