mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-09-07 03:20:39 +02:00
Merge branch 'dev' into multibank
This commit is contained in:
@@ -28,6 +28,7 @@ class code_format_test(openram_test):
|
||||
continue
|
||||
errors += check_file_format_tab(code)
|
||||
errors += check_file_format_carriage(code)
|
||||
errors += check_file_format_whitespace(code)
|
||||
|
||||
for code in source_codes:
|
||||
if re.search("gdsMill", code):
|
||||
@@ -51,7 +52,7 @@ def setup_files(path):
|
||||
files = []
|
||||
for (dir, _, current_files) in os.walk(path):
|
||||
for f in current_files:
|
||||
files.append(os.getenv("OPENRAM_HOME"))
|
||||
files.append(os.path.join(dir, f))
|
||||
nametest = re.compile("\.py$", re.IGNORECASE)
|
||||
select_files = list(filter(nametest.search, files))
|
||||
return select_files
|
||||
@@ -92,16 +93,43 @@ def check_file_format_carriage(file_name):
|
||||
if len(key_positions)>10:
|
||||
line_numbers = key_positions[:10] + [" ..."]
|
||||
else:
|
||||
line_numbers = key_positoins
|
||||
line_numbers = key_positions
|
||||
debug.info(0, '\nFound ' + str(len(key_positions)) + ' carriage returns in ' +
|
||||
str(file_name) + ' (lines ' + ",".join(str(x) for x in line_numbers) + ')')
|
||||
f.close()
|
||||
return len(key_positions)
|
||||
|
||||
|
||||
def check_file_format_whitespace(file_name):
|
||||
"""
|
||||
Check if file contains a line with whitespace at the end
|
||||
and return the number of these lines.
|
||||
"""
|
||||
|
||||
f = open(file_name, "r")
|
||||
key_positions = []
|
||||
for num, line in enumerate(f.readlines()):
|
||||
if re.match(r".*[ \t]$", line):
|
||||
key_positions.append(num)
|
||||
if len(key_positions) > 0:
|
||||
if len(key_positions) > 10:
|
||||
line_numbers = key_positions[:10] + [" ..."]
|
||||
else:
|
||||
line_numbers = key_positions
|
||||
debug.info(0, "\nFound " + str(len(key_positions)) + " ending whitespace in " +
|
||||
str(file_name) + " (lines " + ",".join(str(x) for x in line_numbers) + ")")
|
||||
f.close()
|
||||
return len(key_positions)
|
||||
|
||||
|
||||
def check_print_output(file_name):
|
||||
"""Check if any files (except debug.py) call the _print_ function. We should
|
||||
use the debug output with verbosity instead!"""
|
||||
|
||||
skip_files = ["printGDS.py", "uniquifyGDS.py", "processGDS.py", "model_data_util.py"]
|
||||
base_file_name = os.path.basename(file_name)
|
||||
if base_file_name in skip_files:
|
||||
return(0)
|
||||
file = open(file_name, "r+b")
|
||||
line = file.read().decode('utf-8')
|
||||
# skip comments with a hash
|
||||
|
||||
@@ -43,7 +43,7 @@ class library_lvs_test(openram_test):
|
||||
self.assertEqual(drc_errors + lvs_errors, 0)
|
||||
globals.end_openram()
|
||||
|
||||
|
||||
|
||||
def setup_files():
|
||||
gds_dir = OPTS.openram_tech + "/gds_lib"
|
||||
sp_dir = OPTS.openram_tech + "/lvs_lib"
|
||||
|
||||
@@ -32,7 +32,7 @@ class replica_column_test(openram_test):
|
||||
debug.info(2, "Testing one right replica column for dual port")
|
||||
a = factory.create(module_type="replica_column", rows=4, rbl=[0, 1], replica_bit=5)
|
||||
self.local_check(a)
|
||||
|
||||
|
||||
debug.info(2, "Testing two (left, right) replica columns for dual port")
|
||||
a = factory.create(module_type="replica_column", rows=4, rbl=[1, 1], replica_bit=1)
|
||||
self.local_check(a)
|
||||
@@ -40,7 +40,7 @@ class replica_column_test(openram_test):
|
||||
debug.info(2, "Testing two (left, right) replica columns for dual port")
|
||||
a = factory.create(module_type="replica_column", rows=4, rbl=[1, 1], replica_bit=6)
|
||||
self.local_check(a)
|
||||
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
|
||||
@@ -63,7 +63,7 @@ class port_data_spare_cols_test(openram_test):
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 1
|
||||
globals.setup_bitcell()
|
||||
|
||||
|
||||
c.num_words=16
|
||||
c.words_per_row=1
|
||||
factory.reset()
|
||||
|
||||
@@ -31,7 +31,7 @@ class psingle_bank_test(openram_test):
|
||||
OPTS.num_w_ports = 0
|
||||
OPTS.num_r_ports = 0
|
||||
globals.setup_bitcell()
|
||||
|
||||
|
||||
c = sram_config(word_size=4,
|
||||
num_words=16)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
|
||||
|
||||
class psram_1bank_2mux_1rw_1w_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
|
||||
@@ -28,7 +28,7 @@ class psram_1bank_2mux_1rw_1w_wmask_test(openram_test):
|
||||
OPTS.num_w_ports = 1
|
||||
OPTS.num_r_ports = 0
|
||||
globals.setup_bitcell()
|
||||
|
||||
|
||||
c = sram_config(word_size=8,
|
||||
write_size=4,
|
||||
num_words=32,
|
||||
|
||||
@@ -22,7 +22,7 @@ class sram_1bank_4mux_1rw_1r_test(openram_test):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
from modules import sram_config
|
||||
|
||||
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
@@ -92,8 +92,8 @@ class model_delay_test(openram_test):
|
||||
else:
|
||||
self.assertTrue(False) # other techs fail
|
||||
|
||||
print('spice_delays', spice_delays)
|
||||
print('model_delays', model_delays)
|
||||
debug.info(3, 'spice_delays {}'.fomrat(spice_delays))
|
||||
debug.info(3, 'model_delays {}'.format(model_delays))
|
||||
|
||||
# Check if no too many or too few results
|
||||
self.assertTrue(len(spice_delays.keys())==len(model_delays.keys()))
|
||||
|
||||
@@ -96,7 +96,7 @@ class timing_sram_test(openram_test):
|
||||
'slew_hl': [2.039655],
|
||||
'slew_lh': [2.039655],
|
||||
'write0_power': [19.31883],
|
||||
'write1_power': [15.297369999999999]}
|
||||
'write1_power': [15.297369999999999]}
|
||||
else:
|
||||
self.assertTrue(False) # other techs fail
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class regression_model_test(openram_test):
|
||||
debug.info(1, "Probe address {0} probe data bit {1}".format(probe_address, probe_data))
|
||||
|
||||
corner = (OPTS.process_corners[0], OPTS.supply_voltages[0], OPTS.temperatures[0])
|
||||
|
||||
|
||||
#m = linear_regression(s.s, tempspice, corner)
|
||||
m = neural_network(s.s, tempspice, corner)
|
||||
only_test = ['rise_delay']
|
||||
|
||||
@@ -24,7 +24,7 @@ class psram_1bank_2mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
OPTS.bitcell = "pbitcell"
|
||||
OPTS.replica_bitcell="replica_pbitcell"
|
||||
OPTS.dummy_bitcell="dummy_pbitcell"
|
||||
|
||||
@@ -25,7 +25,7 @@ class psram_1bank_4mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
OPTS.bitcell = "pbitcell"
|
||||
OPTS.replica_bitcell="replica_pbitcell"
|
||||
OPTS.dummy_bitcell="dummy_pbitcell"
|
||||
|
||||
@@ -25,7 +25,7 @@ class psram_1bank_8mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
OPTS.bitcell = "pbitcell"
|
||||
OPTS.replica_bitcell="replica_pbitcell"
|
||||
OPTS.dummy_bitcell="dummy_pbitcell"
|
||||
|
||||
@@ -24,7 +24,7 @@ class psram_1bank_nomux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
OPTS.bitcell = "pbitcell"
|
||||
OPTS.replica_bitcell="replica_pbitcell"
|
||||
OPTS.dummy_bitcell="dummy_pbitcell"
|
||||
|
||||
@@ -25,7 +25,7 @@ class sram_1bank_2mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
# This is a hack to reload the characterizer __init__ with the spice version
|
||||
from importlib import reload
|
||||
import characterizer
|
||||
|
||||
@@ -25,7 +25,7 @@ class sram_1bank_2mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
# This is a hack to reload the characterizer __init__ with the spice version
|
||||
from importlib import reload
|
||||
import characterizer
|
||||
|
||||
@@ -25,7 +25,7 @@ class sram_1bank_4mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
# This is a hack to reload the characterizer __init__ with the spice version
|
||||
from importlib import reload
|
||||
import characterizer
|
||||
|
||||
@@ -25,7 +25,7 @@ class sram_1bank_8mux_func_test(openram_test):
|
||||
OPTS.analytical_delay = False
|
||||
OPTS.netlist_only = True
|
||||
OPTS.trim_netlist = False
|
||||
|
||||
|
||||
# This is a hack to reload the characterizer __init__ with the spice version
|
||||
from importlib import reload
|
||||
import characterizer
|
||||
|
||||
@@ -81,8 +81,8 @@ class ngspice_pex_pinv_test(openram_test):
|
||||
test_sim = self.write_simulation(sim_file, test_module, top_level_name)
|
||||
test_sim.run_sim("stim.sp")
|
||||
delay = parse_spice_list(log_file_name, "pinv_delay")
|
||||
|
||||
os.chdir(cwd)
|
||||
|
||||
os.chdir(cwd)
|
||||
return delay
|
||||
|
||||
def write_simulation(self, sim_file, cir_file, top_module_name):
|
||||
|
||||
@@ -78,7 +78,7 @@ class openram_back_end_test(openram_test):
|
||||
filename = "{0}{1}".format(out_path, out_file)
|
||||
debug.info(1, "Checking for file: " + filename)
|
||||
self.assertEqual(os.path.exists(filename), True)
|
||||
|
||||
|
||||
# Make sure there is any .lib file
|
||||
import glob
|
||||
files = glob.glob('{0}/*.lib'.format(out_path))
|
||||
|
||||
@@ -55,9 +55,9 @@ def fork_tests(num_threads):
|
||||
results = []
|
||||
test_partitions = partition_unit_tests(suite, num_threads)
|
||||
suite._tests[:] = []
|
||||
|
||||
|
||||
def do_fork(suite):
|
||||
|
||||
|
||||
for test_partition in test_partitions:
|
||||
test_suite = unittest.TestSuite(test_partition)
|
||||
test_partition[:] = []
|
||||
@@ -103,9 +103,9 @@ if num_threads == 1:
|
||||
final_suite = suite
|
||||
else:
|
||||
final_suite = ConcurrentTestSuite(suite, fork_tests(num_threads))
|
||||
|
||||
|
||||
test_result = test_runner.run(final_suite)
|
||||
|
||||
|
||||
# import verify
|
||||
# verify.print_drc_stats()
|
||||
# verify.print_lvs_stats()
|
||||
|
||||
Reference in New Issue
Block a user