From 542a547c78d0d9d2ae470ac26baf59b81fa61e71 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 22 Nov 2025 15:57:34 +1300 Subject: [PATCH] celltypes: get_cell() helper Add `CellTypes::get_cell()` which takes a 'type' `IdString` and returns the corresponding `CellType` if it is in the `cell_types` dict, otherwise returns `nullptr`. Useful for getting a cell type by name and then checking its attributes. --- kernel/celltypes.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/celltypes.h b/kernel/celltypes.h index 8da1e5e25..3a22976d5 100644 --- a/kernel/celltypes.h +++ b/kernel/celltypes.h @@ -334,6 +334,15 @@ struct CellTypes cell_types.clear(); } + const CellType* get_cell(const RTLIL::IdString &type) const + { + auto it = cell_types.find(type); + if (it == cell_types.end()) + return nullptr; + else + return &(it->second); + } + bool cell_known(const RTLIL::IdString &type) const { return cell_types.count(type) != 0;