From dac5adde12c585f5e0552f776ae0a5ab05e995c9 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 16 Apr 2020 12:46:07 -0700 Subject: [PATCH 1/2] design: -import to not count black/white-boxes as candidates for top --- passes/cmds/design.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/passes/cmds/design.cc b/passes/cmds/design.cc index cfe97067d..421defe0c 100644 --- a/passes/cmds/design.cc +++ b/passes/cmds/design.cc @@ -228,14 +228,20 @@ struct DesignPass : public Pass { } if (import_mode) { + std::vector candidates; for (auto module : copy_src_modules) { if (module->get_bool_attribute(ID::top)) { - copy_src_modules.clear(); - copy_src_modules.push_back(module); + candidates.clear(); + candidates.push_back(module); break; } + if (!module->get_blackbox_attribute()) + candidates.push_back(module); } + + if (GetSize(candidates) == 1) + copy_src_modules = std::move(candidates); } } From 9eace8f36032665394e582a60fc58be0a7c9303b Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 16 Apr 2020 12:48:40 -0700 Subject: [PATCH 2/2] design: add test --- tests/various/design.ys | 18 +++++++++++++----- tests/various/design1.ys | 9 +++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 tests/various/design1.ys diff --git a/tests/various/design.ys b/tests/various/design.ys index f13ad8171..a64430dc7 100644 --- a/tests/various/design.ys +++ b/tests/various/design.ys @@ -1,9 +1,17 @@ read_verilog <