diff --git a/compiler/characterizer/delay.py b/compiler/characterizer/delay.py index e140ab24..d92e97fa 100644 --- a/compiler/characterizer/delay.py +++ b/compiler/characterizer/delay.py @@ -6,6 +6,7 @@ import tech import math import stimuli import charutils as ch +import utils OPTS = globals.get_opts() diff --git a/compiler/tests/00_code_format_check_test.py b/compiler/tests/00_code_format_check_test.py index b732edde..04ea2e99 100644 --- a/compiler/tests/00_code_format_check_test.py +++ b/compiler/tests/00_code_format_check_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2.7 import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/01_library_drc_test.py b/compiler/tests/01_library_drc_test.py index 63f7f90e..ea1612ff 100644 --- a/compiler/tests/01_library_drc_test.py +++ b/compiler/tests/01_library_drc_test.py @@ -2,7 +2,7 @@ "Run a regresion test the library cells for DRC" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/02_library_lvs_test.py b/compiler/tests/02_library_lvs_test.py index 356ad075..0ef925c6 100644 --- a/compiler/tests/02_library_lvs_test.py +++ b/compiler/tests/02_library_lvs_test.py @@ -2,7 +2,7 @@ "Run a regresion test the library cells for LVS" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_contact_test.py b/compiler/tests/03_contact_test.py index 502a0e2f..5b068786 100644 --- a/compiler/tests/03_contact_test.py +++ b/compiler/tests/03_contact_test.py @@ -2,7 +2,7 @@ "Run a regresion test for DRC on basic contacts of different array sizes" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_path_test.py b/compiler/tests/03_path_test.py index dd622a13..62a0ec0e 100644 --- a/compiler/tests/03_path_test.py +++ b/compiler/tests/03_path_test.py @@ -2,7 +2,7 @@ "Run a regresion test on a basic path" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_ptx_1finger_nmos_test.py b/compiler/tests/03_ptx_1finger_nmos_test.py index 07d233e6..eec4f13c 100644 --- a/compiler/tests/03_ptx_1finger_nmos_test.py +++ b/compiler/tests/03_ptx_1finger_nmos_test.py @@ -2,7 +2,7 @@ "Run a regresion test on a basic parameterized transistors" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_ptx_1finger_pmos_test.py b/compiler/tests/03_ptx_1finger_pmos_test.py index 7c9a012a..243f30de 100644 --- a/compiler/tests/03_ptx_1finger_pmos_test.py +++ b/compiler/tests/03_ptx_1finger_pmos_test.py @@ -2,7 +2,7 @@ "Run a regresion test on a basic parameterized transistors" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_ptx_3finger_nmos_test.py b/compiler/tests/03_ptx_3finger_nmos_test.py index d146cea7..61257e49 100644 --- a/compiler/tests/03_ptx_3finger_nmos_test.py +++ b/compiler/tests/03_ptx_3finger_nmos_test.py @@ -2,7 +2,7 @@ "Run a regresion test on a basic parameterized transistors" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_ptx_3finger_pmos_test.py b/compiler/tests/03_ptx_3finger_pmos_test.py index 603e0b64..ffcb5086 100644 --- a/compiler/tests/03_ptx_3finger_pmos_test.py +++ b/compiler/tests/03_ptx_3finger_pmos_test.py @@ -2,7 +2,7 @@ "Run a regresion test on a basic parameterized transistors" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/03_wire_test.py b/compiler/tests/03_wire_test.py index b458d458..46b7eee5 100644 --- a/compiler/tests/03_wire_test.py +++ b/compiler/tests/03_wire_test.py @@ -2,7 +2,7 @@ "Run a regresion test on a basic wire" import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/04_nand_2_test.py b/compiler/tests/04_nand_2_test.py index 1472cb0d..308a8867 100644 --- a/compiler/tests/04_nand_2_test.py +++ b/compiler/tests/04_nand_2_test.py @@ -6,7 +6,7 @@ size 2_input nand gate that is nmos_width=2*tech.drc[minwidth_tx]. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/04_nand_3_test.py b/compiler/tests/04_nand_3_test.py index d751a8a3..70972192 100644 --- a/compiler/tests/04_nand_3_test.py +++ b/compiler/tests/04_nand_3_test.py @@ -6,7 +6,7 @@ It generate only the minimum size 3_input nand gate that is nmos_width=3*tech.dr """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/04_nor_2_test.py b/compiler/tests/04_nor_2_test.py index 746891eb..8ef09468 100644 --- a/compiler/tests/04_nor_2_test.py +++ b/compiler/tests/04_nor_2_test.py @@ -5,7 +5,7 @@ This module doesn't generate multi_finger 2_input nor gate It generate only the minimum size 2_input nor gate that is nmos_width=2*tech.drc[minwidth_tx] """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/04_pinv_test.py b/compiler/tests/04_pinv_test.py index ecbbb7e6..cdc35175 100644 --- a/compiler/tests/04_pinv_test.py +++ b/compiler/tests/04_pinv_test.py @@ -4,7 +4,7 @@ Run regresion tests on a parameterized inverter """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/04_wordline_driver_test.py b/compiler/tests/04_wordline_driver_test.py index d5f6a7c4..a18b3c8c 100644 --- a/compiler/tests/04_wordline_driver_test.py +++ b/compiler/tests/04_wordline_driver_test.py @@ -4,7 +4,7 @@ Run a regresion test on a wordline_driver array """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/05_bitcell_array_test.py b/compiler/tests/05_bitcell_array_test.py index e794c72c..80dba9c1 100644 --- a/compiler/tests/05_bitcell_array_test.py +++ b/compiler/tests/05_bitcell_array_test.py @@ -4,7 +4,7 @@ Run a regresion test on a basic array """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/06_hierarchical_decoder_test.py b/compiler/tests/06_hierarchical_decoder_test.py index a087c5f3..6fc77d15 100644 --- a/compiler/tests/06_hierarchical_decoder_test.py +++ b/compiler/tests/06_hierarchical_decoder_test.py @@ -4,7 +4,7 @@ Run a regresion test on a thierarchy_decoder. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/06_hierarchical_predecode2x4_test.py b/compiler/tests/06_hierarchical_predecode2x4_test.py index 0114728e..3b630fe4 100644 --- a/compiler/tests/06_hierarchical_predecode2x4_test.py +++ b/compiler/tests/06_hierarchical_predecode2x4_test.py @@ -4,7 +4,7 @@ Run a regresion test on a hierarchical_predecode2x4. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/06_hierarchical_predecode3x8_test.py b/compiler/tests/06_hierarchical_predecode3x8_test.py index 6458513e..39f3517f 100644 --- a/compiler/tests/06_hierarchical_predecode3x8_test.py +++ b/compiler/tests/06_hierarchical_predecode3x8_test.py @@ -4,7 +4,7 @@ Run a regresion test on a hierarchical_predecode3x8. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/07_single_level_column_mux_test.py b/compiler/tests/07_single_level_column_mux_test.py index c810b865..35305102 100644 --- a/compiler/tests/07_single_level_column_mux_test.py +++ b/compiler/tests/07_single_level_column_mux_test.py @@ -4,7 +4,7 @@ Run a regresion test on a single transistor column_mux. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/08_precharge_array_test.py b/compiler/tests/08_precharge_array_test.py index 66fcb193..8b4d3e92 100644 --- a/compiler/tests/08_precharge_array_test.py +++ b/compiler/tests/08_precharge_array_test.py @@ -4,7 +4,7 @@ Run a regresion test on a precharge array """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/09_sense_amp_array_test.py b/compiler/tests/09_sense_amp_array_test.py index 2974712e..d29f496d 100644 --- a/compiler/tests/09_sense_amp_array_test.py +++ b/compiler/tests/09_sense_amp_array_test.py @@ -4,7 +4,7 @@ Run a regresion test on a sense amp array """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/10_write_driver_array_test.py b/compiler/tests/10_write_driver_array_test.py index 559107f8..4148e865 100644 --- a/compiler/tests/10_write_driver_array_test.py +++ b/compiler/tests/10_write_driver_array_test.py @@ -4,7 +4,7 @@ Run a regresion test on a write driver array """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/11_ms_flop_array_test.py b/compiler/tests/11_ms_flop_array_test.py index 33680a53..0c26a001 100644 --- a/compiler/tests/11_ms_flop_array_test.py +++ b/compiler/tests/11_ms_flop_array_test.py @@ -4,7 +4,7 @@ Run a regresion test on a dff_array. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/13_control_logic_test.py b/compiler/tests/13_control_logic_test.py index 37c39ca1..567f3584 100644 --- a/compiler/tests/13_control_logic_test.py +++ b/compiler/tests/13_control_logic_test.py @@ -4,7 +4,7 @@ Run a regresion test on a control_logic """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/14_logic_effort_dc_test.py b/compiler/tests/14_logic_effort_dc_test.py index 48e8b768..9cd3c2ea 100644 --- a/compiler/tests/14_logic_effort_dc_test.py +++ b/compiler/tests/14_logic_effort_dc_test.py @@ -4,7 +4,7 @@ Run a test on a delay chain """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/15_tri_gate_array_test.py b/compiler/tests/15_tri_gate_array_test.py index ef388696..3daa7556 100644 --- a/compiler/tests/15_tri_gate_array_test.py +++ b/compiler/tests/15_tri_gate_array_test.py @@ -4,7 +4,7 @@ Run a regresion test on a tri_gate_array. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/16_replica_bitline_test.py b/compiler/tests/16_replica_bitline_test.py index 2b0aaa9a..c8e732c8 100644 --- a/compiler/tests/16_replica_bitline_test.py +++ b/compiler/tests/16_replica_bitline_test.py @@ -4,7 +4,7 @@ Run a test on a delay chain """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/19_bank_test.py b/compiler/tests/19_bank_test.py index aef9068b..0bd67b5b 100644 --- a/compiler/tests/19_bank_test.py +++ b/compiler/tests/19_bank_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/20_sram_1bank_test.py b/compiler/tests/20_sram_1bank_test.py index d1b553ae..5ca96ab0 100644 --- a/compiler/tests/20_sram_1bank_test.py +++ b/compiler/tests/20_sram_1bank_test.py @@ -4,7 +4,7 @@ Run a regresion test on a 1 bank SRAM """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/20_sram_2bank_test.py b/compiler/tests/20_sram_2bank_test.py index b07bf1a5..9f87d55b 100644 --- a/compiler/tests/20_sram_2bank_test.py +++ b/compiler/tests/20_sram_2bank_test.py @@ -4,7 +4,7 @@ Run a regresion test on a 2 bank SRAM """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/20_sram_4bank_test.py b/compiler/tests/20_sram_4bank_test.py index beacc5e2..146b04fe 100644 --- a/compiler/tests/20_sram_4bank_test.py +++ b/compiler/tests/20_sram_4bank_test.py @@ -4,7 +4,7 @@ Run a regresion test on a 4 bank SRAM """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/21_hspice_delay_test.py b/compiler/tests/21_hspice_delay_test.py index e2245afc..48a74dcc 100644 --- a/compiler/tests/21_hspice_delay_test.py +++ b/compiler/tests/21_hspice_delay_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header,isclose import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals @@ -63,11 +63,7 @@ class timing_sram_test(unittest.TestCase): self.assertTrue(False) # other techs fail os.remove(tempspice) - -def isclose(value1,value2): - """ This is used to compare relative values for convergence. """ - return (abs(value1 - value2) / max(value1,value2) <= 1e-2) - + # instantiate a copdsay of the class to actually run the test if __name__ == "__main__": diff --git a/compiler/tests/21_hspice_hold_test.py b/compiler/tests/21_hspice_hold_test.py index 74fe2e7d..8bc48afa 100644 --- a/compiler/tests/21_hspice_hold_test.py +++ b/compiler/tests/21_hspice_hold_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header,isclose import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals @@ -44,10 +44,6 @@ class timing_setup_test(unittest.TestCase): else: self.assertTrue(False) # other techs fail -def isclose(value1,value2): - """ This is used to compare relative values for convergence. """ - return (abs(value1 - value2) / max(value1,value2) <= 1e-2) - # instantiate a copdsay of the class to actually run the test if __name__ == "__main__": diff --git a/compiler/tests/21_hspice_setup_test.py b/compiler/tests/21_hspice_setup_test.py index ac3e66ff..e60e937c 100644 --- a/compiler/tests/21_hspice_setup_test.py +++ b/compiler/tests/21_hspice_setup_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header,isclose import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals @@ -44,11 +44,6 @@ class timing_setup_test(unittest.TestCase): else: self.assertTrue(False) # other techs fail -def isclose(value1,value2): - """ This is used to compare relative values for convergence. """ - return (abs(value1 - value2) / max(value1,value2) <= 1e-2) - - # instantiate a copdsay of the class to actually run the test if __name__ == "__main__": (OPTS, args) = globals.parse_args() diff --git a/compiler/tests/21_ngspice_delay_test.py b/compiler/tests/21_ngspice_delay_test.py index 05287ee4..17979d41 100644 --- a/compiler/tests/21_ngspice_delay_test.py +++ b/compiler/tests/21_ngspice_delay_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header,isclose import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals @@ -64,11 +64,6 @@ class timing_sram_test(unittest.TestCase): os.remove(tempspice) -def isclose(value1,value2): - """ This is used to compare relative values for convergence. """ - return (abs(value1 - value2) / max(value1,value2) <= 1e-2) - - # instantiate a copdsay of the class to actually run the test if __name__ == "__main__": (OPTS, args) = globals.parse_args() diff --git a/compiler/tests/21_ngspice_hold_test.py b/compiler/tests/21_ngspice_hold_test.py index 4e7a92ce..de7c77c7 100644 --- a/compiler/tests/21_ngspice_hold_test.py +++ b/compiler/tests/21_ngspice_hold_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header,isclose import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals @@ -39,16 +39,11 @@ class timing_setup_test(unittest.TestCase): self.assertTrue(isclose(one_setup_time,-0.0048828125)) self.assertTrue(isclose(zero_setup_time,-0.010986328125)) elif OPTS.tech_name == "scn3me_subm": - self.assertTrue(isclose(one_setup_time,0.04638671875)) + self.assertTrue(isclose(one_setup_time,0.45654296875)) # diff than hspice self.assertTrue(isclose(zero_setup_time,-0.0830078125)) else: self.assertTrue(False) # other techs fail -def isclose(value1,value2): - """ This is used to compare relative values for convergence. """ - return (abs(value1 - value2) / max(value1,value2) <= 1e-2) - - # instantiate a copdsay of the class to actually run the test if __name__ == "__main__": (OPTS, args) = globals.parse_args() diff --git a/compiler/tests/21_ngspice_setup_test.py b/compiler/tests/21_ngspice_setup_test.py index 6b2fce53..902f3c03 100644 --- a/compiler/tests/21_ngspice_setup_test.py +++ b/compiler/tests/21_ngspice_setup_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header,isclose import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals @@ -38,16 +38,11 @@ class timing_setup_test(unittest.TestCase): self.assertTrue(isclose(one_setup_time,0.0146484375)) self.assertTrue(isclose(zero_setup_time,0.008544921875)) elif OPTS.tech_name == "scn3me_subm": - self.assertTrue(isclose(one_setup_time,0.0927734375)) + self.assertTrue(isclose(one_setup_time,0.09521484375)) #diff than hspice self.assertTrue(isclose(zero_setup_time,-0.0244140625)) else: self.assertTrue(False) # other techs fail -def isclose(value1,value2): - """ This is used to compare relative values for convergence. """ - return (abs(value1 - value2) / max(value1,value2) <= 1e-2) - - # instantiate a copdsay of the class to actually run the test if __name__ == "__main__": (OPTS, args) = globals.parse_args() diff --git a/compiler/tests/22_pex_func_test_with_pinv.py b/compiler/tests/22_pex_func_test_with_pinv.py index 58c40e18..4f79fcb6 100644 --- a/compiler/tests/22_pex_func_test_with_pinv.py +++ b/compiler/tests/22_pex_func_test_with_pinv.py @@ -4,7 +4,7 @@ Run a regression test on an extracted SRAM to ensure functionality. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/22_sram_func_test.py b/compiler/tests/22_sram_func_test.py index 5c7bc6c3..70bea6d4 100644 --- a/compiler/tests/22_sram_func_test.py +++ b/compiler/tests/22_sram_func_test.py @@ -4,7 +4,7 @@ Run a regresion test on various srams """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/23_lib_sram_test.py b/compiler/tests/23_lib_sram_test.py index 3c2d226c..75937648 100644 --- a/compiler/tests/23_lib_sram_test.py +++ b/compiler/tests/23_lib_sram_test.py @@ -4,7 +4,7 @@ Check the .lib file for an SRAM """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/24_lef_sram_test.py b/compiler/tests/24_lef_sram_test.py index 2a349502..b1c4c565 100644 --- a/compiler/tests/24_lef_sram_test.py +++ b/compiler/tests/24_lef_sram_test.py @@ -4,7 +4,7 @@ Check the LEF file for an SRMA """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/25_verilog_sram_test.py b/compiler/tests/25_verilog_sram_test.py index dc628081..a1aed704 100644 --- a/compiler/tests/25_verilog_sram_test.py +++ b/compiler/tests/25_verilog_sram_test.py @@ -4,7 +4,7 @@ Check the .v file for an SRAM """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/30_openram_test.py b/compiler/tests/30_openram_test.py index ce0a2a05..cf5ddf70 100644 --- a/compiler/tests/30_openram_test.py +++ b/compiler/tests/30_openram_test.py @@ -6,7 +6,7 @@ check that these files are right. """ import unittest -from header import header +from testutils import header import sys,os sys.path.append(os.path.join(sys.path[0],"..")) import globals diff --git a/compiler/tests/sram_2_16_1_freepdk45.gds b/compiler/tests/sram_2_16_1_freepdk45.gds deleted file mode 100644 index 2be62057..00000000 Binary files a/compiler/tests/sram_2_16_1_freepdk45.gds and /dev/null differ diff --git a/compiler/tests/sram_2_16_1_freepdk45.lef b/compiler/tests/sram_2_16_1_freepdk45.lef deleted file mode 100644 index e69de29b..00000000 diff --git a/compiler/tests/header.py b/compiler/tests/testutils.py similarity index 52% rename from compiler/tests/header.py rename to compiler/tests/testutils.py index 194a301d..f1280bdc 100644 --- a/compiler/tests/header.py +++ b/compiler/tests/testutils.py @@ -1,4 +1,16 @@ + +def isclose(value1,value2,error_tolerance=1e-2): + """ This is used to compare relative values.. """ + import debug + relative_diff = abs(value1 - value2) / max(value1,value2) + check = relative_diff <= error_tolerance + if not check: + debug.info(2,"NOT CLOSE {0} {1} relative diff={2}".format(value1,value2,relative_diff)) + else: + debug.info(2,"CLOSE {0} {1} relative diff={2}".format(value1,value2,relative_diff)) + return (check) + def header(str, tec): tst = "Running Test for:" print "\n" diff --git a/compiler/utils.py b/compiler/utils.py index 4f00563a..5034cb53 100644 --- a/compiler/utils.py +++ b/compiler/utils.py @@ -41,3 +41,7 @@ def auto_measure_libcell(pin_list, name, units, layer): for pin in pin_list: cell[str(pin)] = gdsPinToOffset(cell_vlsi.readPin(str(pin))) return cell + + + +