aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-09-23 07:16:03 +0200
committerClifford Wolf <clifford@clifford.at>2015-09-23 07:16:03 +0200
commit559929e341a9416ab68ce1d0ef94068cd57512f9 (patch)
tree0042a1a35ebbff41561409da1bbd325017f1c969 /frontends/ast
parentb845b77f862b0f4881315394d6a6fe790f273ddc (diff)
downloadyosys-559929e341a9416ab68ce1d0ef94068cd57512f9.tar.gz
yosys-559929e341a9416ab68ce1d0ef94068cd57512f9.tar.bz2
yosys-559929e341a9416ab68ce1d0ef94068cd57512f9.zip
Warning for $display/$write outside initial block
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/simplify.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index 77d4447f5..2abb48a58 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -182,20 +182,21 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
str = std::string();
}
+ if ((type == AST_TCALL) && (str == "$display" || str == "$write") && (!current_always || current_always->type != AST_INITIAL)) {
+ log_warning("System task `%s' outside initial block is unsupported at %s:%d.\n", str.c_str(), filename.c_str(), linenum);
+ delete_children();
+ str = std::string();
+ }
+
// print messages if this a call to $display() or $write()
// This code implements only a small subset of Verilog-2005 $display() format specifiers,
// 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",
- int(children.size()), filename.c_str(), linenum);
- }
+ log_error("System task `%s' got %d arguments, expected >= 1 at %s:%d.\n",
+ str.c_str(), int(children.size()), filename.c_str(), linenum);
// First argument is the format string
AstNode *node_string = children[0]->clone();