mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-15 13:28:59 +00:00
Bugfix in "abc -script" handling
This commit is contained in:
parent
9bca8ccd40
commit
541083cf32
|
@ -909,7 +909,7 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
||||||
if (ifs.fail())
|
if (ifs.fail())
|
||||||
log_error("Can't open ABC output file `%s'.\n", buffer.c_str());
|
log_error("Can't open ABC output file `%s'.\n", buffer.c_str());
|
||||||
|
|
||||||
bool builtin_lib = liberty_file.empty() && script_file.empty() && lut_costs.empty() && !sop_mode;
|
bool builtin_lib = liberty_file.empty();
|
||||||
RTLIL::Design *mapped_design = new RTLIL::Design;
|
RTLIL::Design *mapped_design = new RTLIL::Design;
|
||||||
parse_blif(mapped_design, ifs, builtin_lib ? "\\DFF" : "\\_dff_", false, sop_mode);
|
parse_blif(mapped_design, ifs, builtin_lib ? "\\DFF" : "\\_dff_", false, sop_mode);
|
||||||
|
|
||||||
|
@ -927,10 +927,10 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, int> cell_stats;
|
std::map<std::string, int> cell_stats;
|
||||||
|
for (auto c : mapped_mod->cells())
|
||||||
|
{
|
||||||
if (builtin_lib)
|
if (builtin_lib)
|
||||||
{
|
{
|
||||||
for (auto &it : mapped_mod->cells_) {
|
|
||||||
RTLIL::Cell *c = it.second;
|
|
||||||
cell_stats[RTLIL::unescape_id(c->type)]++;
|
cell_stats[RTLIL::unescape_id(c->type)]++;
|
||||||
if (c->type == "\\ZERO" || c->type == "\\ONE") {
|
if (c->type == "\\ZERO" || c->type == "\\ONE") {
|
||||||
RTLIL::SigSig conn;
|
RTLIL::SigSig conn;
|
||||||
|
@ -1069,15 +1069,10 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
||||||
design->select(module, cell);
|
design->select(module, cell);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
log_abort();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto &it : mapped_mod->cells_)
|
|
||||||
{
|
|
||||||
RTLIL::Cell *c = it.second;
|
|
||||||
cell_stats[RTLIL::unescape_id(c->type)]++;
|
cell_stats[RTLIL::unescape_id(c->type)]++;
|
||||||
|
|
||||||
if (c->type == "\\_const0_" || c->type == "\\_const1_") {
|
if (c->type == "\\_const0_" || c->type == "\\_const1_") {
|
||||||
RTLIL::SigSig conn;
|
RTLIL::SigSig conn;
|
||||||
conn.first = RTLIL::SigSpec(module->wires_[remap_name(c->connections().begin()->second.as_wire()->name)]);
|
conn.first = RTLIL::SigSpec(module->wires_[remap_name(c->connections().begin()->second.as_wire()->name)]);
|
||||||
|
@ -1085,6 +1080,7 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
||||||
module->connect(conn);
|
module->connect(conn);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->type == "\\_dff_") {
|
if (c->type == "\\_dff_") {
|
||||||
log_assert(clk_sig.size() == 1);
|
log_assert(clk_sig.size() == 1);
|
||||||
RTLIL::Cell *cell;
|
RTLIL::Cell *cell;
|
||||||
|
@ -1102,12 +1098,14 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
||||||
design->select(module, cell);
|
design->select(module, cell);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->type == "$lut" && GetSize(c->getPort("\\A")) == 1 && c->getParam("\\LUT").as_int() == 2) {
|
if (c->type == "$lut" && GetSize(c->getPort("\\A")) == 1 && c->getParam("\\LUT").as_int() == 2) {
|
||||||
SigSpec my_a = module->wires_[remap_name(c->getPort("\\A").as_wire()->name)];
|
SigSpec my_a = module->wires_[remap_name(c->getPort("\\A").as_wire()->name)];
|
||||||
SigSpec my_y = module->wires_[remap_name(c->getPort("\\Y").as_wire()->name)];
|
SigSpec my_y = module->wires_[remap_name(c->getPort("\\Y").as_wire()->name)];
|
||||||
module->connect(my_y, my_a);
|
module->connect(my_y, my_a);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLIL::Cell *cell = module->addCell(remap_name(c->name), c->type);
|
RTLIL::Cell *cell = module->addCell(remap_name(c->name), c->type);
|
||||||
if (markgroups) cell->attributes["\\abcgroup"] = map_autoidx;
|
if (markgroups) cell->attributes["\\abcgroup"] = map_autoidx;
|
||||||
cell->parameters = c->parameters;
|
cell->parameters = c->parameters;
|
||||||
|
@ -1123,7 +1121,6 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
||||||
}
|
}
|
||||||
design->select(module, cell);
|
design->select(module, cell);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (auto conn : mapped_mod->connections()) {
|
for (auto conn : mapped_mod->connections()) {
|
||||||
if (!conn.first.is_fully_const())
|
if (!conn.first.is_fully_const())
|
||||||
|
|
Loading…
Reference in a new issue