mirror of https://github.com/YosysHQ/yosys.git
abc9: cleanup
This commit is contained in:
parent
886c5c5883
commit
1cf974ff40
|
@ -249,7 +249,7 @@ struct abc9_output_filter
|
||||||
};
|
};
|
||||||
|
|
||||||
void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string script_file, std::string exe_file,
|
void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string script_file, std::string exe_file,
|
||||||
bool cleanup, vector<int> lut_costs, bool dff, std::string delay_target, std::string /*lutin_shared*/, bool fast_mode,
|
bool cleanup, vector<int> 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,
|
bool show_tempdir, std::string box_file, std::string lut_file,
|
||||||
std::string wire_delay, bool nomfs
|
std::string wire_delay, bool nomfs
|
||||||
)
|
)
|
||||||
|
@ -420,7 +420,7 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string scrip
|
||||||
|
|
||||||
dict<IdString, bool> abc9_box;
|
dict<IdString, bool> abc9_box;
|
||||||
vector<RTLIL::Cell*> boxes;
|
vector<RTLIL::Cell*> boxes;
|
||||||
for (auto cell : module->selected_cells()) {
|
for (auto cell : module->cells()) {
|
||||||
if (cell->type.in(ID($_AND_), ID($_NOT_), ID($__ABC9_FF_))) {
|
if (cell->type.in(ID($_AND_), ID($_NOT_), ID($__ABC9_FF_))) {
|
||||||
module->remove(cell);
|
module->remove(cell);
|
||||||
continue;
|
continue;
|
||||||
|
@ -431,7 +431,7 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string scrip
|
||||||
jt = abc9_box.insert(std::make_pair(cell->type, box_module && box_module->attributes.count(ID(abc9_box_id)))).first;
|
jt = abc9_box.insert(std::make_pair(cell->type, box_module && box_module->attributes.count(ID(abc9_box_id)))).first;
|
||||||
if (jt->second) {
|
if (jt->second) {
|
||||||
if (box_module->get_bool_attribute("\\abc9_flop")) {
|
if (box_module->get_bool_attribute("\\abc9_flop")) {
|
||||||
if (dff)
|
if (dff_mode)
|
||||||
boxes.emplace_back(cell);
|
boxes.emplace_back(cell);
|
||||||
else
|
else
|
||||||
box_module->set_bool_attribute("\\abc9_keep", false);
|
box_module->set_bool_attribute("\\abc9_keep", false);
|
||||||
|
@ -843,7 +843,7 @@ struct Abc9Pass : public Pass {
|
||||||
#endif
|
#endif
|
||||||
std::string script_file, clk_str, box_file, lut_file;
|
std::string script_file, clk_str, box_file, lut_file;
|
||||||
std::string delay_target, lutin_shared = "-S 1", wire_delay;
|
std::string delay_target, lutin_shared = "-S 1", wire_delay;
|
||||||
bool fast_mode = false, dff = false, cleanup = true;
|
bool fast_mode = false, dff_mode = false, cleanup = true;
|
||||||
bool show_tempdir = false;
|
bool show_tempdir = false;
|
||||||
bool nomfs = false;
|
bool nomfs = false;
|
||||||
vector<int> lut_costs;
|
vector<int> lut_costs;
|
||||||
|
@ -921,7 +921,7 @@ struct Abc9Pass : public Pass {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg == "-dff") {
|
if (arg == "-dff") {
|
||||||
dff = true;
|
dff_mode = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg == "-nocleanup") {
|
if (arg == "-nocleanup") {
|
||||||
|
@ -1010,21 +1010,22 @@ struct Abc9Pass : public Pass {
|
||||||
CellTypes ct(design);
|
CellTypes ct(design);
|
||||||
for (auto module : design->selected_modules())
|
for (auto module : design->selected_modules())
|
||||||
{
|
{
|
||||||
if (module->attributes.count(ID(abc9_box_id)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (module->processes.size() > 0) {
|
if (module->processes.size() > 0) {
|
||||||
log("Skipping module %s as it contains processes.\n", log_id(module));
|
log("Skipping module %s as it contains processes.\n", log_id(module));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
log_assert(!module->attributes.count(ID(abc9_box_id)));
|
||||||
|
|
||||||
|
if (!design->selected_whole_module(module))
|
||||||
|
log_cmd_error("Can't handle partially selected module %s!\n", log_id(module));
|
||||||
|
|
||||||
assign_map.set(module);
|
assign_map.set(module);
|
||||||
|
|
||||||
typedef SigSpec clkdomain_t;
|
typedef SigSpec clkdomain_t;
|
||||||
dict<clkdomain_t, int> clk_to_mergeability;
|
dict<clkdomain_t, int> clk_to_mergeability;
|
||||||
|
|
||||||
if (dff)
|
if (dff_mode)
|
||||||
for (auto cell : module->selected_cells()) {
|
for (auto cell : module->cells()) {
|
||||||
if (cell->type != "$__ABC9_FF_")
|
if (cell->type != "$__ABC9_FF_")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1050,7 +1051,7 @@ struct Abc9Pass : public Pass {
|
||||||
log_assert(r2.second);
|
log_assert(r2.second);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (auto cell : module->selected_cells()) {
|
for (auto cell : module->cells()) {
|
||||||
auto inst_module = design->module(cell->type);
|
auto inst_module = design->module(cell->type);
|
||||||
if (!inst_module || !inst_module->get_bool_attribute("\\abc9_flop"))
|
if (!inst_module || !inst_module->get_bool_attribute("\\abc9_flop"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1058,7 +1059,7 @@ struct Abc9Pass : public Pass {
|
||||||
}
|
}
|
||||||
|
|
||||||
design->selected_active_module = module->name.str();
|
design->selected_active_module = module->name.str();
|
||||||
abc9_module(design, module, script_file, exe_file, cleanup, lut_costs, dff,
|
abc9_module(design, module, script_file, exe_file, cleanup, lut_costs, dff_mode,
|
||||||
delay_target, lutin_shared, fast_mode, show_tempdir,
|
delay_target, lutin_shared, fast_mode, show_tempdir,
|
||||||
box_file, lut_file, wire_delay, nomfs);
|
box_file, lut_file, wire_delay, nomfs);
|
||||||
design->selected_active_module.clear();
|
design->selected_active_module.clear();
|
||||||
|
|
Loading…
Reference in New Issue