Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions passes/techmap/abc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct AbcConfig
std::vector<std::string> liberty_files;
std::vector<std::string> genlib_files;
std::string constr_file;
std::string abc_liberty_args;
vector<int> lut_costs;
std::string delay_target;
std::string sop_inputs;
Expand Down Expand Up @@ -1030,14 +1031,21 @@ void AbcModuleState::prepare_module(RTLIL::Design *design, RTLIL::Module *module
run_abc.dont_use_args += stringf("-X \"%s\" ", dont_use_cell);
}

std::string merged_scl = convert_liberty_files_to_merged_scl(config.liberty_files, run_abc.dont_use_args, config.exe_file);
std::string merged_scl;
if (config.abc_liberty_args.empty()) {
merged_scl = convert_liberty_files_to_merged_scl(config.liberty_files, run_abc.dont_use_args, config.exe_file);
}
if (!merged_scl.empty()) {
run_abc.abc_script += stringf("read_scl \"%s\" ; ", merged_scl.c_str());
} else if(!config.liberty_files.empty()) {
log_warning("ABC: Merged scl conversion failed, using liberty format\n");
if (!config.abc_liberty_args.empty()) {
log("ABC: abc_liberty_args provided, using liberty format\n");
} else {
log_warning("ABC: Merged scl conversion failed, using liberty format\n");
}
bool first_lib = true;
for (std::string liberty_file : config.liberty_files) {
run_abc.abc_script += stringf("read_lib %s %s -w \"%s\" ; ", run_abc.dont_use_args, first_lib ? "" : "-m", liberty_file);
run_abc.abc_script += stringf("read_lib %s %s %s -w \"%s\" ; ", run_abc.dont_use_args, first_lib ? "" : "-m", config.abc_liberty_args, liberty_file);
first_lib = false;
}
}
Expand Down Expand Up @@ -2035,6 +2043,10 @@ struct AbcPass : public Pass {
log(" preserve naming by an equivalence check between the original and\n");
log(" post-ABC netlists (experimental).\n");
log("\n");
log(" -liberty_args <string>\n");
log(" when -liberty is used, also pass the specified arguments to ABC\n");
log(" command \"read_lib\". Example: -liberty_args \"-G 250\"\n");
log("\n");
log("When no target cell library is specified the Yosys standard cell library is\n");
log("loaded into ABC before the ABC script is executed.\n");
log("\n");
Expand Down Expand Up @@ -2217,6 +2229,14 @@ struct AbcPass : public Pass {
config.markgroups = true;
continue;
}
if (arg == "-liberty_args" && argidx+1 < args.size()) {
config.abc_liberty_args = args[++argidx];
if (!config.abc_liberty_args.empty()) {
if (config.abc_liberty_args[0] == '\"' && config.abc_liberty_args.back() == '\"')
config.abc_liberty_args = config.abc_liberty_args.substr(1, config.abc_liberty_args.size() - 2);
}
continue;
}
break;
}
extra_args(args, argidx, design);
Expand Down
Loading