<s> import string <EOL> import os <EOL> import sys <EOL> from Misc import misc , parameters_misc <EOL> import Scalar_quartus_project <EOL> default_memory_init = "<STR_LIT>" <EOL> install_base = misc . base_install_path ( ) <EOL> def test_harness ( parameters , default_memory_init = default_memory_init , install_base = install_base ) : <EOL> assembler_base = os . path . join ( install_base , "<STR_LIT>" ) <EOL> test_harness_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> parameters [ "<STR_LIT>" ] = default_memory_init <EOL> parameters [ "<STR_LIT>" ] = assembler_base <EOL> return test_harness_template . substitute ( parameters ) <EOL> def test_harness_script ( parameters ) : <EOL> test_harness_script_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> return test_harness_script_template . substitute ( parameters ) <EOL> def seed_run_script ( harness_name = misc . harness_name ) : <EOL> seed_run_script_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> return seed_run_script_template . substitute ( { "<STR_LIT>" : harness_name } ) <EOL> def all_seed_runs_script ( ) : <EOL> all_seed_run_script_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> return all_seed_run_script_template . substitute ( ) <EOL> def all_fmax_script ( harness_name = misc . harness_name ) : <EOL> all_fmax_script_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> return all_fmax_script_template . substitute ( { "<STR_LIT>" : harness_name } ) <EOL> def main ( parameters = { } ) : <EOL> name = parameters [ "<STR_LIT>" ] <EOL> test_harness_name = name + "<STR_LIT:_>" + misc . harness_name <EOL> test_harness_dir = os . path . join ( os . getcwd ( ) , misc . harness_name ) <EOL> cwd = os . getcwd ( ) <EOL> test_harness_file = test_harness ( parameters ) <EOL> misc . write_file ( test_harness_dir , test_harness_name + "<STR_LIT>" , test_harness_file ) <EOL> test_harness_run = test_harness_script ( parameters ) <EOL> misc . write_file ( test_harness_dir , "<STR_LIT>" + misc . harness_name , test_harness_run ) <EOL> misc . make_file_executable ( test_harness_dir , "<STR_LIT>" + misc . harness_name ) <EOL> seed_run = seed_run_script ( ) <EOL> misc . write_file ( cwd , "<STR_LIT>" , seed_run ) <EOL> misc . make_file_executable ( cwd , "<STR_LIT>" ) <EOL> all_seed_runs = all_seed_runs_script ( ) <EOL> misc . write_file ( cwd , "<STR_LIT>" , all_seed_runs ) <EOL> misc . make_file_executable ( cwd , "<STR_LIT>" ) <EOL> all_fmax = all_fmax_script ( ) <EOL> misc . write_file ( cwd , "<STR_LIT>" , all_fmax ) <EOL> misc . make_file_executable ( cwd , "<STR_LIT>" ) <EOL> parameters_misc . update_parameter_file ( os . getcwd ( ) , <EOL> name , <EOL> { "<STR_LIT>" : test_harness_name } ) <EOL> parameters . update ( { "<STR_LIT>" : test_harness_name } ) <EOL> Scalar_quartus_project . project ( parameters , test_harness_dir ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> parameters = parameters_misc . parse_cmdline ( sys . argv [ <NUM_LIT:1> : ] ) <EOL> main ( parameters ) </s>
