mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-09-03 16:31:08 +02:00
Improved characterizer.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user