diff --git a/docs/guide/warnings.rst b/docs/guide/warnings.rst index 2e38afff8..84845a67a 100644 --- a/docs/guide/warnings.rst +++ b/docs/guide/warnings.rst @@ -856,6 +856,11 @@ List Of Warnings pass. +.. option:: FUTURE + + Warns that a feature is under development and not yet supported. + + .. option:: GENCLK Historical, never issued since version 5.000. diff --git a/src/V3Error.h b/src/V3Error.h index b88c50545..33083a9dc 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -107,6 +107,7 @@ public: ENUMVALUE, // Error: enum type needs explicit cast EOFNEWLINE, // End-of-file missing newline FUNCTIMECTL, // Functions cannot have timing/delay/wait + FUTURE, // Feature is under development and not yet supported GENCLK, // Generated Clock. Historical, never issued. GENUNNAMED, // Generate unnamed, without label HIERBLOCK, // Ignored hierarchical block setting @@ -223,7 +224,7 @@ public: "CDCRSTLOGIC", "CLKDATA", "CMPCONST", "COLONPLUS", "COMBDLY", "CONSTRAINTIGN", "CONTASSREG", "COVERIGN", "DECLFILENAME", "DEFOVERRIDE", "DEFPARAM", "DEPRECATED", "ENCAPSULATED", "ENDLABEL", "ENUMITEMWIDTH", "ENUMVALUE", "EOFNEWLINE", "FUNCTIMECTL", - "GENCLK", "GENUNNAMED", "HIERBLOCK", "HIERPARAM", "IFDEPTH", "IGNOREDRETURN", + "FUTURE", "GENCLK", "GENUNNAMED", "HIERBLOCK", "HIERPARAM", "IFDEPTH", "IGNOREDRETURN", "IMPERFECTSCH", "IMPLICIT", "IMPLICITSTATIC", "IMPORTSTAR", "IMPURE", "INCABSPATH", "INFINITELOOP", "INITIALDLY", "INSECURE", "INSIDETRUE", "LATCH", "LITENDIAN", "MINTYPMAXDLY", "MISINDENT", "MODDUP", "MODMISSING", "MULTIDRIVEN", "MULTITOP", diff --git a/src/V3Options.cpp b/src/V3Options.cpp index c09ca5418..9fab2e650 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1056,6 +1056,10 @@ void V3Options::notify() VL_MT_DISABLED { "--main not usable with SystemC. Suggest see examples for sc_main()."); } + if (fourstate()) { + cmdfl->v3warn(FUTURE, "--fourstate is not supported as is under development"); + } + if (coverage() && savable()) { cmdfl->v3error("Unsupported: --coverage and --savable not supported together"); } @@ -1436,6 +1440,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, parseOptsFile(fl, parseFileArg(optdir, valp), false); }).notForRerun(); DECL_OPTION("-flatten", OnOff, &m_flatten); + DECL_OPTION("-fourstate", OnOff, &m_fourstate).undocumented(); DECL_OPTION("-future0", CbVal, [this](const char* valp) { addFuture0(valp); }); DECL_OPTION("-future1", CbVal, [this](const char* valp) { addFuture1(valp); }); diff --git a/src/V3Options.h b/src/V3Options.h index c8d52e44d..cde9bf40f 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -254,6 +254,7 @@ private: bool m_emitAccessors = false; // main switch: --emit-accessors bool m_exe = false; // main switch: --exe bool m_flatten = false; // main switch: --flatten + bool m_fourstate = false; // main switch: --fourstate bool m_hierarchical = false; // main switch: --hierarchical bool m_ignc = false; // main switch: --ignc bool m_jsonOnly = false; // main switch: --json-only @@ -545,6 +546,7 @@ public: bool emitAccessors() const { return m_emitAccessors; } bool exe() const { return m_exe; } bool flatten() const { return m_flatten; } + bool fourstate() const { return m_fourstate; } bool gmake() const { return m_gmake; } bool makeJson() const { return m_makeJson; } bool threadsDpiPure() const { return m_threadsDpiPure; } diff --git a/test_regress/t/t_fourstate_fourstate_unsup.out b/test_regress/t/t_fourstate_fourstate_unsup.out new file mode 100755 index 000000000..1218b57b9 --- /dev/null +++ b/test_regress/t/t_fourstate_fourstate_unsup.out @@ -0,0 +1,4 @@ +%Warning-FUTURE: --fourstate is not supported as is under development + ... For warning description see https://verilator.org/warn/FUTURE?v=latest + ... Use "/* verilator lint_off FUTURE */" and lint_on around source to disable this message. +%Error: Exiting due to diff --git a/test_regress/t/t_fourstate_fourstate_unsup.py b/test_regress/t/t_fourstate_fourstate_unsup.py new file mode 100755 index 000000000..536d13cca --- /dev/null +++ b/test_regress/t/t_fourstate_fourstate_unsup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# 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-FileCopyrightText: 2026 Wilson Snyder +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.lint(verilator_flags2=['--fourstate'], fails=True, expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_fourstate_fourstate_unsup.v b/test_regress/t/t_fourstate_fourstate_unsup.v new file mode 100644 index 000000000..1980ff1ed --- /dev/null +++ b/test_regress/t/t_fourstate_fourstate_unsup.v @@ -0,0 +1,21 @@ +// DESCRIPTION: Verilator: Verilog Test module for SystemVerilog +// +// Assignment compatibility test. +// +// This file ONLY is placed under the Creative Commons Public Domain +// SPDX-FileCopyrightText: 2026 Antmicro +// SPDX-License-Identifier: CC0-1.0 + +module t; + logic a = 'z; + logic b; + + assign b = ~a; + + initial begin + #1; + if (b !== 1) $stop; + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule diff --git a/test_regress/t/t_fourstate_no_fourstate.py b/test_regress/t/t_fourstate_no_fourstate.py new file mode 100755 index 000000000..a3be7a21a --- /dev/null +++ b/test_regress/t/t_fourstate_no_fourstate.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# 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-FileCopyrightText: 2026 Wilson Snyder +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.compile(verilator_flags2=['--binary', '--no-fourstate']) + +test.execute() + +test.passes() diff --git a/test_regress/t/t_fourstate_no_fourstate.v b/test_regress/t/t_fourstate_no_fourstate.v new file mode 100644 index 000000000..1980ff1ed --- /dev/null +++ b/test_regress/t/t_fourstate_no_fourstate.v @@ -0,0 +1,21 @@ +// DESCRIPTION: Verilator: Verilog Test module for SystemVerilog +// +// Assignment compatibility test. +// +// This file ONLY is placed under the Creative Commons Public Domain +// SPDX-FileCopyrightText: 2026 Antmicro +// SPDX-License-Identifier: CC0-1.0 + +module t; + logic a = 'z; + logic b; + + assign b = ~a; + + initial begin + #1; + if (b !== 1) $stop; + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule