diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 369c61086..87bfddebc 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -6226,16 +6226,32 @@ bool of_STORE_QOBJ_V(vthread_t thr, vvp_code_t cp) return store_qobj(thr, cp, cp->bit_idx[1]); } -bool of_STORE_REAL(vthread_t thr, vvp_code_t cp) +static void vvp_send(vthread_t thr, vvp_net_ptr_t ptr, double&val) { - double val = thr->pop_real(); + vvp_send_real(ptr, val, thr->wt_context); +} + +static void vvp_send(vthread_t thr, vvp_net_ptr_t ptr, string&val) +{ + vvp_send_string(ptr, val, thr->wt_context); +} + +template +static bool store(vthread_t thr, vvp_code_t cp) +{ + ELEM val; + pop_value(thr, val, 0); /* set the value into port 0 of the destination. */ vvp_net_ptr_t ptr (cp->net, 0); - vvp_send_real(ptr, val, thr->wt_context); - + vvp_send(thr, ptr, val); return true; } +bool of_STORE_REAL(vthread_t thr, vvp_code_t cp) +{ + return store(thr, cp); +} + /* * %store/reala */ @@ -6252,13 +6268,7 @@ bool of_STORE_REALA(vthread_t thr, vvp_code_t cp) bool of_STORE_STR(vthread_t thr, vvp_code_t cp) { - /* set the value into port 0 of the destination. */ - vvp_net_ptr_t ptr (cp->net, 0); - - string val = thr->pop_str(); - vvp_send_string(ptr, val, thr->wt_context); - - return true; + return store(thr, cp); } /*