From 234a4d662d29ca1cc63a5d867cbbcac832e95c67 Mon Sep 17 00:00:00 2001 From: Stefan Wallentowitz Date: Fri, 3 Jan 2020 15:09:23 +0100 Subject: [PATCH] Deprecate sc_clock --- src/V3LinkParse.cpp | 1 + test_regress/t/t_clk_first.v | 8 ++++---- test_regress/t/t_clk_first_bad.out | 5 +++++ test_regress/t/t_clk_first_bad.pl | 21 +++++++++++++++++++++ test_regress/t/t_clk_first_deprecated.pl | 17 +++++++++++++++++ test_regress/t/t_clk_first_deprecated.v | 13 +++++++++++++ 6 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 test_regress/t/t_clk_first_bad.out create mode 100755 test_regress/t/t_clk_first_bad.pl create mode 100755 test_regress/t/t_clk_first_deprecated.pl create mode 100644 test_regress/t/t_clk_first_deprecated.v diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 05b16ebd8..ff99771f7 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -260,6 +260,7 @@ private: } else if (nodep->attrType() == AstAttrType::VAR_CLOCK) { UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable"); + nodep->v3warn(DEPRECATED, "sc_clock is deprecated and will be removed"); m_varp->attrScClocked(true); nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); } diff --git a/test_regress/t/t_clk_first.v b/test_regress/t/t_clk_first.v index 32fb1c14b..52cf01582 100644 --- a/test_regress/t/t_clk_first.v +++ b/test_regress/t/t_clk_first.v @@ -8,8 +8,8 @@ module t (/*AUTOARG*/ clk, fastclk ); - input clk /*verilator sc_clock*/; - input fastclk /*verilator sc_clock*/; + input clk; + input fastclk; reg reset_l; int cyc; @@ -32,8 +32,8 @@ module t_clk (/*AUTOARG*/ clk, fastclk, reset_l ); - input clk /*verilator sc_clock*/; - input fastclk /*verilator sc_clock*/; + input clk; + input fastclk; input reset_l; // surefire lint_off STMINI diff --git a/test_regress/t/t_clk_first_bad.out b/test_regress/t/t_clk_first_bad.out new file mode 100644 index 000000000..2e9e41bf1 --- /dev/null +++ b/test_regress/t/t_clk_first_bad.out @@ -0,0 +1,5 @@ +%Warning-DEPRECATED: t/t_clk_first_deprecated.v:11: sc_clock is deprecated and will be removed + input clk /*verilator sc_clock*/ ; + ^~~~~~~~~~~~~~~~~~~~~~ + ... Use "/* verilator lint_off DEPRECATED */" and lint_on around source to disable this message. +%Error: Exiting due to diff --git a/test_regress/t/t_clk_first_bad.pl b/test_regress/t/t_clk_first_bad.pl new file mode 100755 index 000000000..3f7b54038 --- /dev/null +++ b/test_regress/t/t_clk_first_bad.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 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. + +scenarios(vlt => 1); + +top_filename("t/t_clk_first_deprecated.v"); + +lint( + verilator_flags2 => ["--lint-only"], + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_clk_first_deprecated.pl b/test_regress/t/t_clk_first_deprecated.pl new file mode 100755 index 000000000..01d7bf8d0 --- /dev/null +++ b/test_regress/t/t_clk_first_deprecated.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 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. + +scenarios(vlt => 1); + +lint( + verilator_flags2 => ["--lint-only", "-Wno-DEPRECATED"], + ); + +ok(1); +1; diff --git a/test_regress/t/t_clk_first_deprecated.v b/test_regress/t/t_clk_first_deprecated.v new file mode 100644 index 000000000..5c5f5ce12 --- /dev/null +++ b/test_regress/t/t_clk_first_deprecated.v @@ -0,0 +1,13 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2003 by Wilson Snyder. + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk /*verilator sc_clock*/; + +endmodule