mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-23 20:58:55 +00:00
abc9: enable gzipped Liberty files, extend abc_prep
This commit is contained in:
parent
0885780460
commit
b7fe85df4d
4 changed files with 23 additions and 7 deletions
|
@ -2037,9 +2037,7 @@ struct AbcPass : public Pass {
|
||||||
enabled_gates.insert("MUX");
|
enabled_gates.insert("MUX");
|
||||||
// enabled_gates.insert("NMUX");
|
// enabled_gates.insert("NMUX");
|
||||||
}
|
}
|
||||||
std::string lib_tempdir_name = AbcPrep::tmp_base(cleanup) + "yosys-abc-lib-XXXXXX";
|
auto lib_tempdir_name = AbcPrep::make_tmp_extract_lib(liberty_files, cleanup);
|
||||||
lib_tempdir_name = make_temp_dir(lib_tempdir_name);
|
|
||||||
AbcPrep::lib_to_tmp(lib_tempdir_name, liberty_files);
|
|
||||||
|
|
||||||
for (auto mod : design->selected_modules())
|
for (auto mod : design->selected_modules())
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,6 +191,7 @@ struct Abc9Pass : public ScriptPass
|
||||||
bool lut_mode;
|
bool lut_mode;
|
||||||
int maxlut;
|
int maxlut;
|
||||||
std::string box_file;
|
std::string box_file;
|
||||||
|
std::vector<std::string> liberty_files;
|
||||||
|
|
||||||
void clear_flags() override
|
void clear_flags() override
|
||||||
{
|
{
|
||||||
|
@ -223,13 +224,17 @@ struct Abc9Pass : public ScriptPass
|
||||||
if ((arg == "-exe" || arg == "-script" || arg == "-D" ||
|
if ((arg == "-exe" || arg == "-script" || arg == "-D" ||
|
||||||
/*arg == "-S" ||*/ arg == "-lut" || arg == "-luts" ||
|
/*arg == "-S" ||*/ arg == "-lut" || arg == "-luts" ||
|
||||||
/*arg == "-box" ||*/ arg == "-W" || arg == "-genlib" ||
|
/*arg == "-box" ||*/ arg == "-W" || arg == "-genlib" ||
|
||||||
arg == "-constr" || arg == "-dont_use" || arg == "-liberty") &&
|
arg == "-constr" || arg == "-dont_use") &&
|
||||||
argidx+1 < args.size()) {
|
argidx+1 < args.size()) {
|
||||||
if (arg == "-lut" || arg == "-luts")
|
if (arg == "-lut" || arg == "-luts")
|
||||||
lut_mode = true;
|
lut_mode = true;
|
||||||
exe_cmd << " " << arg << " " << args[++argidx];
|
exe_cmd << " " << arg << " " << args[++argidx];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (arg == "-liberty") {
|
||||||
|
liberty_files.push_back(args[++argidx]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (arg == "-fast" || /* arg == "-dff" || */
|
if (arg == "-fast" || /* arg == "-dff" || */
|
||||||
/* arg == "-nocleanup" || */ arg == "-showtmp") {
|
/* arg == "-nocleanup" || */ arg == "-showtmp") {
|
||||||
exe_cmd << " " << arg;
|
exe_cmd << " " << arg;
|
||||||
|
@ -276,7 +281,10 @@ struct Abc9Pass : public ScriptPass
|
||||||
log_header(design, "Executing ABC9 pass.\n");
|
log_header(design, "Executing ABC9 pass.\n");
|
||||||
log_push();
|
log_push();
|
||||||
|
|
||||||
|
auto lib_tmpdir = AbcPrep::make_tmp_extract_lib(liberty_files, cleanup);
|
||||||
run_script(design, run_from, run_to);
|
run_script(design, run_from, run_to);
|
||||||
|
if (cleanup)
|
||||||
|
remove_directory(lib_tmpdir);
|
||||||
|
|
||||||
log_pop();
|
log_pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,9 +115,7 @@ struct AbcNewPass : public ScriptPass {
|
||||||
|
|
||||||
log_header(d, "Executing ABC_NEW pass.\n");
|
log_header(d, "Executing ABC_NEW pass.\n");
|
||||||
log_push();
|
log_push();
|
||||||
std::string lib_tmpdir = AbcPrep::tmp_base(cleanup) + "yosys-abc-lib-XXXXXX";
|
auto lib_tmpdir = AbcPrep::make_tmp_extract_lib(liberty_files, cleanup);
|
||||||
lib_tmpdir = make_temp_dir(lib_tmpdir);
|
|
||||||
AbcPrep::lib_to_tmp(lib_tmpdir, liberty_files);
|
|
||||||
run_script(d, run_from, run_to);
|
run_script(d, run_from, run_to);
|
||||||
if (cleanup)
|
if (cleanup)
|
||||||
remove_directory(lib_tmpdir);
|
remove_directory(lib_tmpdir);
|
||||||
|
|
|
@ -49,6 +49,18 @@ namespace AbcPrep {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::string make_tmp_extract_lib(std::vector<std::string>& liberty_files, bool cleanup)
|
||||||
|
{
|
||||||
|
// Compose the path
|
||||||
|
std::string lib_tmpdir = AbcPrep::tmp_base(cleanup) + "yosys-abc-lib-XXXXXX";
|
||||||
|
// Create the directory
|
||||||
|
lib_tmpdir = make_temp_dir(lib_tmpdir);
|
||||||
|
// Extract compressed liberty files to directory, rewrite liberty_files
|
||||||
|
AbcPrep::lib_to_tmp(lib_tmpdir, liberty_files);
|
||||||
|
// Caller responsible for cleanup
|
||||||
|
return lib_tmpdir;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ABC_PREP_H */
|
#endif /* ABC_PREP_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue