3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-03 21:01:23 +00:00

memory_libmap: fix MapWorker memory allocation

This commit is contained in:
Emil J. Tywoniak 2025-04-14 12:41:14 +02:00
parent 0c689091e2
commit 872a197e94

View file

@ -2232,11 +2232,11 @@ struct MemoryLibMapPass : public Pass {
if (module->has_processes_warn()) if (module->has_processes_warn())
continue; continue;
MapWorker worker(module); auto worker = std::make_unique<MapWorker>(module);
auto mems = Mem::get_selected_memories(module); auto mems = Mem::get_selected_memories(module);
for (auto &mem : mems) for (auto &mem : mems)
{ {
MemMapping map(worker, mem, lib, opts); MemMapping map(*worker, mem, lib, opts);
int idx = -1; int idx = -1;
int best = map.logic_cost; int best = map.logic_cost;
if (!map.logic_ok) { if (!map.logic_ok) {
@ -2259,7 +2259,7 @@ struct MemoryLibMapPass : public Pass {
} else { } else {
map.emit(map.cfgs[idx]); map.emit(map.cfgs[idx]);
// Rebuild indices after modifying module // Rebuild indices after modifying module
worker = MapWorker(module); worker = std::make_unique<MapWorker>(module);
} }
} }
} }