3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00

kernel/mem: Add a coalesce_inits helper.

While this helper is already useful to squash sequential initializations
into one in cxxrtl, its main purpose is to squash overlapping masked memory
initializations (when they land) and avoid having to deal with them in
cxxrtl runtime.
This commit is contained in:
Marcelina Kościelnicka 2021-07-12 20:04:59 +02:00
parent 4379375d89
commit 8bf9cb407d
3 changed files with 84 additions and 1 deletions

View file

@ -1835,6 +1835,8 @@ struct CxxrtlWorker {
f << ",\n";
inc_indent();
for (auto &init : mem->inits) {
if (init.removed)
continue;
dump_attrs(&init);
int words = GetSize(init.data) / mem->width;
f << indent << "memory<" << mem->width << ">::init<" << words << "> { "
@ -2488,8 +2490,10 @@ struct CxxrtlWorker {
std::vector<Mem> &memories = mod_memories[module];
memories = Mem::get_all_memories(module);
for (auto &mem : memories)
for (auto &mem : memories) {
mem.narrow();
mem.coalesce_inits();
}
if (module->get_bool_attribute(ID(cxxrtl_blackbox))) {
for (auto port : module->ports) {