static struct vector_info get_vec_from_lval(ivl_statement_t net, struct vec_slice_info*slices) { struct vector_info res; unsigned lidx; unsigned cur_bit; res.wid = ivl_stmt_lwidth(net); res.base = allocate_vector(res.wid); cur_bit = 0; for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) { unsigned bidx; ivl_lval_t lval; unsigned bit_limit = res.wid - cur_bit; lval = ivl_stmt_lval(net, lidx); if (bit_limit > ivl_lval_width(lval)) bit_limit = ivl_lval_width(lval); bidx = res.base + cur_bit; get_vec_from_lval_slice(lval, slices+lidx, bidx, bit_limit); cur_bit += bit_limit; } return res; }
/* * This loads the l-value values into the top of the stack, and also * leaves in the slices the information needed to store the slice * results back. */ static void get_vec_from_lval(ivl_statement_t net, struct vec_slice_info*slices) { unsigned lidx; unsigned cur_bit; unsigned wid = ivl_stmt_lwidth(net); cur_bit = 0; for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) { ivl_lval_t lval; unsigned bit_limit = wid - cur_bit; lval = ivl_stmt_lval(net, lidx); if (bit_limit > ivl_lval_width(lval)) bit_limit = ivl_lval_width(lval); get_vec_from_lval_slice(lval, slices+lidx, bit_limit); if (lidx > 0) { fprintf(vvp_out, " %%concat/vec4;\n"); } cur_bit += bit_limit; } }