diff --git a/tgt-vvp/eval_string.c b/tgt-vvp/eval_string.c index f0e631324..92d702058 100644 --- a/tgt-vvp/eval_string.c +++ b/tgt-vvp/eval_string.c @@ -23,11 +23,8 @@ static void fallback_eval(ivl_expr_t expr) { - struct vector_info res = draw_eval_expr(expr, 0); - fprintf(vvp_out, " %%pushv/str %u, %u; Cast BOOL/LOGIC to string\n", - res.base, res.wid); - if (res.base > 0) - clr_vector(res); + draw_eval_vec4(expr); + fprintf(vvp_out, " %%pushv/str; Cast BOOL/LOGIC to string\n"); } static void string_ex_concat(ivl_expr_t expr) diff --git a/vvp/compile.cc b/vvp/compile.cc index b16bee158..fd38da18a 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -241,7 +241,7 @@ static const struct opcode_table_s opcode_table[] = { { "%pushi/real",of_PUSHI_REAL,2,{OA_BIT1, OA_BIT2, OA_NONE} }, { "%pushi/str", of_PUSHI_STR, 1,{OA_STRING, OA_NONE, OA_NONE} }, { "%pushi/vec4",of_PUSHI_VEC4,3,{OA_BIT1, OA_BIT2, OA_NUMBER} }, - { "%pushv/str", of_PUSHV_STR, 2, {OA_BIT1,OA_BIT2, OA_NONE} }, + { "%pushv/str", of_PUSHV_STR, 0,{OA_NONE, OA_NONE, OA_NONE} }, { "%putc/str/vec4",of_PUTC_STR_VEC4,2,{OA_FUNC_PTR,OA_BIT1,OA_NONE} }, { "%qpop/b/str",of_QPOP_B_STR,1,{OA_FUNC_PTR,OA_NONE, OA_NONE} }, { "%qpop/b/v", of_QPOP_B_V, 1,{OA_FUNC_PTR,OA_NONE, OA_BIT2} }, diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 8596b129c..c7c71a619 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -1091,9 +1091,11 @@ possible logic values are: This opcode is limited to 32bit numbers. -* %pushv/str , +* %pushv/str -Convert a vector to a string and push the string to the string stack. +Convert a vector to a string and push the string to the string +stack. The single argument is popped from the vec4 stack and the +result pushed to the string stack. * %putc/str/v , diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 4f06bb7a3..188b95a91 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -5385,13 +5385,14 @@ bool of_PUSHI_VEC4(vthread_t thr, vvp_code_t cp) return true; } -bool of_PUSHV_STR(vthread_t thr, vvp_code_t cp) +/* + * %pushv/str + * Pops a vec4 value, and pushes a string. + */ +bool of_PUSHV_STR(vthread_t thr, vvp_code_t) { -#if 0 - unsigned src = cp->bit_idx[0]; - unsigned wid = cp->bit_idx[1]; + vvp_vector4_t vec = thr->pop_vec4(); - vvp_vector4_t vec = vthread_bits_to_vector(thr, src, wid); size_t slen = (vec.size() + 7)/8; vectorbuf; buf.reserve(slen); @@ -5418,9 +5419,7 @@ bool of_PUSHV_STR(vthread_t thr, vvp_code_t cp) } thr->push_str(val); -#else - fprintf(stderr, "XXXX NOT IMPLEMENTED: %%push/str ...\n"); -#endif + return true; }