From 4c000d3aba7ab080a95ed0a4b3de5c756f69646b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 10 Apr 2024 15:20:01 +0200 Subject: [PATCH 01/12] Add new `bbox_derive` command for blackbox derivation --- passes/cmds/Makefile.inc | 1 + passes/cmds/bbox_derive.cc | 90 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 passes/cmds/bbox_derive.cc diff --git a/passes/cmds/Makefile.inc b/passes/cmds/Makefile.inc index d7e572462b0..b1c9c67f0d0 100644 --- a/passes/cmds/Makefile.inc +++ b/passes/cmds/Makefile.inc @@ -48,3 +48,4 @@ OBJS += passes/cmds/clean_zerowidth.o OBJS += passes/cmds/xprop.o OBJS += passes/cmds/dft_tag.o OBJS += passes/cmds/future.o +OBJS += passes/cmds/bbox_derive.o diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc new file mode 100644 index 00000000000..de0869cb1eb --- /dev/null +++ b/passes/cmds/bbox_derive.cc @@ -0,0 +1,90 @@ +/* + * yosys -- Yosys Open SYnthesis Suite + * + * Copyright (C) 2024 Martin PoviĊĦer + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +#include "kernel/yosys.h" + +USING_YOSYS_NAMESPACE +PRIVATE_NAMESPACE_BEGIN + +struct BboxDerivePass : Pass { + BboxDerivePass() : Pass("bbox_derive", "derive blackbox modules") {} + void help() override + { + // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| + log("\n"); + log(" bbox_derive [-base ] [-naming_attr ] [selection]\n"); + log("\n"); + } + void execute(std::vector args, RTLIL::Design *d) override + { + log_header(d, "Executing BBOX_DERIVE pass. (derive modules for blackboxes)\n"); + + size_t argidx; + IdString naming_attr; + IdString base_name; + for (argidx = 1; argidx < args.size(); argidx++) { + if (args[argidx] == "-naming_attr" && argidx + 1 < args.size()) + naming_attr = RTLIL::escape_id(args[++argidx]); + else if (args[argidx] == "-base" && argidx + 1 < args.size()) + base_name = RTLIL::escape_id(args[++argidx]); + else + break; + } + extra_args(args, argidx, d); + + Module *base_override; + if (!base_name.empty()) { + base_override = d->module(base_name); + if (!base_override) + log_cmd_error("Base module %s not found.\n", log_id(base_name)); + } + + dict, Module*> done; + + for (auto module : d->selected_modules()) { + for (auto cell : module->selected_cells()) { + Module *inst_module = d->module(cell->type); + if (!inst_module || !inst_module->get_blackbox_attribute()) + continue; + + if (cell->parameters.empty() || done.count(cell->parameters)) + continue; + + Module *base = inst_module; + if (base_override) + base = base_override; + + IdString derived_type = base->derive(d, cell->parameters); + Module *derived = d->module(derived_type); + + if (!naming_attr.empty() && derived->has_attribute(naming_attr)) { + IdString new_name = RTLIL::escape_id(derived->get_string_attribute(naming_attr)); + if (!new_name.isPublic()) + log_error("Derived module %s cannot be renamed to private name %s.\n", + log_id(derived), log_id(new_name)); + derived->attributes.erase(naming_attr); + d->rename(derived, new_name); + } + + done[cell->parameters] = derived; + } + } + } +} BboxDerivePass; + +PRIVATE_NAMESPACE_END From e8c58a55280192db2c35006734f42c7983cd9b81 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 3 May 2024 20:41:42 +0200 Subject: [PATCH 02/12] bbox_derive: fix unininitialized memory UB when run with no named args --- passes/cmds/bbox_derive.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index de0869cb1eb..758f793004a 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -47,7 +47,7 @@ struct BboxDerivePass : Pass { } extra_args(args, argidx, d); - Module *base_override; + Module *base_override = nullptr; if (!base_name.empty()) { base_override = d->module(base_name); if (!base_override) From 44b0fdc2bf8bac019641f4f5c5f9d29294fc0624 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 3 May 2024 20:43:01 +0200 Subject: [PATCH 03/12] bbox_derive: add assert and debug print --- passes/cmds/bbox_derive.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index 758f793004a..a35e9629058 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -71,6 +71,8 @@ struct BboxDerivePass : Pass { IdString derived_type = base->derive(d, cell->parameters); Module *derived = d->module(derived_type); + log_assert(derived && "Failed to derive module\n"); + log_debug("derived %s\n", derived_type.c_str()); if (!naming_attr.empty() && derived->has_attribute(naming_attr)) { IdString new_name = RTLIL::escape_id(derived->get_string_attribute(naming_attr)); From 88af059fad92631537c94b319ed2123224798351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 14:56:15 +0200 Subject: [PATCH 04/12] bbox_derive: Fix `done` base type confusion --- passes/cmds/bbox_derive.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index a35e9629058..e4fcb79637b 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -54,7 +54,7 @@ struct BboxDerivePass : Pass { log_cmd_error("Base module %s not found.\n", log_id(base_name)); } - dict, Module*> done; + dict>, Module*> done; for (auto module : d->selected_modules()) { for (auto cell : module->selected_cells()) { @@ -62,13 +62,15 @@ struct BboxDerivePass : Pass { if (!inst_module || !inst_module->get_blackbox_attribute()) continue; - if (cell->parameters.empty() || done.count(cell->parameters)) - continue; - Module *base = inst_module; if (base_override) base = base_override; + auto index = std::make_pair(base->name, cell->parameters); + + if (cell->parameters.empty() || done.count(index)) + continue; + IdString derived_type = base->derive(d, cell->parameters); Module *derived = d->module(derived_type); log_assert(derived && "Failed to derive module\n"); @@ -83,7 +85,7 @@ struct BboxDerivePass : Pass { d->rename(derived, new_name); } - done[cell->parameters] = derived; + done[index] = derived; } } } From 5c929a91c26920b50d4887e0058c895d1a91b280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 14:57:37 +0200 Subject: [PATCH 05/12] bbox_derive: Write help --- passes/cmds/bbox_derive.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index e4fcb79637b..90ce2ac4908 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -29,6 +29,28 @@ struct BboxDerivePass : Pass { log("\n"); log(" bbox_derive [-base ] [-naming_attr ] [selection]\n"); log("\n"); + log("As part of the assembly of the design hierarchy done by the 'hierarchy' command,\n"); + log("specializations of parametric modules are derived on demand: for each choice of\n"); + log("parameter values appearing in the design, a copy of the parametric module is\n"); + log("derived which is specialized to that choice.\n"); + log("\n"); + log("This derivation process ignores blackboxes and whiteboxes. To supplement, this\n"); + log("'bbox_derive' command can be used to request the derivation of modules based on\n"); + log("blackbox or whitebox instances appearing in the design, which is desirable in\n"); + log("certain use cases. Only the selected cells are considered as the instances that\n"); + log("steer the derivation process.\n"); + log("\n"); + log(" -base \n"); + log(" instead of deriving the module that directly corresponds to each blackbox\n"); + log(" instance, derive a specialization of (this option applies\n"); + log(" to all selected blackbox cells)\n"); + log("\n"); + log(" -naming_attr \n"); + log(" once a specialization is derived, use the value of the module attribute\n"); + log(" for a name which should be used for the derived module (this\n"); + log(" replaces the internal Yosys naming scheme in which the names of derived\n"); + log(" modules start with '$paramod$')\n"); + log("\n"); } void execute(std::vector args, RTLIL::Design *d) override { From 557db4ea46517658431f4674de41b887413307eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 14:57:49 +0200 Subject: [PATCH 06/12] bbox_drive: Add an incomplete test --- tests/various/bbox_derive.ys | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/various/bbox_derive.ys diff --git a/tests/various/bbox_derive.ys b/tests/various/bbox_derive.ys new file mode 100644 index 00000000000..26312fb53cf --- /dev/null +++ b/tests/various/bbox_derive.ys @@ -0,0 +1,37 @@ +read_verilog < Date: Tue, 21 May 2024 16:14:34 +0200 Subject: [PATCH 07/12] Rename `bbox_derive` to `box_derive` --- passes/cmds/Makefile.inc | 2 +- passes/cmds/{bbox_derive.cc => box_derive.cc} | 24 +++++++++---------- .../various/{bbox_derive.ys => box_derive.ys} | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) rename passes/cmds/{bbox_derive.cc => box_derive.cc} (84%) rename tests/various/{bbox_derive.ys => box_derive.ys} (94%) diff --git a/passes/cmds/Makefile.inc b/passes/cmds/Makefile.inc index b1c9c67f0d0..33e3ae1bc5a 100644 --- a/passes/cmds/Makefile.inc +++ b/passes/cmds/Makefile.inc @@ -48,4 +48,4 @@ OBJS += passes/cmds/clean_zerowidth.o OBJS += passes/cmds/xprop.o OBJS += passes/cmds/dft_tag.o OBJS += passes/cmds/future.o -OBJS += passes/cmds/bbox_derive.o +OBJS += passes/cmds/box_derive.o diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/box_derive.cc similarity index 84% rename from passes/cmds/bbox_derive.cc rename to passes/cmds/box_derive.cc index 90ce2ac4908..da698b04d37 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/box_derive.cc @@ -21,29 +21,29 @@ USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN -struct BboxDerivePass : Pass { - BboxDerivePass() : Pass("bbox_derive", "derive blackbox modules") {} +struct BoxDerivePass : Pass { + BoxDerivePass() : Pass("box_derive", "derive box modules") {} void help() override { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" bbox_derive [-base ] [-naming_attr ] [selection]\n"); + log(" box_derive [-base ] [-naming_attr ] [selection]\n"); log("\n"); log("As part of the assembly of the design hierarchy done by the 'hierarchy' command,\n"); log("specializations of parametric modules are derived on demand: for each choice of\n"); log("parameter values appearing in the design, a copy of the parametric module is\n"); log("derived which is specialized to that choice.\n"); log("\n"); - log("This derivation process ignores blackboxes and whiteboxes. To supplement, this\n"); - log("'bbox_derive' command can be used to request the derivation of modules based on\n"); - log("blackbox or whitebox instances appearing in the design, which is desirable in\n"); - log("certain use cases. Only the selected cells are considered as the instances that\n"); - log("steer the derivation process.\n"); + log("This derivation process ignores blackboxes and whiteboxes (boxes). To supplement,\n"); + log("this 'box_derive' command can be used to request the derivation of modules based\n"); + log("on box instances appearing in the design, which is desirable in certain use\n"); + log("cases. Only the selected cells are considered as the instances that steer the\n"); + log("derivation process.\n"); log("\n"); log(" -base \n"); - log(" instead of deriving the module that directly corresponds to each blackbox\n"); + log(" instead of deriving the module that directly corresponds to each box\n"); log(" instance, derive a specialization of (this option applies\n"); - log(" to all selected blackbox cells)\n"); + log(" to all selected box cells)\n"); log("\n"); log(" -naming_attr \n"); log(" once a specialization is derived, use the value of the module attribute\n"); @@ -54,7 +54,7 @@ struct BboxDerivePass : Pass { } void execute(std::vector args, RTLIL::Design *d) override { - log_header(d, "Executing BBOX_DERIVE pass. (derive modules for blackboxes)\n"); + log_header(d, "Executing BOX_DERIVE pass. (derive modules for boxes)\n"); size_t argidx; IdString naming_attr; @@ -111,6 +111,6 @@ struct BboxDerivePass : Pass { } } } -} BboxDerivePass; +} BoxDerivePass; PRIVATE_NAMESPACE_END diff --git a/tests/various/bbox_derive.ys b/tests/various/box_derive.ys similarity index 94% rename from tests/various/bbox_derive.ys rename to tests/various/box_derive.ys index 26312fb53cf..a76a79cdc1f 100644 --- a/tests/various/bbox_derive.ys +++ b/tests/various/box_derive.ys @@ -34,4 +34,4 @@ module top; endmodule EOF -bbox_derive -naming_attr final_name top +box_derive -naming_attr final_name top From adc1a01490850f294bb6229029799e91e3360d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 16:28:40 +0200 Subject: [PATCH 08/12] select: Refactor some flag validation --- passes/cmds/select.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 03d00816e1b..2b68a921d09 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1385,17 +1385,20 @@ struct SelectPass : public Pass { if (none_mode && args.size() != 2) log_cmd_error("Option -none can not be combined with any other options.\n"); - if (add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0) > 1) - log_cmd_error("Options -add, -del, -assert-none, -assert-any, assert-count, -assert-max or -assert-min can not be combined.\n"); + int common_flagset_tally = add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0); + const char *common_flagset = "-add, -del, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min"; - if ((list_mode || !write_file.empty() || count_mode) && (add_mode || del_mode || assert_none || assert_any || assert_count >= 0 || assert_max >= 0 || assert_min >= 0)) - log_cmd_error("Options -list, -write and -count can not be combined with -add, -del, -assert-none, -assert-any, assert-count, -assert-max, or -assert-min.\n"); + if (common_flagset_tally > 1) + log_cmd_error("Options %s can not be combined.\n", common_flagset); - if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || !unset_name.empty() || del_mode || assert_none || assert_any || assert_count >= 0 || assert_max >= 0 || assert_min >= 0)) - log_cmd_error("Option -set can not be combined with -list, -write, -count, -add, -del, -unset, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min.\n"); + if ((list_mode || !write_file.empty() || count_mode) && common_flagset_tally) + log_cmd_error("Options -list, -write and -count can not be combined with %s.\n", common_flagset); - if (!unset_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || !set_name.empty() || del_mode || assert_none || assert_any || assert_count >= 0 || assert_max >= 0 || assert_min >= 0)) - log_cmd_error("Option -unset can not be combined with -list, -write, -count, -add, -del, -set, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min.\n"); + if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || !unset_name.empty() || common_flagset_tally)) + log_cmd_error("Option -set can not be combined with -list, -write, -count, -unset, %s.\n", common_flagset); + + if (!unset_name.empty() && (list_mode || !write_file.empty() || count_mode || !set_name.empty() || common_flagset_tally)) + log_cmd_error("Option -unset can not be combined with -list, -write, -count, -set, %s.\n", common_flagset); if (work_stack.size() == 0 && got_module) { RTLIL::Selection sel; From 49906be776552b62ff2c8c954bd0c80fa215e0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 16:34:38 +0200 Subject: [PATCH 09/12] select: Introduce `-assert-mod-count` --- passes/cmds/select.cc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 2b68a921d09..2b7a37013cd 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1065,6 +1065,10 @@ struct SelectPass : public Pass { log(" selection is non-empty. i.e. produce an error if no object or module\n"); log(" matching the selection is found.\n"); log("\n"); + log(" -assert-mod-count N\n"); + log(" do not modify the current selection. instead assert that the given\n"); + log(" selection contains exactly N modules.\n"); + log("\n"); log(" -assert-count N\n"); log(" do not modify the current selection. instead assert that the given\n"); log(" selection contains exactly N objects.\n"); @@ -1263,6 +1267,7 @@ struct SelectPass : public Pass { bool got_module = false; bool assert_none = false; bool assert_any = false; + int assert_modcount = -1; int assert_count = -1; int assert_max = -1; int assert_min = -1; @@ -1291,6 +1296,10 @@ struct SelectPass : public Pass { assert_any = true; continue; } + if (arg == "-assert-mod-count" && argidx+1 < args.size()) { + assert_modcount = atoi(args[++argidx].c_str()); + continue; + } if (arg == "-assert-count" && argidx+1 < args.size()) { assert_count = atoi(args[++argidx].c_str()); continue; @@ -1345,7 +1354,8 @@ struct SelectPass : public Pass { } if (arg.size() > 0 && arg[0] == '-') log_cmd_error("Unknown option %s.\n", arg.c_str()); - bool disable_empty_warning = count_mode || assert_none || assert_any || (assert_count != -1) || (assert_max != -1) || (assert_min != -1); + bool disable_empty_warning = count_mode || assert_none || assert_any || (assert_modcount != -1) || + (assert_count != -1) || (assert_max != -1) || (assert_min != -1); select_stmt(design, arg, disable_empty_warning); sel_str += " " + arg; } @@ -1385,8 +1395,8 @@ struct SelectPass : public Pass { if (none_mode && args.size() != 2) log_cmd_error("Option -none can not be combined with any other options.\n"); - int common_flagset_tally = add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0); - const char *common_flagset = "-add, -del, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min"; + int common_flagset_tally = add_mode + del_mode + assert_none + assert_any + (assert_modcount >= 0) + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0); + const char *common_flagset = "-add, -del, -assert-none, -assert-any, -assert-mod-count, -assert-count, -assert-max, or -assert-min"; if (common_flagset_tally > 1) log_cmd_error("Options %s can not be combined.\n", common_flagset); @@ -1517,15 +1527,16 @@ struct SelectPass : public Pass { return; } - if (assert_count >= 0 || assert_max >= 0 || assert_min >= 0) + if (assert_modcount >= 0 || assert_count >= 0 || assert_max >= 0 || assert_min >= 0) { - int total_count = 0; + int module_count = 0, total_count = 0; if (work_stack.size() == 0) log_cmd_error("No selection to check.\n"); RTLIL::Selection *sel = &work_stack.back(); sel->optimize(design); for (auto mod : design->modules()) if (sel->selected_module(mod->name)) { + module_count++; for (auto wire : mod->wires()) if (sel->selected_member(mod->name, wire->name)) total_count++; @@ -1539,6 +1550,11 @@ struct SelectPass : public Pass { if (sel->selected_member(mod->name, it.first)) total_count++; } + if (assert_modcount >= 0 && assert_modcount != module_count) + { + log_error("Assertion failed: selection contains %d modules instead of the asserted %d:%s\n", + module_count, assert_modcount, sel_str.c_str()); + } if (assert_count >= 0 && assert_count != total_count) { std::string desc = describe_selection_for_assert(design, sel); From bff2443af842e41134bbd348dbd6885ab8206e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 16:34:49 +0200 Subject: [PATCH 10/12] box_derive: Finish the test --- tests/various/box_derive.ys | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/various/box_derive.ys b/tests/various/box_derive.ys index a76a79cdc1f..72db48e4fed 100644 --- a/tests/various/box_derive.ys +++ b/tests/various/box_derive.ys @@ -35,3 +35,13 @@ endmodule EOF box_derive -naming_attr final_name top +select -assert-mod-count 1 =bb1 +select -assert-mod-count 0 =bb2 +select -assert-mod-count 1 =bb3 + +select -assert-mod-count 1 =cc1 +select -assert-mod-count 0 =cc2 +select -assert-mod-count 0 =cc3 + +# the original aa, bb, cc, and 5 specializations +select -assert-mod-count 8 =A:whitebox From b230c95cc4ad14b7024db47f18169045b13230ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 29 May 2024 20:41:56 +0200 Subject: [PATCH 11/12] select: Adjust help --- passes/cmds/select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 2b7a37013cd..e455baf7c7f 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1067,7 +1067,7 @@ struct SelectPass : public Pass { log("\n"); log(" -assert-mod-count N\n"); log(" do not modify the current selection. instead assert that the given\n"); - log(" selection contains exactly N modules.\n"); + log(" selection contains exactly N modules (partially or fully selected).\n"); log("\n"); log(" -assert-count N\n"); log(" do not modify the current selection. instead assert that the given\n"); From 97fedff383bb253eca5ab9d6827057e1fae9dd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 29 May 2024 20:42:11 +0200 Subject: [PATCH 12/12] box_derive: Tune the test --- tests/various/box_derive.ys | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/various/box_derive.ys b/tests/various/box_derive.ys index 72db48e4fed..f02e133603d 100644 --- a/tests/various/box_derive.ys +++ b/tests/various/box_derive.ys @@ -35,6 +35,11 @@ endmodule EOF box_derive -naming_attr final_name top + +select -assert-mod-count 1 =aa1 +select -assert-mod-count 1 =aa2 +select -assert-mod-count 0 =aa3 + select -assert-mod-count 1 =bb1 select -assert-mod-count 0 =bb2 select -assert-mod-count 1 =bb3 @@ -43,5 +48,6 @@ select -assert-mod-count 1 =cc1 select -assert-mod-count 0 =cc2 select -assert-mod-count 0 =cc3 -# the original aa, bb, cc, and 5 specializations +# we are expecting the original aa, bb, cc modules +# and 5 specializations generated by box_derive select -assert-mod-count 8 =A:whitebox