summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-09-18 09:50:53 +0200
committerClifford Wolf <clifford@clifford.at>2015-09-18 09:50:57 +0200
commit9db05d17feddf7615bb8944390fa7b535cd48b12 (patch)
tree638a93ba2e32fadb79b6f83f81c222743c5ba11f /frontends
parent7141f655337fe2bcedba6029cc30f0a213c79810 (diff)
Added AST_INITIAL checks for $finish and $display
Diffstat (limited to 'frontends')
-rw-r--r--frontends/ast/simplify.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index 144fd41d..dd4f0797 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -187,10 +187,13 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
// but should be good enough for most uses
if ((type == AST_TCALL) && ((str == "$display") || (str == "$write")))
{
+ if (!current_always || current_always->type != AST_INITIAL)
+ log_error("System task `$display' outside initial block is unsupported at %s:%d.\n", filename.c_str(), linenum);
+
size_t nargs = GetSize(children);
if(nargs < 1)
{
- log_error("System task ``$display\" got %d arguments, expected >= 1 at %s:%d.\n",
+ log_error("System task `$display' got %d arguments, expected >= 1 at %s:%d.\n",
int(children.size()), filename.c_str(), linenum);
}
@@ -1652,11 +1655,15 @@ skip_dynamic_range_lvalue_expansion:;
if (current_scope.count(str) == 0 || current_scope[str]->type != AST_FUNCTION)
log_error("Can't resolve function name `%s' at %s:%d.\n", str.c_str(), filename.c_str(), linenum);
}
+
if (type == AST_TCALL)
{
if (str == "$finish")
{
- log_error("System task `$finish() executed in `%s' at %s:%d.\n", str.c_str(), filename.c_str(), linenum);
+ if (!current_always || current_always->type != AST_INITIAL)
+ log_error("System task `$finish' outside initial block is unsupported at %s:%d.\n", filename.c_str(), linenum);
+
+ log_error("System task `$finish' executed at %s:%d.\n", filename.c_str(), linenum);
}
if (str == "\\$readmemh" || str == "\\$readmemb")