Add support for real power (**) in normal expressions.
This patch adds support for the real power (**) operator in normal expressions.
This commit is contained in:
parent
f049426f25
commit
1595ae79fd
|
|
@ -91,6 +91,9 @@ static int draw_binary_real(ivl_expr_t exp)
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
case 'p':
|
||||
fprintf(vvp_out, " %%pow/wr %d, %d;\n", l, r);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "XXXX draw_binary_real(%c)\n",
|
||||
ivl_expr_opcode(exp));
|
||||
|
|
@ -438,4 +441,3 @@ int draw_eval_real(ivl_expr_t exp)
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ extern bool of_NOR(vthread_t thr, vvp_code_t code);
|
|||
extern bool of_NORR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_OR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_ORR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_POW_WR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_RELEASE_NET(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_RELEASE_REG(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SET_AV(vthread_t thr, vvp_code_t code);
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ const static struct opcode_table_s opcode_table[] = {
|
|||
{ "%nor/r", of_NORR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
|
||||
{ "%or", of_OR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
|
||||
{ "%or/r", of_ORR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
|
||||
{ "%pow/wr", of_POW_WR, 2, {OA_BIT1, OA_BIT2, OA_NONE} },
|
||||
{ "%release/net",of_RELEASE_NET,1,{OA_FUNC_PTR,OA_NONE,OA_NONE} },
|
||||
{ "%release/reg",of_RELEASE_REG,1,{OA_FUNC_PTR,OA_NONE,OA_NONE} },
|
||||
{ "%set/av", of_SET_AV, 3, {OA_ARR_PTR, OA_BIT1, OA_BIT2} },
|
||||
|
|
|
|||
|
|
@ -570,6 +570,12 @@ and the <dst> is a writable scalar. The <dst> gets the value of the
|
|||
or of all the bits of the src vector.
|
||||
|
||||
|
||||
* %pow/wr <bit-l>, <bit-r>
|
||||
|
||||
This opcode raises <bit-l> (real) to the power of <bit-r> (real). The
|
||||
result replaces the left operand.
|
||||
|
||||
|
||||
* %release/net <functor-label>
|
||||
* %release/reg <functor-label>
|
||||
|
||||
|
|
|
|||
|
|
@ -3172,6 +3172,15 @@ bool of_NOR(vthread_t thr, vvp_code_t cp)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool of_POW_WR(vthread_t thr, vvp_code_t cp)
|
||||
{
|
||||
double l = thr->words[cp->bit_idx[0]].w_real;
|
||||
double r = thr->words[cp->bit_idx[1]].w_real;
|
||||
thr->words[cp->bit_idx[0]].w_real = pow(l, r);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* These implement the %release/net and %release/reg instructions. The
|
||||
* %release/net instruction applies to a net kind of functor by
|
||||
|
|
@ -3686,4 +3695,3 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue