The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Rise and Fall time https://designers-guide.org/forum/YaBB.pl?num=1317176074 Message started by zahrein on Sep 27th, 2011, 7:14pm |
Title: Rise and Fall time Post by zahrein on Sep 27th, 2011, 7:14pm HI All, Copied my checkers. I don’t understand, why my time_vhi &time_vlo is fluctuating at different signals. Another thing is that my rise and fall time also is not consistant. module measure_riset_fallt (drive_en, pad); input pad; input drive_en; // need to declare variables so that the equation of the Rise/fall time can be calculated parameter real padh =1.05; real time_vhi; real time_vlo; real rise_time; real fall_time; analog begin @(cross(V(pad) - ((padh)*0.3), 1)) begin time_vlo= $abstime; end @(cross (V(pad) -((padh)*0.7),1)) begin //3 time_vhi=$abstime; // For rising time . Calculate between 70% and 30% of the peak Voltage rise_time=time_vhi-time_vlo; `AMS_INFORM($display("Rise Time= %e",rise_time)) end //3 if (drive_en==1'b1) begin //1 @(cross(V(pad) - ((padh)*0.7), -1)) begin time_vhi= $abstime; end @ (cross (V(pad) -((padh)*0.3),-1)) begin time_vlo=$abstime; fall_time = time_vhi - time_vlo; `AMS_INFORM($display("Fall Time= %e",fall_time)) end end end endmodule |
Title: Re: Rise and Fall time Post by Ken Kundert on Sep 27th, 2011, 11:43pm Your code was unreadable and I know it is unlikely that you will get many responses if people cannot easily understand your code, so I took the liberty of reformatting it to make it easier to understand: Code:
First a few generic comments:
What simulator is this? -Ken |
Title: Re: Rise and Fall time Post by zahrein on Sep 28th, 2011, 6:06pm Hi Ken, Thanks for your feedback and rearranging my code so that it is readable. The simulator i used is using the DVE. I believe most of the Logic Guyz use this. I will try modify base on your recomendations but i dont think tolerance play an issue as we cross on voltages and not the timing. Will let you know once its successfull. Thanks. |
Title: Re: Rise and Fall time Post by zahrein on Sep 28th, 2011, 10:51pm Manage to fix it. The "begin" and "end" have some disorganize. Here are the Codes and the waveform pics. module measure_riset_fallt (drive_en, pad); input pad; input drive_en; // need to declare variables so that the equation of the Rise/fall time can be calculated parameter real padh =1.05; real time_vhi; real time_vlo; real rise_time; real fall_time; analog begin // For rising time . Calculate between 70% and 30% of the peak Voltage @(cross(V(pad) - (padh*0.3), 1)) begin if (drive_en==1'b1) begin time_vlo= $abstime; end end @(cross (V(pad) -(padh*0.7),1)) begin //3 if (drive_en==1'b1) begin time_vhi=$abstime; rise_time=time_vhi-time_vlo; `AMS_INFORM($display("Rise Time= %e",rise_time)) end end //3 // For falling time . Calculate between 70% and 30% of the peak Voltage @(cross(V(pad) - (padh*0.7), -1)) begin if (drive_en==1'b1) begin time_vhi= $abstime; end end @ (cross (V(pad) -(padh*0.3),-1)) begin if (drive_en==1'b1) begin time_vlo=$abstime; fall_time = time_vhi - time_vlo; `AMS_INFORM($display("Fall Time= %e",fall_time)) end end end endmodule |
Title: Re: Rise and Fall time Post by Geoffrey_Coram on Oct 7th, 2011, 7:45am zahrein wrote on Sep 28th, 2011, 10:51pm:
It always helps me keep begin/end straight if I use proper indentation or formatting, as Ken showed you. (You need the "code" tag in the forum, so that spaces aren't combined.) |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |