From 51787d68b94d19cdba9677b59516ec8bd2fe575e Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 13 Dec 2017 19:49:37 -0500 Subject: [PATCH] Add error if always_comb has sensitivity list. --- Changes | 2 ++ src/verilog.y | 2 +- test_regress/t/t_lint_comb_bad.pl | 24 ++++++++++++++++++++++++ test_regress/t/t_lint_comb_bad.v | 17 +++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 test_regress/t/t_lint_comb_bad.pl create mode 100644 test_regress/t/t_lint_comb_bad.v diff --git a/Changes b/Changes index 3f800fb2b..e1720f868 100644 --- a/Changes +++ b/Changes @@ -13,6 +13,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Support string len() method. [Victor Besyakov] +**** Add error if always_comb has sensitivity list. [Arjen Roodselaar] + **** Fix modport outputs being treated as inputs, bug1246. [Jeff Bush] **** Fix false ALWCOMBORDER on interface references, bug1247. [Josh Redford] diff --git a/src/verilog.y b/src/verilog.y index addc8626e..7cb489e26 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -1719,8 +1719,8 @@ module_common_item: // ==IEEE: module_common_item // // Verilator only - event_control attached to always | yALWAYS event_controlE stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS, $2,$3); } | yALWAYS_FF event_controlE stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_FF, $2,$3); } - | yALWAYS_COMB event_controlE stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_COMB, $2,$3); } | yALWAYS_LATCH event_controlE stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_LATCH, $2,$3); } + | yALWAYS_COMB stmtBlock { $$ = new AstAlways($1,VAlwaysKwd::ALWAYS_COMB, NULL, $2); } | loop_generate_construct { $$ = $1; } | conditional_generate_construct { $$ = $1; } | elaboration_system_task { $$ = $1; } diff --git a/test_regress/t/t_lint_comb_bad.pl b/test_regress/t/t_lint_comb_bad.pl new file mode 100755 index 000000000..cd289b1e6 --- /dev/null +++ b/test_regress/t/t_lint_comb_bad.pl @@ -0,0 +1,24 @@ +#!/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. + +$Self->{vlt} or $Self->skip("Verilator only test"); + +compile ( + verilator_flags2 => ["--lint-only"], + verilator_make_gcc => 0, + make_top_shell => 0, + make_main => 0, + fails => 1, + expect=> +q{%Error: t/t_lint_comb_bad.v:\d+: syntax error, unexpected '@' +.*}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_lint_comb_bad.v b/test_regress/t/t_lint_comb_bad.v new file mode 100644 index 000000000..360fb330f --- /dev/null +++ b/test_regress/t/t_lint_comb_bad.v @@ -0,0 +1,17 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2017 by Wilson Snyder. + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk; + + always_comb @(*) begin + $stop; + end + +endmodule