Report in SV that Icarus cannot currently call a function like a task.
SystemVerilog allows a function to be called without an assignment for the return value. This patch adds a warning that Icarus does not currently support this and provides a place to add this functionality later.
This commit is contained in:
parent
15b0946fc4
commit
48b186576e
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __Statement_H
|
||||
#define __Statement_H
|
||||
/*
|
||||
* Copyright (c) 1998-2008,2012 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -212,6 +212,7 @@ class PCallTask : public Statement {
|
|||
NetProc* elaborate_usr(Design*des, NetScope*scope) const;
|
||||
|
||||
NetProc*elaborate_method_(Design*des, NetScope*scope) const;
|
||||
NetProc*elaborate_function_(Design*des, NetScope*scope) const;
|
||||
|
||||
pform_name_t path_;
|
||||
vector<PExpr*> parms_;
|
||||
|
|
|
|||
28
elaborate.cc
28
elaborate.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2012 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -3059,9 +3059,14 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
|
|||
|
||||
NetScope*task = des->find_task(scope, path_);
|
||||
if (task == 0) {
|
||||
// Maybe this is a method attached to a signal?
|
||||
// For SystemVerilog this may be a few other things.
|
||||
if (gn_system_verilog()) {
|
||||
NetProc*tmp = elaborate_method_(des, scope);
|
||||
NetProc *tmp;
|
||||
// This could be a method attached to a signal?
|
||||
tmp = elaborate_method_(des, scope);
|
||||
if (tmp) return tmp;
|
||||
// Or it could be a function call ignoring the return?
|
||||
tmp = elaborate_function_(des, scope);
|
||||
if (tmp) return tmp;
|
||||
}
|
||||
|
||||
|
|
@ -3258,6 +3263,9 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope) const
|
|||
NetEvent *eve;
|
||||
const NetExpr *ex1, *ex2;
|
||||
|
||||
// There is no signal to search for so this cannot be a method.
|
||||
if (use_path.empty()) return 0;
|
||||
|
||||
symbol_search(this, des, scope, use_path,
|
||||
net, par, eve, ex1, ex2);
|
||||
|
||||
|
|
@ -3280,6 +3288,20 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
NetProc* PCallTask::elaborate_function_(Design*des, NetScope*scope) const
|
||||
{
|
||||
NetFuncDef*func = des->find_function(scope, path_);
|
||||
// This is not a function, so this task call cannot be a function
|
||||
// call with a missing return assignment.
|
||||
if (! func) return 0;
|
||||
|
||||
// HERE: Should this be an assign to a dummy variable or something else?
|
||||
cerr << get_fileline() << ": sorry: Icarus cannot currently call "
|
||||
"functions like a tasks." << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Elaborate a procedural continuous assign. This really looks very
|
||||
* much like other procedural assignments, at this point, but there
|
||||
|
|
|
|||
Loading…
Reference in New Issue