Exemplo n.º 1
0
void draw_ufunc_object(ivl_expr_t expr)
{
      ivl_scope_t def = ivl_expr_def(expr);
      ivl_signal_t retval = ivl_scope_port(def, 0);

	/* Take in arguments to function and call the function code. */
      draw_ufunc_preamble(expr);

	/* Load the result into the object stack. */
      fprintf(vvp_out, "    %%load/obj v%p_0;\n", retval);

      draw_ufunc_epilogue(expr);
}
Exemplo n.º 2
0
void draw_ufunc_vec4(ivl_expr_t expr)
{
    ivl_scope_t def = ivl_expr_def(expr);
    ivl_signal_t retval = ivl_scope_port(def, 0);

    /* Take in arguments to function and call function code. */
    draw_ufunc_preamble(expr);

    assert(ivl_signal_dimensions(retval) == 0);
    fprintf(vvp_out, "    %%load/vec4  v%p_0;\n", retval);

    draw_ufunc_epilogue(expr);
}
Exemplo n.º 3
0
void draw_ufunc_string(ivl_expr_t expr)
{
    ivl_scope_t def = ivl_expr_def(expr);
    ivl_signal_t retval = ivl_scope_port(def, 0);

    /* Take in arguments to function and call the function code. */
    draw_ufunc_preamble(expr);

    /* Return value signal cannot be an array. */
    assert(ivl_signal_dimensions(retval) == 0);

    /* Load the result into a word. */
    fprintf(vvp_out, "  %%load/str v%p_0;\n", retval);

    draw_ufunc_epilogue(expr);
}
Exemplo n.º 4
0
struct vector_info draw_ufunc_expr(ivl_expr_t expr, unsigned wid)
{
      unsigned swid = ivl_expr_width(expr);
      ivl_scope_t def = ivl_expr_def(expr);
      ivl_signal_t retval = ivl_scope_port(def, 0);
      struct vector_info res;
      unsigned load_wid;

	/* Take in arguments to function and call function code. */
      draw_ufunc_preamble(expr);

	/* Fresh basic block starts after the join. */
      clear_expression_lookaside();

	/* The return value is in a signal that has the name of the
	   expression. Load that into the thread and return the
	   vector result. */

      res.base = allocate_vector(wid);
      res.wid  = wid;
      if (res.base == 0) {
	    fprintf(stderr, "%s:%u: vvp.tgt error: "
		    "Unable to allocate %u thread bits for function result.\n",
		    ivl_expr_file(expr), ivl_expr_lineno(expr), wid);
	    vvp_errors += 1;
	    return res;
      }

      assert(res.base != 0);

      load_wid = swid;
      if (load_wid > ivl_signal_width(retval))
	    load_wid = ivl_signal_width(retval);

      assert(ivl_signal_dimensions(retval) == 0);
      fprintf(vvp_out, "    %%load/v  %u, v%p_0, %u;\n",
	      res.base, retval, load_wid);

	/* Pad the signal value with zeros. */
      if (load_wid < wid)
	    pad_expr_in_place(expr, res, swid);

      draw_ufunc_epilogue(expr);
      return res;
}