Report that 4-state dynamic arrays are not currently supported in vvp

Also fix some error code propagation issues.
This commit is contained in:
Cary R 2015-01-16 18:19:37 -08:00
parent 40ae1051d4
commit b3425d6cf3
4 changed files with 19 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2005-2015 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
@ -59,13 +59,13 @@ static void draw_eval_function_argument(ivl_signal_t port, ivl_expr_t expr)
function_argument_real(port, expr);
break;
case IVL_VT_CLASS:
draw_eval_object(expr);
vvp_errors += draw_eval_object(expr);
break;
case IVL_VT_STRING:
draw_eval_string(expr);
break;
case IVL_VT_DARRAY:
draw_eval_object(expr);
vvp_errors += draw_eval_object(expr);
break;
default:
fprintf(stderr, "XXXX function argument %s type=%d?!\n",

View File

@ -49,7 +49,6 @@ static int eval_darray_new(ivl_expr_t ex)
fprintf(vvp_out, " %%new/darray %u, \"S\";\n", size_reg);
break;
case IVL_VT_BOOL:
case IVL_VT_LOGIC:
// bool objects are vectorable, but for now only support
// a single dimensions.
assert(ivl_type_packed_dimensions(element_type) == 1);
@ -67,7 +66,7 @@ static int eval_darray_new(ivl_expr_t ex)
default:
fprintf(stderr, "%s:%u: tgt-vvp sorry: vvp currently only "
"supports dynamic array widths of 8, 16, 32 or 64 "
"bits, given (%d)\n",
"bits, given (%d).\n",
ivl_expr_file(ex), ivl_expr_lineno(ex), wid);
errors += 1;;
}
@ -75,6 +74,12 @@ static int eval_darray_new(ivl_expr_t ex)
fprintf(vvp_out, " %%new/darray %u, \"%sb%d\";\n", size_reg,
ivl_type_signed(element_type) ? "s" : "", wid);
break;
case IVL_VT_LOGIC:
fprintf(stderr, "%s:%u: tgt-vvp sorry: vvp does not currently "
"supports 4-state dynamic arrays.\n",
ivl_expr_file(ex), ivl_expr_lineno(ex));
errors += 1;;
break;
default:
assert(0);
@ -202,11 +207,12 @@ static int eval_object_property(ivl_expr_t expr)
static int eval_object_shallowcopy(ivl_expr_t ex)
{
int errors = 0;
ivl_expr_t dest = ivl_expr_oper1(ex);
ivl_expr_t src = ivl_expr_oper2(ex);
draw_eval_object(dest);
draw_eval_object(src);
errors += draw_eval_object(dest);
errors += draw_eval_object(src);
/* The %scopy opcode pops the top of the object stack as the
source object, and shallow-copies it to the new top, the
@ -214,7 +220,7 @@ static int eval_object_shallowcopy(ivl_expr_t ex)
the stack. */
fprintf(vvp_out, " %%scopy;\n");
return 0;
return errors;
}
static int eval_object_signal(ivl_expr_t expr)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2015 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
@ -868,7 +868,7 @@ static int show_stmt_assign_sig_cobject(ivl_statement_t net)
expression to the assignment is of an entire
array object. */
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
draw_eval_object(rval);
errors += draw_eval_object(rval);
fprintf(vvp_out, " %%store/prop/obj %d, %d; IVL_VT_DARRAY\n", prop_idx, idx);
fprintf(vvp_out, " %%pop/obj 1, 0;\n");
@ -882,7 +882,7 @@ static int show_stmt_assign_sig_cobject(ivl_statement_t net)
/* The property is a class object. */
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
draw_eval_object(rval);
errors += draw_eval_object(rval);
if (idx_expr) draw_eval_expr_into_integer(idx_expr, idx);
fprintf(vvp_out, " %%store/prop/obj %d, %d; IVL_VT_CLASS\n", prop_idx, idx);
fprintf(vvp_out, " %%pop/obj 1, 0;\n");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2015 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
@ -2328,7 +2328,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
draw_task_definition(net);
if (ivl_scope_type(net) == IVL_SCT_FUNCTION)
draw_func_definition(net);
vvp_errors += draw_func_definition(net);
ivl_scope_children(net, (ivl_scope_f*) draw_scope, net);
return 0;