From 7db8bc84aae6e7329029887b01ee9454af70c4cf Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 12 Nov 2025 18:37:09 -0500 Subject: [PATCH] Tests: Add more 'config' unsupported tests (#5891 partial) --- test_regress/t/t_config_hier.out | 85 +++++++++++++++++ test_regress/t/t_config_hier.py | 18 ++++ test_regress/t/t_config_hier.v | 63 ++++++++++++ test_regress/t/t_config_param.out | 36 +++---- test_regress/t/t_config_param.v | 28 +++--- test_regress/t/t_config_rules.out | 79 ++++++++++++++++ test_regress/t/t_config_rules.py | 27 ++++++ test_regress/t/t_config_rules.v | 50 ++++++++++ test_regress/t/t_config_rules_sub.v | 38 ++++++++ test_regress/t/t_config_top.out | 22 +++++ test_regress/t/t_config_top.py | 16 ++++ test_regress/t/t_config_top.v | 31 ++++++ test_regress/t/t_config_top2.out | 13 +++ test_regress/t/t_config_top2.py | 16 ++++ test_regress/t/t_config_top2.v | 23 +++++ test_regress/t/t_config_unsup.out | 142 ++++++++++++++-------------- test_regress/t/t_config_unsup.v | 66 ++++++------- test_regress/t/t_config_work.v | 7 +- 18 files changed, 622 insertions(+), 138 deletions(-) create mode 100644 test_regress/t/t_config_hier.out create mode 100755 test_regress/t/t_config_hier.py create mode 100644 test_regress/t/t_config_hier.v create mode 100644 test_regress/t/t_config_rules.out create mode 100755 test_regress/t/t_config_rules.py create mode 100644 test_regress/t/t_config_rules.v create mode 100644 test_regress/t/t_config_rules_sub.v create mode 100644 test_regress/t/t_config_top.out create mode 100755 test_regress/t/t_config_top.py create mode 100644 test_regress/t/t_config_top.v create mode 100644 test_regress/t/t_config_top2.out create mode 100755 test_regress/t/t_config_top2.py create mode 100644 test_regress/t/t_config_top2.v diff --git a/test_regress/t/t_config_hier.out b/test_regress/t/t_config_hier.out new file mode 100644 index 000000000..4596408ce --- /dev/null +++ b/test_regress/t/t_config_hier.out @@ -0,0 +1,85 @@ +%Error-UNSUPPORTED: t/t_config_hier.v:34:1: Unsupported: config + 34 | config cfg21; + | ^~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error-UNSUPPORTED: t/t_config_hier.v:35:10: Unsupported: config cell + 35 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_hier.v:36:3: Unsupported: config rule + 36 | instance t.u_1 use work.cfg2 :config; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:36:18: Unsupported: config use + 36 | instance t.u_1 use work.cfg2 :config; + | ^~~ +%Error-UNSUPPORTED: t/t_config_hier.v:39:1: Unsupported: config + 39 | config cfg22; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:40:10: Unsupported: config cell + 40 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_hier.v:41:3: Unsupported: config rule + 41 | instance t.u_1 use cfg2 :config; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:41:18: Unsupported: config use + 41 | instance t.u_1 use cfg2 :config; + | ^~~ +%Error-UNSUPPORTED: t/t_config_hier.v:44:1: Unsupported: config + 44 | config cfg31; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:45:10: Unsupported: config cell + 45 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_hier.v:46:3: Unsupported: config rule + 46 | cell work.m1 use work.cfg2 :config; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:46:8: Unsupported: config cell + 46 | cell work.m1 use work.cfg2 :config; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:46:16: Unsupported: config use + 46 | cell work.m1 use work.cfg2 :config; + | ^~~ +%Error-UNSUPPORTED: t/t_config_hier.v:49:1: Unsupported: config + 49 | config cfg32; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:50:10: Unsupported: config cell + 50 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_hier.v:51:3: Unsupported: config rule + 51 | cell m1 use cfg2 :config; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:51:8: Unsupported: config cell + 51 | cell m1 use cfg2 :config; + | ^~ +%Error-UNSUPPORTED: t/t_config_hier.v:51:11: Unsupported: config use + 51 | cell m1 use cfg2 :config; + | ^~~ +%Error-UNSUPPORTED: t/t_config_hier.v:54:1: Unsupported: config + 54 | config cfg41; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:55:10: Unsupported: config cell + 55 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_hier.v:56:3: Unsupported: config rule + 56 | cell work.m1 use work.cfg2; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:56:8: Unsupported: config cell + 56 | cell work.m1 use work.cfg2; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:56:16: Unsupported: config use + 56 | cell work.m1 use work.cfg2; + | ^~~ +%Error-UNSUPPORTED: t/t_config_hier.v:60:1: Unsupported: config + 60 | config cfg2; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:61:10: Unsupported: config cell + 61 | design c2_b; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:62:3: Unsupported: config rule + 62 | instance u_bb use work.c2_bb; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_hier.v:62:17: Unsupported: config use + 62 | instance u_bb use work.c2_bb; + | ^~~ +%Error: Specified --top-module 'cfg21' was not found in design. + ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. +%Error: Exiting due to diff --git a/test_regress/t/t_config_hier.py b/test_regress/t/t_config_hier.py new file mode 100755 index 000000000..5a6daa51c --- /dev/null +++ b/test_regress/t/t_config_hier.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2025 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('linter') + +test.lint(verilator_flags2=["--lint-only", "--top cfg21"], + fails=test.vlt_all, + expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_config_hier.v b/test_regress/t/t_config_hier.v new file mode 100644 index 000000000..c8b8838fd --- /dev/null +++ b/test_regress/t/t_config_hier.v @@ -0,0 +1,63 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2025 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +// Test several ways of using config to specify different hierarchies When done, +// have a .py file using --work to select each config, and have a .out golden +// match file to make sure get expected results. + +module m1; + initial $stop; +endmodule + +module c2_bb; + initial $display("c2_bb %%m=%m %%l=%l"); +endmodule + +module c2_b; + + bb u_bb(); + + initial $display("c2_b %%m=%m %%l=%l"); +endmodule + +module t; + + m1 u_1(); + + final $write("*-* All Finished *-*\n"); + +endmodule + +config cfg21; + design t; + instance t.u_1 use work.cfg2 :config; +endconfig + +config cfg22; + design t; + instance t.u_1 use cfg2 :config; +endconfig + +config cfg31; + design t; + cell work.m1 use work.cfg2 :config; +endconfig + +config cfg32; + design t; + cell m1 use cfg2 :config; +endconfig + +config cfg41; + design t; + cell work.m1 use work.cfg2; // :config; implied as no conflict +endconfig + +// Base usage +config cfg2; + design c2_b; + instance u_bb use work.c2_bb; +endconfig diff --git a/test_regress/t/t_config_param.out b/test_regress/t/t_config_param.out index 8c756c7aa..9fce8e16d 100644 --- a/test_regress/t/t_config_param.out +++ b/test_regress/t/t_config_param.out @@ -1,20 +1,20 @@ -%Error-UNSUPPORTED: t/t_config_param.v:24:4: Unsupported: config localparam declaration - 24 | localparam P1 = "cfg.p1"; - | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_config_param.v:24:3: Unsupported: config localparam declaration + 24 | localparam P1 = "cfg.p1"; + | ^~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error-UNSUPPORTED: t/t_config_param.v:25:4: Unsupported: config localparam declaration - 25 | localparam P2 = "cfg.p2"; - | ^~~~~~~~~~ -%Error-UNSUPPORTED: t/t_config_param.v:27:26: Unsupported: 'config use' parameter assignment - 27 | instance t.u_1a use #(.P1(), .P2("override.u_a.p2")); - | ^ -%Error-UNSUPPORTED: t/t_config_param.v:27:33: Unsupported: 'config use' parameter assignment - 27 | instance t.u_1a use #(.P1(), .P2("override.u_a.p2")); - | ^ -%Error-UNSUPPORTED: t/t_config_param.v:29:26: Unsupported: 'config use' parameter assignment - 29 | instance t.u_1c use #(.P1(P1), .P2(P2)); - | ^ -%Error-UNSUPPORTED: t/t_config_param.v:29:35: Unsupported: 'config use' parameter assignment - 29 | instance t.u_1c use #(.P1(P1), .P2(P2)); - | ^ +%Error-UNSUPPORTED: t/t_config_param.v:25:3: Unsupported: config localparam declaration + 25 | localparam P2 = "cfg.p2"; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_config_param.v:29:25: Unsupported: 'config use' parameter assignment + 29 | instance t.u_1a use #(.P1(), .P2("override.u_a.p2")); + | ^ +%Error-UNSUPPORTED: t/t_config_param.v:29:32: Unsupported: 'config use' parameter assignment + 29 | instance t.u_1a use #(.P1(), .P2("override.u_a.p2")); + | ^ +%Error-UNSUPPORTED: t/t_config_param.v:31:25: Unsupported: 'config use' parameter assignment + 31 | instance t.u_1c use #(.P1(P1), .P2(P2)); + | ^ +%Error-UNSUPPORTED: t/t_config_param.v:31:34: Unsupported: 'config use' parameter assignment + 31 | instance t.u_1c use #(.P1(P1), .P2(P2)); + | ^ %Error: Exiting due to diff --git a/test_regress/t/t_config_param.v b/test_regress/t/t_config_param.v index c0dc43af9..398a1486a 100644 --- a/test_regress/t/t_config_param.v +++ b/test_regress/t/t_config_param.v @@ -5,26 +5,28 @@ // SPDX-License-Identifier: CC0-1.0 module m1; - parameter string P1 = "p1.unchanged"; - parameter string P2 = "p2.unchanged"; - initial $display("m1 %%m=%m %%l=%l P1=%s P2=%s", P1, P2); + parameter string P1 = "p1.unchanged"; + parameter string P2 = "p2.unchanged"; + initial $display("m1 %%m=%m %%l=%l P1=%s P2=%s", P1, P2); endmodule module t; - m1 u_1a(); - m1 u_1b(); - m1 u_1c(); + m1 u_1a(); + m1 u_1b(); + m1 u_1c(); - final $write("*-* All Finished *-*\n"); + final $write("*-* All Finished *-*\n"); endmodule config cfg1; - localparam P1 = "cfg.p1"; - localparam P2 = "cfg.p2"; - design t; - instance t.u_1a use #(.P1(), .P2("override.u_a.p2")); - instance t.u_1b use #(); // All parameters back to default - instance t.u_1c use #(.P1(P1), .P2(P2)); + localparam P1 = "cfg.p1"; + localparam P2 = "cfg.p2"; + design t; + // Test that parameters work in 'use' statements + // Check a .out golden file against above display statements + instance t.u_1a use #(.P1(), .P2("override.u_a.p2")); + instance t.u_1b use #(); // All parameters back to default + instance t.u_1c use #(.P1(P1), .P2(P2)); endconfig diff --git a/test_regress/t/t_config_rules.out b/test_regress/t/t_config_rules.out new file mode 100644 index 000000000..ca089b184 --- /dev/null +++ b/test_regress/t/t_config_rules.out @@ -0,0 +1,79 @@ +%Error-UNSUPPORTED: t/t_config_rules.v:24:1: Unsupported: config + 24 | config cfg; + | ^~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error-UNSUPPORTED: t/t_config_rules.v:25:10: Unsupported: config cell + 25 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_rules.v:28:3: Unsupported: config rule + 28 | default liblist; + | ^~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:29:3: Unsupported: config rule + 29 | default liblist liba libb; + | ^~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:33:3: Unsupported: config rule + 33 | instance t.m20 liblist; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:34:3: Unsupported: config rule + 34 | instance t.m21 liblist libc; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:35:3: Unsupported: config rule + 35 | instance t.m22 liblist libc libd; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:36:3: Unsupported: config rule + 36 | instance t.m23 liblist libc libd; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:37:3: Unsupported: config rule + 37 | instance t.m24 liblist libc libd; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:40:3: Unsupported: config rule + 40 | instance t.m30 use cell_identifier; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:40:18: Unsupported: config use + 40 | instance t.m30 use cell_identifier; + | ^~~ +%Error-UNSUPPORTED: t/t_config_rules.v:41:3: Unsupported: config rule + 41 | instance t.m31 use lib_id.cell_id; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:41:18: Unsupported: config use + 41 | instance t.m31 use lib_id.cell_id; + | ^~~ +%Error-UNSUPPORTED: t/t_config_rules.v:42:3: Unsupported: config rule + 42 | instance t.m32 use #(); + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:42:18: Unsupported: config use + 42 | instance t.m32 use #(); + | ^~~ +%Error-UNSUPPORTED: t/t_config_rules.v:45:3: Unsupported: config rule + 45 | cell m40 liblist libc libd; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:45:8: Unsupported: config cell + 45 | cell m40 liblist libc libd; + | ^~~ +%Error-UNSUPPORTED: t/t_config_rules.v:46:3: Unsupported: config rule + 46 | cell work.m41 liblist libc libd; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:46:8: Unsupported: config cell + 46 | cell work.m41 liblist libc libd; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:47:3: Unsupported: config rule + 47 | cell m42 use m42alt; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:47:8: Unsupported: config cell + 47 | cell m42 use m42alt; + | ^~~ +%Error-UNSUPPORTED: t/t_config_rules.v:47:12: Unsupported: config use + 47 | cell m42 use m42alt; + | ^~~ +%Error-UNSUPPORTED: t/t_config_rules.v:48:3: Unsupported: config rule + 48 | cell work.m43 use work.m43alt; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:48:8: Unsupported: config cell + 48 | cell work.m43 use work.m43alt; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_rules.v:48:17: Unsupported: config use + 48 | cell work.m43 use work.m43alt; + | ^~~ +%Error: Specified --top-module 'cfg' was not found in design. + ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. +%Error: Exiting due to diff --git a/test_regress/t/t_config_rules.py b/test_regress/t/t_config_rules.py new file mode 100755 index 000000000..b3f6cdf69 --- /dev/null +++ b/test_regress/t/t_config_rules.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2025 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.compile(verilator_flags2=[ + "--binary", "--top cfg", "--work liba t/t_config_rules_sub.v", + "--work libb t/t_config_rules_sub.v", "--work libc t/t_config_rules_sub.v", + "--work libd t/t_config_rules_sub.v" +], + fails=True, + expect_filename=test.golden_filename) + +#test.execute() + +# Sort so that 'initial' scheduling order is not relevant +#test.files_identical_sorted(test.run_log_filename, test.golden_filename, is_logfile=True) + +test.passes() diff --git a/test_regress/t/t_config_rules.v b/test_regress/t/t_config_rules.v new file mode 100644 index 000000000..38f47a1ce --- /dev/null +++ b/test_regress/t/t_config_rules.v @@ -0,0 +1,50 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2025 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +module t; + m10 u_10(); + m20 u_20(); + m21 u_21(); + m22 u_22(); + m23 u_23(); + m24 u_24(); + m30 u_30(); + m31 u_31(); + m32 u_32(); + m40 u_40(); + m41 u_41(); + m42 u_42(); + m43 u_43(); + final $write("*-* All Finished *-*\n"); +endmodule + +config cfg; + design t; + + // Test uses m10 + default liblist; // Ignored + default liblist liba libb; + + // Test uses m20-29 + // TODO test taht default libraries also searched (compatibility) + instance t.m20 liblist; // Use parent's cell library + instance t.m21 liblist libc; + instance t.m22 liblist libc libd; // m22 in libc + instance t.m23 liblist libc libd; // m23 in libd + instance t.m24 liblist libc libd; // m24 in default (libb) + + // Test uses m30-39 + instance t.m30 use cell_identifier; + instance t.m31 use lib_id.cell_id; + instance t.m32 use #(); + + // Test uses m40-49 + cell m40 liblist libc libd; + cell work.m41 liblist libc libd; + cell m42 use m42alt; + cell work.m43 use work.m43alt; + +endconfig diff --git a/test_regress/t/t_config_rules_sub.v b/test_regress/t/t_config_rules_sub.v new file mode 100644 index 000000000..5d8c7cbe7 --- /dev/null +++ b/test_regress/t/t_config_rules_sub.v @@ -0,0 +1,38 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2025 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +`define STRINGIFY(x) `"x`" + +// Checks that descendants pick up the proper library (IEEE 1800-2023 33.4.1.5) +module sub; + class C; + static task info; + $display("%s.C %%m=%m %%l=%l", `STRINGIFY(m)); + endtask + endclass + initial $display("%s %%m=%m %%l=%l", `STRINGIFY(m)); + initial C::info(); +endmodule + +`define DECL_MODULE(m) \ + module m; \ + sub sub(); \ + initial $display("%s %%m=%m %%l=%l", `STRINGIFY(m)); \ + endmodule + +`DECL_MODULE(m10) +`DECL_MODULE(m20) +`DECL_MODULE(m21) +`DECL_MODULE(m22) +`DECL_MODULE(m23) +`DECL_MODULE(m24) +`DECL_MODULE(m30) +`DECL_MODULE(m31) +`DECL_MODULE(m32) +`DECL_MODULE(m40) +`DECL_MODULE(m41) +`DECL_MODULE(m42) +`DECL_MODULE(m43) diff --git a/test_regress/t/t_config_top.out b/test_regress/t/t_config_top.out new file mode 100644 index 000000000..0692b6a52 --- /dev/null +++ b/test_regress/t/t_config_top.out @@ -0,0 +1,22 @@ +%Error-UNSUPPORTED: t/t_config_top.v:20:1: Unsupported: config + 20 | config cfg1; + | ^~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error-UNSUPPORTED: t/t_config_top.v:21:10: Unsupported: config cell + 21 | design m1; + | ^~ +%Error-UNSUPPORTED: t/t_config_top.v:25:1: Unsupported: config + 25 | config cfg2; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_top.v:26:10: Unsupported: config cell + 26 | design m2; + | ^~ +%Error-UNSUPPORTED: t/t_config_top.v:29:1: Unsupported: config + 29 | config cfg3; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_config_top.v:30:10: Unsupported: config cell + 30 | design work.m3; + | ^~~~ +%Error: Specified --top-module 'cfg2' was not found in design. + ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. +%Error: Exiting due to diff --git a/test_regress/t/t_config_top.py b/test_regress/t/t_config_top.py new file mode 100755 index 000000000..f3b5677d5 --- /dev/null +++ b/test_regress/t/t_config_top.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2025 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.lint(verilator_flags2=["--top cfg2"], fails=True, expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_config_top.v b/test_regress/t/t_config_top.v new file mode 100644 index 000000000..c444a4f19 --- /dev/null +++ b/test_regress/t/t_config_top.v @@ -0,0 +1,31 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2025 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +module m1; + initial $stop; +endmodule + +module m2; + initial begin + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule + +// not defined: module m3; + +config cfg1; + design m1; +endconfig : cfg1 // Test end label + +// Check --top picks this config +config cfg2; + design m2; // Test without library name +endconfig + +config cfg3; + design work.m3; +endconfig diff --git a/test_regress/t/t_config_top2.out b/test_regress/t/t_config_top2.out new file mode 100644 index 000000000..7ae2334aa --- /dev/null +++ b/test_regress/t/t_config_top2.out @@ -0,0 +1,13 @@ +%Error-UNSUPPORTED: t/t_config_top2.v:21:1: Unsupported: config + 21 | config cfg12; + | ^~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error-UNSUPPORTED: t/t_config_top2.v:22:10: Unsupported: config cell + 22 | design work.m1 m2; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_top2.v:22:18: Unsupported: config cell + 22 | design work.m1 m2; + | ^~ +%Error: Specified --top-module 'cfg2' was not found in design. + ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. +%Error: Exiting due to diff --git a/test_regress/t/t_config_top2.py b/test_regress/t/t_config_top2.py new file mode 100755 index 000000000..f3b5677d5 --- /dev/null +++ b/test_regress/t/t_config_top2.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2025 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.lint(verilator_flags2=["--top cfg2"], fails=True, expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_config_top2.v b/test_regress/t/t_config_top2.v new file mode 100644 index 000000000..68add5751 --- /dev/null +++ b/test_regress/t/t_config_top2.v @@ -0,0 +1,23 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2025 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +module m1; + initial begin + m2.fin; + end +endmodule + +module m2; + task fin; + $write("*-* All Finished *-*\n"); + $finish; + endtask +endmodule + +// Test --top picks this config +config cfg12; + design work.m1 m2; // Test both modules listed, library.cell, and cell w/o library +endconfig diff --git a/test_regress/t/t_config_unsup.out b/test_regress/t/t_config_unsup.out index 988eca8a9..c119aafea 100644 --- a/test_regress/t/t_config_unsup.out +++ b/test_regress/t/t_config_unsup.out @@ -2,76 +2,76 @@ 24 | config cfg; | ^~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error-UNSUPPORTED: t/t_config_unsup.v:25:11: Unsupported: config cell - 25 | design t; - | ^ -%Error-UNSUPPORTED: t/t_config_unsup.v:28:4: Unsupported: config rule - 28 | default liblist; - | ^~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:29:4: Unsupported: config rule - 29 | default liblist liba libb; - | ^~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:32:4: Unsupported: config rule - 32 | instance t.m20 liblist; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:33:4: Unsupported: config rule - 33 | instance t.m21 liblist libc; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:34:4: Unsupported: config rule - 34 | instance t.m22 liblist libc libd; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:35:4: Unsupported: config rule - 35 | instance t.m23 liblist libc libd; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:36:4: Unsupported: config rule - 36 | instance t.m24 liblist libc libd; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:39:4: Unsupported: config rule - 39 | instance t.m30 use cell_identifier; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:39:19: Unsupported: config use - 39 | instance t.m30 use cell_identifier; - | ^~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:40:4: Unsupported: config rule - 40 | instance t.m31 use lib_id.cell_id; - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:40:19: Unsupported: config use - 40 | instance t.m31 use lib_id.cell_id; - | ^~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:41:4: Unsupported: config rule - 41 | instance t.m32 use #(); - | ^~~~~~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:41:19: Unsupported: config use - 41 | instance t.m32 use #(); - | ^~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:44:4: Unsupported: config rule - 44 | cell m40 liblist libc libd; - | ^~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:44:9: Unsupported: config cell - 44 | cell m40 liblist libc libd; - | ^~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:45:4: Unsupported: config rule - 45 | cell work.m41 liblist libc libd; - | ^~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:45:9: Unsupported: config cell - 45 | cell work.m41 liblist libc libd; - | ^~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:46:4: Unsupported: config rule - 46 | cell m42 use m42alt; - | ^~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:46:9: Unsupported: config cell - 46 | cell m42 use m42alt; - | ^~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:46:13: Unsupported: config use - 46 | cell m42 use m42alt; - | ^~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:47:4: Unsupported: config rule - 47 | cell work.m43 use work.m43alt; - | ^~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:47:9: Unsupported: config cell - 47 | cell work.m43 use work.m43alt; - | ^~~~ -%Error-UNSUPPORTED: t/t_config_unsup.v:47:18: Unsupported: config use - 47 | cell work.m43 use work.m43alt; +%Error-UNSUPPORTED: t/t_config_unsup.v:25:10: Unsupported: config cell + 25 | design t; + | ^ +%Error-UNSUPPORTED: t/t_config_unsup.v:28:3: Unsupported: config rule + 28 | default liblist; + | ^~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:29:3: Unsupported: config rule + 29 | default liblist liba libb; + | ^~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:32:3: Unsupported: config rule + 32 | instance t.m20 liblist; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:33:3: Unsupported: config rule + 33 | instance t.m21 liblist libc; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:34:3: Unsupported: config rule + 34 | instance t.m22 liblist libc libd; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:35:3: Unsupported: config rule + 35 | instance t.m23 liblist libc libd; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:36:3: Unsupported: config rule + 36 | instance t.m24 liblist libc libd; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:39:3: Unsupported: config rule + 39 | instance t.m30 use cell_identifier; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:39:18: Unsupported: config use + 39 | instance t.m30 use cell_identifier; | ^~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:40:3: Unsupported: config rule + 40 | instance t.m31 use lib_id.cell_id; + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:40:18: Unsupported: config use + 40 | instance t.m31 use lib_id.cell_id; + | ^~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:41:3: Unsupported: config rule + 41 | instance t.m32 use #(); + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:41:18: Unsupported: config use + 41 | instance t.m32 use #(); + | ^~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:44:3: Unsupported: config rule + 44 | cell m40 liblist libc libd; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:44:8: Unsupported: config cell + 44 | cell m40 liblist libc libd; + | ^~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:45:3: Unsupported: config rule + 45 | cell work.m41 liblist libc libd; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:45:8: Unsupported: config cell + 45 | cell work.m41 liblist libc libd; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:46:3: Unsupported: config rule + 46 | cell m42 use m42alt; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:46:8: Unsupported: config cell + 46 | cell m42 use m42alt; + | ^~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:46:12: Unsupported: config use + 46 | cell m42 use m42alt; + | ^~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:47:3: Unsupported: config rule + 47 | cell work.m43 use work.m43alt; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:47:8: Unsupported: config cell + 47 | cell work.m43 use work.m43alt; + | ^~~~ +%Error-UNSUPPORTED: t/t_config_unsup.v:47:17: Unsupported: config use + 47 | cell work.m43 use work.m43alt; + | ^~~ %Error: Exiting due to diff --git a/test_regress/t/t_config_unsup.v b/test_regress/t/t_config_unsup.v index 3e047e50a..1c9583e06 100644 --- a/test_regress/t/t_config_unsup.v +++ b/test_regress/t/t_config_unsup.v @@ -5,45 +5,45 @@ // SPDX-License-Identifier: CC0-1.0 module t; - m10 u_10(); - m20 u_20(); - m21 u_21(); - m22 u_22(); - m23 u_23(); - m24 u_24(); - m30 u_30(); - m31 u_31(); - m32 u_32(); - m40 u_40(); - m41 u_41(); - m42 u_42(); - m43 u_43(); - final $write("*-* All Finished *-*\n"); + m10 u_10(); + m20 u_20(); + m21 u_21(); + m22 u_22(); + m23 u_23(); + m24 u_24(); + m30 u_30(); + m31 u_31(); + m32 u_32(); + m40 u_40(); + m41 u_41(); + m42 u_42(); + m43 u_43(); + final $write("*-* All Finished *-*\n"); endmodule config cfg; - design t; + design t; - // Test uses m10 - default liblist; // Ignored - default liblist liba libb; + // Test uses m10 + default liblist; // Ignored + default liblist liba libb; - // Test uses m20-29 - instance t.m20 liblist; // Use parent's cell library - instance t.m21 liblist libc; - instance t.m22 liblist libc libd; // m22 in libc - instance t.m23 liblist libc libd; // m23 in libd - instance t.m24 liblist libc libd; // m24 in default (libb) + // Test uses m20-29 + instance t.m20 liblist; // Use parent's cell library + instance t.m21 liblist libc; + instance t.m22 liblist libc libd; // m22 in libc + instance t.m23 liblist libc libd; // m23 in libd + instance t.m24 liblist libc libd; // m24 in default (libb) - // Test uses m30-39 - instance t.m30 use cell_identifier; - instance t.m31 use lib_id.cell_id; - instance t.m32 use #(); + // Test uses m30-39 + instance t.m30 use cell_identifier; + instance t.m31 use lib_id.cell_id; + instance t.m32 use #(); - // Test uses m40-49 - cell m40 liblist libc libd; - cell work.m41 liblist libc libd; - cell m42 use m42alt; - cell work.m43 use work.m43alt; + // Test uses m40-49 + cell m40 liblist libc libd; + cell work.m41 liblist libc libd; + cell m42 use m42alt; + cell work.m43 use work.m43alt; endconfig diff --git a/test_regress/t/t_config_work.v b/test_regress/t/t_config_work.v index 6f3705a76..21f68b5fa 100644 --- a/test_regress/t/t_config_work.v +++ b/test_regress/t/t_config_work.v @@ -5,7 +5,8 @@ // SPDX-License-Identifier: CC0-1.0 module t; - m1 u_1(); - m2 u_2(); - final $write("*-* All Finished *-*\n"); + // Test --work allows selecting two different libraries for these instances + m1 u_1(); + m2 u_2(); + final $write("*-* All Finished *-*\n"); endmodule