vlog95: Report zero argument functions are not supported.

This commit is contained in:
Cary R 2013-02-07 17:06:54 -08:00
parent b6ec138644
commit a581e0ef0e
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2012 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2013 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -456,6 +456,9 @@ static void emit_expr_func(ivl_scope_t scope, ivl_expr_t expr, unsigned wid)
}
emit_expr(scope, ivl_expr_parm(expr, count), 0);
fprintf(vlog_out, ")");
/* User functions without arguments are not supported. */
} else if (ivl_expr_type(expr) == IVL_EX_UFUNC) {
fprintf(vlog_out, "()");
}
}

View File

@ -717,7 +717,14 @@ int emit_scope(ivl_scope_t scope, ivl_scope_t parent)
case IVL_SCT_FUNCTION:
assert(indent != 0);
fprintf(vlog_out, "\n%*cfunction", indent, ' ');
assert(ivl_scope_ports(scope) >= 2);
if (ivl_scope_ports(scope) < 2) {
fprintf(stderr, "%s:%u: vlog95 error: Function (%s) has "
"no argments (or return value).\n",
ivl_scope_file(scope),
ivl_scope_lineno(scope),
ivl_scope_tname(scope));
vlog_errors += 1;
}
/* The function return information is the zero port. */
emit_func_return(ivl_scope_port(scope, 0));
fprintf(vlog_out, " ");