Implement and use the %retload/real opcode.

This commit is contained in:
Stephen Williams 2016-02-01 09:31:06 -08:00
parent c114edfa6c
commit ce692f90ad
3 changed files with 18 additions and 2 deletions

View File

@ -297,6 +297,16 @@ static void draw_signal_real_real(ivl_expr_t expr)
{
ivl_signal_t sig = ivl_expr_signal(expr);
/* Special Case: If the signal is the return value of the function,
then use a different opcode to get the value. */
if (signal_is_return_value(sig)) {
assert(ivl_signal_dimensions(sig) == 0);
fprintf(vvp_out, " %%retload/real 0; Load %s (draw_signal_real_real)\n",
ivl_signal_basename(sig));
return;
}
if (ivl_signal_dimensions(sig) == 0) {
fprintf(vvp_out, " %%load/real v%p_0;\n", sig);
return;

View File

@ -1025,6 +1025,7 @@ that contains the actual offset. In this case, flag-4 is tested, and
if not 1, the assign is suppressed.
* %retload/vec4 <index>
* %retload/real <index>
Read a value from the indexed function argument. The value is read
from the argument and pushed to the appropriate stack.

View File

@ -5049,8 +5049,13 @@ bool of_RET_VEC4(vthread_t thr, vvp_code_t cp)
*/
bool of_RETLOAD_REAL(vthread_t thr, vvp_code_t cp)
{
// NOT IMPLEMENTED
assert(0);
size_t index = cp->number;
assert(index >= 0 && index < thr->args_real.size());
unsigned depth = thr->args_real[index];
// Use the depth to extract the values from the stack
// of the parent thread.
thr->push_real(thr->parent->peek_real(depth));
return true;
}