mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-19 04:13:39 +00:00
Replace -ignore_redef with -[no]overwrite
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
e060375f23
commit
a572b49538
5 changed files with 58 additions and 21 deletions
|
@ -463,9 +463,13 @@ struct LibertyFrontend : public Frontend {
|
|||
log(" -lib\n");
|
||||
log(" only create empty blackbox modules\n");
|
||||
log("\n");
|
||||
log(" -ignore_redef\n");
|
||||
log(" -nooverwrite\n");
|
||||
log(" ignore re-definitions of modules. (the default behavior is to\n");
|
||||
log(" create an error message.)\n");
|
||||
log(" create an error message if the existing module is not a blackbox\n");
|
||||
log(" module, and overwrite the existing module if it is a blackbox module.)\n");
|
||||
log("\n");
|
||||
log(" -overwrite\n");
|
||||
log(" overwrite existing modules with the same name\n");
|
||||
log("\n");
|
||||
log(" -ignore_miss_func\n");
|
||||
log(" ignore cells with missing function specification of outputs\n");
|
||||
|
@ -484,7 +488,8 @@ struct LibertyFrontend : public Frontend {
|
|||
virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design)
|
||||
{
|
||||
bool flag_lib = false;
|
||||
bool flag_ignore_redef = false;
|
||||
bool flag_nooverwrite = false;
|
||||
bool flag_overwrite = false;
|
||||
bool flag_ignore_miss_func = false;
|
||||
bool flag_ignore_miss_dir = false;
|
||||
bool flag_ignore_miss_data_latch = false;
|
||||
|
@ -499,8 +504,14 @@ struct LibertyFrontend : public Frontend {
|
|||
flag_lib = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-ignore_redef") {
|
||||
flag_ignore_redef = true;
|
||||
if (arg == "-ignore_redef" || arg == "-nooverwrite") {
|
||||
flag_nooverwrite = true;
|
||||
flag_overwrite = false;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-overwrite") {
|
||||
flag_nooverwrite = false;
|
||||
flag_overwrite = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-ignore_miss_func") {
|
||||
|
@ -537,9 +548,16 @@ struct LibertyFrontend : public Frontend {
|
|||
std::string cell_name = RTLIL::escape_id(cell->args.at(0));
|
||||
|
||||
if (design->has(cell_name)) {
|
||||
if (flag_ignore_redef)
|
||||
Module *existing_mod = design->module(cell_name);
|
||||
if (!flag_nooverwrite && !flag_overwrite && !existing_mod->get_bool_attribute("\\blackbox")) {
|
||||
log_error("Re-definition of of cell/module %s!\n", log_id(cell_name));
|
||||
} else if (flag_nooverwrite) {
|
||||
log("Ignoring re-definition of module %s.\n", log_id(cell_name));
|
||||
continue;
|
||||
log_error("Duplicate definition of cell/module %s.\n", RTLIL::unescape_id(cell_name).c_str());
|
||||
} else {
|
||||
log("Replacing existing%s module %s.\n", existing_mod->get_bool_attribute("\\blackbox") ? " blackbox" : "", log_id(cell_name));
|
||||
design->remove(existing_mod);
|
||||
}
|
||||
}
|
||||
|
||||
// log("Processing cell type %s.\n", RTLIL::unescape_id(cell_name).c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue