From cfd7edc6087eccfee228851dd03c27fe5588aae7 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 5 Jun 2026 16:45:50 +0200 Subject: [PATCH] Patch: route staged cell names through per-Patch dict --- kernel/unstable/patch.cc | 7 +++++-- kernel/unstable/patch.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/unstable/patch.cc b/kernel/unstable/patch.cc index 60f3744e3..bec4136bb 100644 --- a/kernel/unstable/patch.cc +++ b/kernel/unstable/patch.cc @@ -14,9 +14,9 @@ Cell* Patch::addCell(IdString name, IdString type) { cells_.push_back(std::make_unique(Cell::ConstructToken{})); Cell* cell = cells_.back().get(); - cell->name = name; cell->type = type; cell->module = nullptr; + staged_cell_names_[cell] = name; return cell; } @@ -55,8 +55,11 @@ Wire* Patch::commit_wire(std::unique_ptr wire) { Cell* Patch::commit_cell(std::unique_ptr cell) { Cell* raw = cell.release(); - mod->cells_[raw->name] = raw; + IdString name = staged_cell_names_.at(raw); + staged_cell_names_.erase(raw); + raw->name = name; raw->module = mod; + mod->cells_[name] = raw; raw->initIndex(); return raw; } diff --git a/kernel/unstable/patch.h b/kernel/unstable/patch.h index 3742387ee..8eebe2975 100644 --- a/kernel/unstable/patch.h +++ b/kernel/unstable/patch.h @@ -26,6 +26,7 @@ public: SigMap* map; vector> wires_ = {}; vector> cells_ = {}; + dict staged_cell_names_; void connect(const RTLIL::SigSig &conn); void connect(const RTLIL::SigSpec &lhs, const RTLIL::SigSpec &rhs);