From 0768897fd963b2e59384a986dea31f2368d3f224 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Tue, 21 Jul 2026 14:00:05 +0200 Subject: [PATCH] memory_bram: intern generated blackbox names as public twines load_blackbox() created the module and its port wires with twines.add(Twine{...}), which interns a private twine, while load_blackboxes() checked for an existing module with twines.add(std::string{...}), which interns a public one. The two never matched, so the generated modules were unreachable under the name the emitted cells use for their type: write_rtlil showed the module as $priv@... against a $pub@... cell type. The blackboxes were therefore inert since 25e7118e4 introduced them. Cell::port_dir() kept falling back to PD_UNKNOWN for every BRAM cell, which is the thing that commit set out to fix, and `hierarchy -check` still had no module to find. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01MQU5XCqDYY8MbivGkNRrDo --- passes/memory/memory_bram.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/passes/memory/memory_bram.cc b/passes/memory/memory_bram.cc index b013b32e1..38457bf78 100644 --- a/passes/memory/memory_bram.cc +++ b/passes/memory/memory_bram.cc @@ -157,19 +157,19 @@ struct rules_t } log_debug("setting up %s\n", name); - Module* mod = design->addModule(design->twines.add(Twine{name.str()})); + Module* mod = design->addModule(design->twines.add(std::string{name.str()})); mod->set_bool_attribute(ID::blackbox); for (auto [name, width] : inputs) { log_debug("input %s width %d\n", name.c_str(), width); - mod->addWire(design->twines.add(Twine{name.str()}), width)->port_input = true; + mod->addWire(design->twines.add(std::string{name.str()}), width)->port_input = true; } for (auto [name, width] : outputs) { log_debug("output %s width %d\n", name.c_str(), width); - mod->addWire(design->twines.add(Twine{name.str()}), width)->port_output = true; + mod->addWire(design->twines.add(std::string{name.str()}), width)->port_output = true; } mod->fixup_ports();