3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-07 09:55:20 +00:00

cxxrtl: speed up commits on clang.

On Minerva SoC SRAM compiled with clang-11, this change cuts commit
time in half (!) and overall time by 20%. When compiled with gcc-10,
there is no difference.
This commit is contained in:
whitequark 2020-12-21 00:22:50 +00:00
parent 3d3ea5099d
commit 40ca9d038b

View file

@ -1702,19 +1702,19 @@ struct CxxrtlWorker {
continue; continue;
} }
if (!module->get_bool_attribute(ID(cxxrtl_blackbox)) || wire->port_id != 0) if (!module->get_bool_attribute(ID(cxxrtl_blackbox)) || wire->port_id != 0)
f << indent << "changed |= " << mangle(wire) << ".commit();\n"; f << indent << "if (" << mangle(wire) << ".commit()) changed = true;\n";
} }
if (!module->get_bool_attribute(ID(cxxrtl_blackbox))) { if (!module->get_bool_attribute(ID(cxxrtl_blackbox))) {
for (auto memory : module->memories) { for (auto memory : module->memories) {
if (!writable_memories[memory.second]) if (!writable_memories[memory.second])
continue; continue;
f << indent << "changed |= " << mangle(memory.second) << ".commit();\n"; f << indent << "if (" << mangle(memory.second) << ".commit()) changed = true;\n";
} }
for (auto cell : module->cells()) { for (auto cell : module->cells()) {
if (is_internal_cell(cell->type)) if (is_internal_cell(cell->type))
continue; continue;
const char *access = is_cxxrtl_blackbox_cell(cell) ? "->" : "."; const char *access = is_cxxrtl_blackbox_cell(cell) ? "->" : ".";
f << indent << "changed |= " << mangle(cell) << access << "commit();\n"; f << indent << "if (" << mangle(cell) << access << "commit()) changed = true;\n";
} }
} }
f << indent << "return changed;\n"; f << indent << "return changed;\n";