fix issue in reg test

This commit is contained in:
Victor 2024-09-05 10:43:53 +08:00
parent ba5c8a3364
commit 4aca4fda6f
2 changed files with 16 additions and 11 deletions

View File

@ -710,6 +710,12 @@ ShellCommandId add_route_clock_rr_graph_command_template(
shell_cmd.set_option_short_name(opt_file, "pcf");
shell_cmd.set_option_require_value(opt_file, openfpga::OPT_STRING);
shell_cmd.add_option("disable_unused_trees", false,
"Disable entire clock trees when they are not used by "
"any clock nets. Useful to reduce clock power");
shell_cmd.add_option("disable_unused_spines", false,
"Disable part of the clock tree which are used by clock "
"nets. Useful to reduce clock power");
/* Add an option '--verbose' */
shell_cmd.add_option("verbose", false, "Show verbose outputs");
@ -949,14 +955,14 @@ ShellCommandId add_report_reference_command_template(
/* Add an option '--no_time_stamp' */
shell_cmd.add_option("no_time_stamp", false,
"Do not print time stamp in output files");
"do not print time stamp in output files");
shell_cmd.add_option("verbose", false, "Show verbose outputs");
/* Add command to the Shell */
ShellCommandId shell_cmd_id =
shell.add_command(shell_cmd,
"report the number of instances for each unique module, "
"report all instances of each unique module, "
"under a given module",
hidden);
shell.set_command_class(shell_cmd_id, cmd_class_id);
@ -1224,9 +1230,7 @@ void add_setup_command_templates(openfpga::Shell<T>& shell,
/********************************
* Command 'report_reference'
*/
/* The command should NOT be executed before 'build_fabric' */
std::vector<ShellCommandId> cmd_dependency_report_reference;
cmd_dependency_report_reference.push_back(build_fabric_cmd_id);
add_report_reference_command_template<T>(
shell, openfpga_setup_cmd_class, cmd_dependency_report_reference, hidden);
}

View File

@ -46,7 +46,7 @@ int report_reference(const char* fname, const std::string& module_name,
}
if (module_manager.child_modules(parent_module).size() < 1) {
VTR_LOG_ERROR("Module %s hasn't any child module\n", module_name.c_str());
VTR_LOG_ERROR("Module %s contains no child module\n", module_name.c_str());
return CMD_EXEC_MINOR_ERROR;
}
@ -64,11 +64,7 @@ int report_reference(const char* fname, const std::string& module_name,
std::string child_module_name = module_manager.module_name(child_module);
std::vector<size_t> child_inst_vec =
module_manager.child_module_instances(parent_module, child_module);
for (size_t pos = 0; pos < child_module_name.length(); pos += 70) {
if (pos > 0) VTR_LOG("\n");
VTR_LOG("%-70s", child_module_name.substr(pos).c_str());
}
VTR_LOG(" %7d\n", child_inst_vec.size());
VTR_LOG("%-s %d\n", child_module_name.c_str(), child_inst_vec.size());
ref_cnt += child_inst_vec.size();
}
VTR_LOG(
@ -80,6 +76,11 @@ int report_reference(const char* fname, const std::string& module_name,
"--------------------------------------------------------------------------"
"----\n");
if (verbose) {
fp << "\nTotal " << module_manager.child_modules(parent_module).size()
<< " modules " << ref_cnt << " references\n";
}
fp << "references:" << std::endl;
for (ModuleId child_module : module_manager.child_modules(parent_module)) {
std::string child_module_name = module_manager.module_name(child_module);
@ -92,7 +93,7 @@ int report_reference(const char* fname, const std::string& module_name,
for (size_t inst_id : child_inst_vec) {
std::string inst_name =
module_manager.instance_name(parent_module, child_module, inst_id);
fp << " - " << inst_name.c_str() << "\n";
if (inst_name.size() > 0) fp << " - " << inst_name.c_str() << "\n";
}
}