diff --git a/test/gen_config.py b/test/gen_config.py index 298e774..9bb51cf 100755 --- a/test/gen_config.py +++ b/test/gen_config.py @@ -42,26 +42,43 @@ modules = [ data_widths = [32] bist_lengths = [1, 1024, 8192] bist_randoms = [False] +access_patterns = ['access_pattern.csv'] def main(): parser = argparse.ArgumentParser(description='Generate configuration for all possible argument combinations.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('--sdram-modules', nargs='+', default=modules, help='--sdram-module options') - parser.add_argument('--sdram-data-widths', nargs='+', default=data_widths, help='--sdram-data-width options') - parser.add_argument('--bist-lengths', nargs='+', default=bist_lengths, help='--bist-length options') - parser.add_argument('--bist-randoms', nargs='+', default=bist_randoms, help='--bist-random options') - parser.add_argument('--name-format', default='test_%d', help='Name format for i-th test') + parser.add_argument('--sdram-modules', nargs='+', default=modules, help='--sdram-module options') + parser.add_argument('--sdram-data-widths', nargs='+', default=data_widths, help='--sdram-data-width options') + parser.add_argument('--bist-lengths', nargs='+', default=bist_lengths, help='--bist-length options') + parser.add_argument('--bist-randoms', nargs='+', default=bist_randoms, help='--bist-random options') + parser.add_argument('--access-patterns', nargs='+', default=access_patterns, help='--access-pattern options') + parser.add_argument('--name-format', default='test_%d', help='Name format for i-th test') args = parser.parse_args() - product = itertools.product(args.sdram_modules, args.sdram_data_widths, args.bist_lengths, args.bist_randoms) + bist_product = itertools.product(args.sdram_modules, args.sdram_data_widths, args.bist_lengths, args.bist_randoms) + pattern_product = itertools.product(args.sdram_modules, args.sdram_data_widths, args.access_patterns) + + i = 0 configurations = {} - for i, (module, data_width, bist_length, bist_random) in enumerate(product): + for module, data_width, bist_length, bist_random in bist_product: configurations[args.name_format % i] = { 'sdram_module': module, 'sdram_data_width': data_width, - 'bist_length': bist_length, - 'bist_random': bist_random, + 'access_pattern': { + 'bist_length': bist_length, + 'bist_random': bist_random, + } } + i += 1 + for module, data_width, access_pattern in pattern_product: + configurations[args.name_format % i] = { + 'sdram_module': module, + 'sdram_data_width': data_width, + 'access_pattern': { + 'pattern_file': access_pattern, + } + } + i += 1 json_str = json.dumps(configurations, indent=4) print(json_str)