3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-22 07:05:51 +00:00

rtlil: add Module* back-pointer to RTLIL::Memory

This commit is contained in:
Emil J. Tywoniak 2026-06-05 13:49:50 +02:00
parent 9ed93e210b
commit e70eed3296
7 changed files with 17 additions and 3 deletions

View file

@ -3611,6 +3611,7 @@ RTLIL::Memory *RTLIL::Module::addMemory(RTLIL::IdString name)
{
RTLIL::Memory *mem = new RTLIL::Memory;
mem->name = std::move(name);
mem->module = this;
memories[mem->name] = mem;
return mem;
}
@ -3619,14 +3620,15 @@ RTLIL::Memory *RTLIL::Module::addMemory(RTLIL::IdString name, const RTLIL::Memor
{
RTLIL::Memory *mem = new RTLIL::Memory;
mem->name = std::move(name);
mem->module = this;
mem->width = other->width;
mem->start_offset = other->start_offset;
mem->size = other->size;
mem->attributes = other->attributes;
{
// Memory has no module backpointer of its own — we can't know its
// source pool from `other` alone. Drop src in the rare clone-of-
// memory path; addMemory(name) is the common one and starts fresh.
// Clone path drops src for now — caller responsible for migrating
// src across the design boundary if needed. addMemory(name) is the
// common case.
(void)other;
}
memories[mem->name] = mem;