From e04e9d11458dd957ae3624905546c7cc55b72355 Mon Sep 17 00:00:00 2001 From: Cho Moon <141182150+precisionmoon@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:32:08 -0800 Subject: [PATCH] made module deletion optional in linkNetwork (#200) * made module deletion optional in linkNetwork Signed-off-by: Cho Moon * merged with master Signed-off-by: Cho Moon --------- Signed-off-by: Cho Moon --- include/sta/VerilogReader.hh | 3 ++- verilog/VerilogReader.cc | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/sta/VerilogReader.hh b/include/sta/VerilogReader.hh index 0108e0a4..2482dbe0 100644 --- a/include/sta/VerilogReader.hh +++ b/include/sta/VerilogReader.hh @@ -147,7 +147,8 @@ public: int to_index); VerilogModule *module(Cell *cell); Instance *linkNetwork(const char *top_cell_name, - bool make_black_boxes); + bool make_black_boxes, + bool delete_modules); const char *filename() const { return filename_.c_str(); } void incrLine(); Report *report() const { return report_; } diff --git a/verilog/VerilogReader.cc b/verilog/VerilogReader.cc index bc722459..dc80c1f5 100644 --- a/verilog/VerilogReader.cc +++ b/verilog/VerilogReader.cc @@ -146,7 +146,7 @@ VerilogReader::VerilogReader(NetworkReader *network) : { network->setLinkFunc([=] (const char *top_cell_name, bool make_black_boxes) -> Instance* { - return linkNetwork(top_cell_name, make_black_boxes); + return linkNetwork(top_cell_name, make_black_boxes, true); }); constant10_max_ = stdstrPrint("%llu", std::numeric_limits::max()); } @@ -1701,7 +1701,8 @@ private: Instance * VerilogReader::linkNetwork(const char *top_cell_name, - bool make_black_boxes) + bool make_black_boxes, + bool delete_modules) { if (library_) { Cell *top_cell = network_->findCell(library_, top_cell_name); @@ -1729,7 +1730,8 @@ VerilogReader::linkNetwork(const char *top_cell_name, } makeModuleInstBody(module, top_instance, &bindings, make_black_boxes); bool errors = reportLinkErrors(); - deleteModules(); + if (delete_modules) + deleteModules(); if (errors) { network_->deleteInstance(top_instance); return nullptr;