diff --git a/passes/techmap/abc9_exe.cc b/passes/techmap/abc9_exe.cc index 651a8375c..dcc507fca 100644 --- a/passes/techmap/abc9_exe.cc +++ b/passes/techmap/abc9_exe.cc @@ -168,7 +168,7 @@ void abc9_module(RTLIL::Design *design, std::string script_file, std::string exe vector lut_costs, bool dff_mode, std::string delay_target, std::string /*lutin_shared*/, bool fast_mode, bool show_tempdir, std::string box_file, std::string lut_file, std::vector liberty_files, std::string wire_delay, std::string tempdir_name, - std::string constr_file, std::vector dont_use_cells) + std::string constr_file, std::vector dont_use_cells, std::vector genlib_files) { std::string abc9_script; @@ -186,6 +186,10 @@ void abc9_module(RTLIL::Design *design, std::string script_file, std::string exe } if (!constr_file.empty()) abc9_script += stringf("read_constr -v \"%s\"; ", constr_file.c_str()); + } else if (!genlib_files.empty()) { + for (std::string genlib_file : genlib_files) { + abc9_script += stringf("read_genlib \"%s\"; ", genlib_file.c_str()); + } } log_assert(!box_file.empty()); @@ -384,9 +388,14 @@ struct Abc9ExePass : public Pass { log(" read the given Liberty file as a description of the target cell library.\n"); log(" this option can be used multiple times.\n"); log("\n"); + log(" -genlib \n"); + log(" read the given genlib file as a description of the target cell library.\n"); + log(" this option can be used multiple times.\n"); + log("\n"); log(" -dont_use \n"); log(" avoid usage of the technology cell when mapping the design.\n"); - log(" this option can be used multiple times.\n"); + log(" this option can be used multiple times. only supported with Liberty\n"); + log(" cell libraries.\n"); log("\n"); log(" -D \n"); log(" set delay target. the string {D} in the default scripts above is\n"); @@ -441,7 +450,7 @@ struct Abc9ExePass : public Pass { std::string exe_file = yosys_abc_executable; std::string script_file, clk_str, box_file, lut_file, constr_file; - std::vector liberty_files, dont_use_cells; + std::vector liberty_files, genlib_files, dont_use_cells; std::string delay_target, lutin_shared = "-S 1", wire_delay; std::string tempdir_name; bool fast_mode = false, dff_mode = false; @@ -530,9 +539,15 @@ struct Abc9ExePass : public Pass { continue; } if (arg == "-liberty" && argidx+1 < args.size()) { + rewrite_filename(args[argidx+1]); liberty_files.push_back(args[++argidx]); continue; } + if (arg == "-genlib" && argidx+1 < args.size()) { + rewrite_filename(args[argidx+1]); + genlib_files.push_back(args[++argidx]); + continue; + } if (arg == "-dont_use" && argidx+1 < args.size()) { dont_use_cells.push_back(args[++argidx]); continue; @@ -601,11 +616,13 @@ struct Abc9ExePass : public Pass { if (tempdir_name.empty()) log_cmd_error("abc9_exe '-cwd' option is mandatory.\n"); + if (!genlib_files.empty() && !dont_use_cells.empty()) + log_cmd_error("abc9_exe '-genlib' is incompatible with '-dont_use'.\n"); abc9_module(design, script_file, exe_file, lut_costs, dff_mode, delay_target, lutin_shared, fast_mode, show_tempdir, box_file, lut_file, liberty_files, wire_delay, tempdir_name, - constr_file, dont_use_cells); + constr_file, dont_use_cells, genlib_files); } } Abc9ExePass; diff --git a/passes/techmap/abc_new.cc b/passes/techmap/abc_new.cc index dfa2e2f71..00bd23f86 100644 --- a/passes/techmap/abc_new.cc +++ b/passes/techmap/abc_new.cc @@ -68,6 +68,7 @@ struct AbcNewPass : public ScriptPass { log(" -constr \n"); log(" -dont_use \n"); log(" -liberty \n"); + log(" -genlib \n"); log(" these options are passed on to the 'abc9_exe' command which invokes\n"); log(" the ABC tool on individual modules of the design. please see\n"); log(" 'help abc9_exe' for more details\n"); @@ -90,7 +91,7 @@ struct AbcNewPass : public ScriptPass { if (args[argidx] == "-exe" || args[argidx] == "-script" || args[argidx] == "-D" || args[argidx] == "-constr" || args[argidx] == "-dont_use" || - args[argidx] == "-liberty") { + args[argidx] == "-liberty" || args[argidx] == "-genlib") { abc_exe_options += " " + args[argidx] + " " + args[argidx + 1]; argidx++; } else if (args[argidx] == "-run" && argidx + 1 < args.size()) {