diff options
author | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-07-12 20:04:59 +0200 |
---|---|---|
committer | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-07-13 15:59:11 +0200 |
commit | 8bf9cb407d929255ae985b33a537ac6d489553c5 (patch) | |
tree | 7279251ab076a7d0bf8fc24117bad5bb087caa5e /backends/cxxrtl | |
parent | 4379375d899b917d3f6ed00db64ab52c35f4f004 (diff) | |
download | yosys-8bf9cb407d929255ae985b33a537ac6d489553c5.tar.gz yosys-8bf9cb407d929255ae985b33a537ac6d489553c5.tar.bz2 yosys-8bf9cb407d929255ae985b33a537ac6d489553c5.zip |
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.
Diffstat (limited to 'backends/cxxrtl')
-rw-r--r-- | backends/cxxrtl/cxxrtl_backend.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/backends/cxxrtl/cxxrtl_backend.cc b/backends/cxxrtl/cxxrtl_backend.cc index ddb954073..70a3add5d 100644 --- a/backends/cxxrtl/cxxrtl_backend.cc +++ b/backends/cxxrtl/cxxrtl_backend.cc @@ -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) { |