Parser: Move disable fork and wait fork down into elaborate stage

This commit is contained in:
Wilson Snyder 2020-06-29 20:22:39 -04:00
parent ad2cb45a14
commit ad55564905
6 changed files with 81 additions and 2 deletions

View File

@ -4337,6 +4337,22 @@ public:
}
};
class AstDisableFork : public AstNodeStmt {
// A "disable fork" statement
public:
AstDisableFork(FileLine* fl)
: ASTGEN_SUPER(fl) {}
ASTNODE_NODE_FUNCS(DisableFork)
};
class AstWaitFork : public AstNodeStmt {
// A "wait fork" statement
public:
AstWaitFork(FileLine* fl)
: ASTGEN_SUPER(fl) {}
ASTNODE_NODE_FUNCS(WaitFork)
};
class AstReturn : public AstNodeStmt {
public:
explicit AstReturn(FileLine* fl, AstNode* lhsp = NULL)

View File

@ -568,6 +568,14 @@ private:
// TBD might support only normal join, if so complain about other join flavors
}
}
virtual void visit(AstDisableFork* nodep) VL_OVERRIDE {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disable fork statements");
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstWaitFork* nodep) VL_OVERRIDE {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: wait fork statements");
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
virtual void visit(AstToLowerN* nodep) VL_OVERRIDE {
if (m_vup->prelim()) {
iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH);

View File

@ -3039,7 +3039,7 @@ statement_item<nodep>: // IEEE: statement_item
//
// // IEEE: disable_statement
| yDISABLE idAny/*hierarchical_identifier-task_or_block*/ ';' { $$ = new AstDisable($1,*$2); }
| yDISABLE yFORK ';' { $$ = NULL; BBUNSUP($1, "Unsupported: disable fork statements"); }
| yDISABLE yFORK ';' { $$ = new AstDisableFork($1); }
// // IEEE: event_trigger
| yP_MINUSGT idDotted/*hierarchical_identifier-event*/ ';'
{ // AssignDly because we don't have stratified queue, and need to
@ -3080,7 +3080,7 @@ statement_item<nodep>: // IEEE: statement_item
//
// // IEEE: wait_statement
| yWAIT '(' expr ')' stmtBlock { $$ = NULL; BBUNSUP($1, "Unsupported: wait statements"); }
| yWAIT yFORK ';' { $$ = NULL; BBUNSUP($1, "Unsupported: wait fork statements"); }
| yWAIT yFORK ';' { $$ = new AstWaitFork($1); }
//UNSUP yWAIT_ORDER '(' hierarchical_identifierList ')' action_block { UNSUP }
//
// // IEEE: procedural_assertion_statement

View File

@ -0,0 +1,13 @@
%Error-UNSUPPORTED: t/t_fork_disable.v:12:7: Unsupported: fork statements
: ... In instance t
12 | fork
| ^~~~
%Error-UNSUPPORTED: t/t_fork_disable.v:16:7: Unsupported: disable fork statements
: ... In instance t
16 | disable fork;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_fork_disable.v:17:7: Unsupported: wait fork statements
: ... In instance t
17 | wait fork;
| ^~~~
%Error: Exiting due to

View File

@ -0,0 +1,20 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2019 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
scenarios(linter => 1);
lint(
verilator_flags2 => ['--lint-only'],
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,22 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t(/*AUTOARG*/);
logic never;
initial begin
fork
#10;
#10;
join_none
disable fork;
wait fork;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule