mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-17 00:32:17 +00:00
Add abc9_ops -check, -prep_times, -write_box for required times
This commit is contained in:
parent
5e280a3b59
commit
b2259a9201
3 changed files with 256 additions and 75 deletions
|
@ -131,6 +131,7 @@ struct Abc9Pass : public ScriptPass
|
|||
|
||||
std::stringstream exe_cmd;
|
||||
bool dff_mode, cleanup;
|
||||
std::string box_file;
|
||||
|
||||
void clear_flags() YS_OVERRIDE
|
||||
{
|
||||
|
@ -138,6 +139,7 @@ struct Abc9Pass : public ScriptPass
|
|||
exe_cmd << "abc9_exe";
|
||||
dff_mode = false;
|
||||
cleanup = true;
|
||||
box_file.clear();
|
||||
}
|
||||
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
|
@ -154,7 +156,7 @@ struct Abc9Pass : public ScriptPass
|
|||
std::string arg = args[argidx];
|
||||
if ((arg == "-exe" || arg == "-script" || arg == "-D" ||
|
||||
/* arg == "-S" || */ arg == "-lut" || arg == "-luts" ||
|
||||
arg == "-box" || arg == "-W") &&
|
||||
/*arg == "-box" ||*/ arg == "-W") &&
|
||||
argidx+1 < args.size()) {
|
||||
exe_cmd << " " << arg << " " << args[++argidx];
|
||||
continue;
|
||||
|
@ -173,6 +175,10 @@ struct Abc9Pass : public ScriptPass
|
|||
cleanup = false;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-box" && argidx+1 < args.size()) {
|
||||
box_file = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
@ -185,11 +191,12 @@ struct Abc9Pass : public ScriptPass
|
|||
void script() YS_OVERRIDE
|
||||
{
|
||||
if (check_label("pre")) {
|
||||
run("abc9_ops -check");
|
||||
run("scc -set_attr abc9_scc_id {}");
|
||||
if (help_mode)
|
||||
run("abc9_ops -break_scc -prep_holes [-dff]", "(option for -dff)");
|
||||
run("abc9_ops -break_scc -prep_times -prep_holes [-dff]", "(option for -dff)");
|
||||
else
|
||||
run("abc9_ops -break_scc -prep_holes" + std::string(dff_mode ? " -dff" : ""), "(option for -dff)");
|
||||
run("abc9_ops -break_scc -prep_times -prep_holes" + std::string(dff_mode ? " -dff" : ""), "(option for -dff)");
|
||||
run("select -set abc9_holes A:abc9_holes");
|
||||
run("flatten -wb @abc9_holes");
|
||||
run("techmap @abc9_holes");
|
||||
|
@ -203,8 +210,9 @@ struct Abc9Pass : public ScriptPass
|
|||
if (check_label("map")) {
|
||||
if (help_mode) {
|
||||
run("foreach module in selection");
|
||||
run(" abc9_ops -write_box [(-box value)|(null)] <abc-temp-dir>/input.box");
|
||||
run(" write_xaiger -map <abc-temp-dir>/input.sym <abc-temp-dir>/input.xaig");
|
||||
run(" abc9_exe [options] -cwd <abc-temp-dir>");
|
||||
run(" abc9_exe [options] -cwd <abc-temp-dir> -box <abc-temp-dir>/input.box");
|
||||
run(" read_aiger -xaiger -wideports -module_name <module-name>$abc9 -map <abc-temp-dir>/input.sym <abc-temp-dir>/output.aig");
|
||||
run(" abc9_ops -reintegrate");
|
||||
}
|
||||
|
@ -229,6 +237,10 @@ struct Abc9Pass : public ScriptPass
|
|||
tempdir_name[0] = tempdir_name[4] = '_';
|
||||
tempdir_name = make_temp_dir(tempdir_name);
|
||||
|
||||
if (box_file.empty())
|
||||
run(stringf("abc9_ops -write_box (null) %s/input.box", tempdir_name.c_str()));
|
||||
else
|
||||
run(stringf("abc9_ops -write_box %s %s/input.box", box_file.c_str(), tempdir_name.c_str()));
|
||||
run(stringf("write_xaiger -map %s/input.sym %s/input.xaig", tempdir_name.c_str(), tempdir_name.c_str()));
|
||||
|
||||
int num_outputs = active_design->scratchpad_get_int("write_xaiger.num_outputs");
|
||||
|
@ -238,10 +250,8 @@ struct Abc9Pass : public ScriptPass
|
|||
active_design->scratchpad_get_int("write_xaiger.num_inputs"),
|
||||
num_outputs);
|
||||
if (num_outputs) {
|
||||
run(stringf("%s -cwd %s", exe_cmd.str().c_str(), tempdir_name.c_str()),
|
||||
"abc9_exe [options] -cwd <abc-temp-dir>");
|
||||
run(stringf("read_aiger -xaiger -wideports -module_name %s$abc9 -map %s/input.sym %s/output.aig", log_id(mod->name), tempdir_name.c_str(), tempdir_name.c_str()),
|
||||
"read_aiger -xaiger -wideports -module_name <module-name>$abc9 -map <abc-temp-dir>/input.sym <abc-temp-dir>/output.aig");
|
||||
run(stringf("%s -cwd %s -box %s/input.box", exe_cmd.str().c_str(), tempdir_name.c_str(), tempdir_name.c_str()));
|
||||
run(stringf("read_aiger -xaiger -wideports -module_name %s$abc9 -map %s/input.sym %s/output.aig", log_id(mod->name), tempdir_name.c_str(), tempdir_name.c_str()));
|
||||
run("abc9_ops -reintegrate");
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue