cxxrtl: don't assert on non-constant $meminit inputs.
authorwhitequark <whitequark@whitequark.org>
Sun, 1 Nov 2020 15:25:55 +0000 (15:25 +0000)
committerwhitequark <whitequark@whitequark.org>
Sun, 1 Nov 2020 15:57:20 +0000 (15:57 +0000)
Fixes #2129.

backends/cxxrtl/cxxrtl_backend.cc

index da46711c1b5bc33d8e8d02e326a2f2540a7bd151..ac4c7826715a2b92c744db96192b9ad939446f7c 100644 (file)
@@ -22,6 +22,7 @@
 #include "kernel/sigtools.h"
 #include "kernel/utils.h"
 #include "kernel/celltypes.h"
+#include "kernel/mem.h"
 #include "kernel/log.h"
 
 USING_YOSYS_NAMESPACE
@@ -2347,8 +2348,9 @@ struct CxxrtlWorker {
                                        if (sync->type == RTLIL::STi)
                                                has_sync_init = true;
 
-                       for (auto cell : module->cells())
-                               if (cell->type == ID($mem))
+                       // The Mem constructor also checks for well-formedness of $meminit cells, if any.
+                       for (auto &mem : Mem::get_all_memories(module))
+                               if (mem.packed)
                                        has_packed_mem = true;
                }
        }