Fix bug where func had to be declared before use

This commit is contained in:
Nick Gasson 2008-06-30 17:58:15 +01:00
parent 4e73b1b133
commit 6e8474f584
1 changed files with 6 additions and 5 deletions

View File

@ -216,12 +216,13 @@ vhdl_expr *translate_ufunc(ivl_expr_t e)
assert(parent_ent);
const char *funcname = ivl_scope_tname(defscope);
vhdl_type *rettype;
if (ivl_expr_signed(e))
rettype = vhdl_type::nsigned(ivl_expr_width(e));
else
rettype = vhdl_type::nunsigned(ivl_expr_width(e));
vhdl_decl *fdecl =
parent_ent->get_arch()->get_scope()->get_decl(funcname);
assert(fdecl);
vhdl_type *rettype = new vhdl_type(*fdecl->get_type());
vhdl_fcall *fcall = new vhdl_fcall(funcname, rettype);
int nparams = ivl_expr_parms(e);