Add support for unary operators in constant user functions.

This patch implements the evaluate_function method for the NetEUnary
and NetEUReduce classes.
This commit is contained in:
Martin Whitaker
2013-02-04 12:17:05 -08:00
committed by Cary R
parent 11f479e028
commit afd23d13d5
3 changed files with 64 additions and 15 deletions
+19
View File
@@ -293,6 +293,14 @@ NetExpr* NetEConst::evaluate_function(const LineInfo&,
return res;
}
NetExpr* NetECReal::evaluate_function(const LineInfo&,
map<perm_string,NetExpr*>&) const
{
NetECReal*res = new NetECReal(value_);
res->set_line(*this);
return res;
}
NetExpr* NetESelect::evaluate_function(const LineInfo&loc,
map<perm_string,NetExpr*>&context_map) const
{
@@ -372,6 +380,17 @@ NetExpr* NetETernary::evaluate_function(const LineInfo&loc,
return res;
}
NetExpr* NetEUnary::evaluate_function(const LineInfo&loc,
map<perm_string,NetExpr*>&context_map) const
{
NetExpr*val = expr_->evaluate_function(loc, context_map);
if (val == 0) return 0;
NetExpr*res = eval_arguments_(val);
delete val;
return res;
}
NetExpr* NetEUFunc::evaluate_function(const LineInfo&loc,
map<perm_string,NetExpr*>&context_map) const
{