hammer icon indicating copy to clipboard operation
hammer copied to clipboard

vcs sim flow doesn't include -e configs in dict

Open growly opened this issue 5 years ago • 1 comments

In a clean environment, if I try to run simulation with this make command:

$(HAMMER_EXEC) sim -e $(ENV_YML) $(foreach x,$(INPUT_CONFS) , -p $(x)) -p sim_config.yml -p $(src_dir)/rtl_sim_config.lut.yml --obj_dir $(OBJ_DIR)

VCS runs (!), and then the flow quits with this trace:

  File "./inst-vlsi.py", line 46, in <module>
    InstDriver().main()
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer-vlsi/hammer_vlsi/cli_driver.py", line 1264, in main
    sys.exit(self.run_main_parsed(vars(parser.parse_args(args))))
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer-vlsi/hammer_vlsi/cli_driver.py", line 1171, in run_main_parsed
    output_config = action_func(driver, errors.append)  # type: Optional[dict]
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer-vlsi/hammer_vlsi/cli_driver.py", line 528, in action
    self.get_full_config(driver, output))
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer-vlsi/hammer_vlsi/cli_driver.py", line 339, in get_full_config
    output_full = deepdict(driver.project_config)
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer-vlsi/hammer_vlsi/driver.py", line 125, in project_config
    return hammer_config.combine_configs(self.project_configs)
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 933, in combine_configs
    final_dict = reduce(combine_meta, settings_ordered, expanded_config)  # type: dict
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 930, in combine_meta
    meta_setting + "_meta": lazy_metas[meta_setting + "_meta"]
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 648, in update_and_expand_meta
    MetaDirectiveParams(meta_path=meta_dict.get(_CONFIG_PATH_KEY, "unspecified")))
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 244, in subst_action
    config_dict[key] = perform_subst(value)
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 241, in perform_subst
    newval = subst_str(value, lambda key: config_dict[key])
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 224, in subst_str
    return re.sub(__VARIABLE_EXPANSION_REGEX, lambda x: replacement_func(x.group(1)), input_str)
  File "/usr/lib64/python3.6/re.py", line 191, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 224, in <lambda>
    return re.sub(__VARIABLE_EXPANSION_REGEX, lambda x: replacement_func(x.group(1)), input_str)
  File "/tools/projects/aryap/hammer-test/hammer/src/hammer_config/config_src.py", line 241, in <lambda>
    newval = subst_str(value, lambda key: config_dict[key])
KeyError: 'synopsys.vcs_home'

I printed the entire config_dict at the source of the error and the key is indeed missing, but it is defined in the $(ENV_YML) file and that must work since VCS itself runs first.

Changing the inclusion of $(ENV_YML) from with the -e switch to the -p switch makes the problem go away.

It seems that for this code path, the two config dicts are not merged, but they should be?

growly avatar Jul 19 '20 22:07 growly

Maybe this has to do with the fact that VCS is invoked twice (once to generate the executable and once to run it). This sounds like a real bug that will need to be fixed.

colinschmidt avatar Oct 06 '20 17:10 colinschmidt