Improved characterizer.

This commit is contained in:
Matt Guthaus
2017-07-06 08:42:25 -07:00
parent e92cb9ecef
commit 20d8c0bc45
40 changed files with 1511 additions and 1626 deletions
+13 -18
View File
@@ -4,23 +4,8 @@ import debug
OPTS = globals.get_opts()
# 0.1% is the relative tolerance for convergence
error_tolerance = 0.001
# times are in ns, so this is how many digits of precision
# 3 digits = 1ps
# 4 digits = 0.1ps
# etc.
time_precision = 3
# voltages are in volts
# 3 digits = 1mv
# 4 digits = 0.1mv
# 5 digits = 0.01mv
# 6 digits = 1uv
# etc
voltage_precision = 5
def relative_compare(value1,value2):
def relative_compare(value1,value2,error_tolerance=0.001):
""" This is used to compare relative values for convergence. """
return (abs(value1 - value2) / max(value1,value2) <= error_tolerance)
@@ -40,10 +25,20 @@ def parse_output(filename, key):
else:
return "Failed"
def round_time(time):
def round_time(time,time_precision=3):
# times are in ns, so this is how many digits of precision
# 3 digits = 1ps
# 4 digits = 0.1ps
# etc.
return round(time,time_precision)
def round_voltage(voltage):
def round_voltage(voltage,voltag_precision=5):
# voltages are in volts
# 3 digits = 1mv
# 4 digits = 0.1mv
# 5 digits = 0.01mv
# 6 digits = 1uv
# etc
return round(voltage,voltage_precision)
def convert_to_float(number):