Add support for division of real operands.

This commit is contained in:
steve 2003-03-28 02:33:56 +00:00
parent 4e182ebf67
commit 4b543de7f9
5 changed files with 39 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_real.c,v 1.6 2003/03/15 04:45:18 steve Exp $"
#ident "$Id: eval_real.c,v 1.7 2003/03/28 02:33:56 steve Exp $"
#endif
/*
@ -77,6 +77,11 @@ static int draw_binary_real(ivl_expr_t exp)
clr_word(r);
break;
case '/':
fprintf(vvp_out, " %%div/wr %d, %d;\n", l, r);
clr_word(r);
break;
default:
fprintf(stderr, "XXXX draw_binary_real(%c)\n",
ivl_expr_opcode(exp));
@ -283,6 +288,9 @@ int draw_eval_real(ivl_expr_t exp)
/*
* $Log: eval_real.c,v $
* Revision 1.7 2003/03/28 02:33:56 steve
* Add support for division of real operands.
*
* Revision 1.6 2003/03/15 04:45:18 steve
* Allow real-valued vpi functions to have arguments.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: codes.h,v 1.58 2003/02/27 20:36:29 steve Exp $"
#ident "$Id: codes.h,v 1.59 2003/03/28 02:33:56 steve Exp $"
#endif
@ -63,6 +63,7 @@ extern bool of_DELAYX(vthread_t thr, vvp_code_t code);
extern bool of_DISABLE(vthread_t thr, vvp_code_t code);
extern bool of_DIV(vthread_t thr, vvp_code_t code);
extern bool of_DIV_S(vthread_t thr, vvp_code_t code);
extern bool of_DIV_WR(vthread_t thr, vvp_code_t code);
extern bool of_END(vthread_t thr, vvp_code_t code);
extern bool of_FORCE(vthread_t thr, vvp_code_t code);
extern bool of_FORK(vthread_t thr, vvp_code_t code);
@ -170,6 +171,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/*
* $Log: codes.h,v $
* Revision 1.59 2003/03/28 02:33:56 steve
* Add support for division of real operands.
*
* Revision 1.58 2003/02/27 20:36:29 steve
* Add the cvt/vr instruction.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compile.cc,v 1.157 2003/03/13 04:36:57 steve Exp $"
#ident "$Id: compile.cc,v 1.158 2003/03/28 02:33:56 steve Exp $"
#endif
# include "arith.h"
@ -109,6 +109,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%delayx", of_DELAYX, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
{ "%div", of_DIV, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%div/s", of_DIV_S, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%div/wr", of_DIV_WR, 2, {OA_BIT1, OA_BIT2, OA_NONE} },
{ "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%force", of_FORCE, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} },
{ "%inv", of_INV, 2, {OA_BIT1, OA_BIT2, OA_NONE} },
@ -1527,6 +1528,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
/*
* $Log: compile.cc,v $
* Revision 1.158 2003/03/28 02:33:56 steve
* Add support for division of real operands.
*
* Revision 1.157 2003/03/13 04:36:57 steve
* Remove the obsolete functor delete functions.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.50 2003/02/27 20:36:29 steve Exp $
* $Id: opcodes.txt,v 1.51 2003/03/28 02:33:56 steve Exp $
*/
@ -226,6 +226,12 @@ the bits in either vector are x or z, the entire result is x.
The %div/s instruction is the same as %div, but does signed division.
* %div/wr <bit-l>, <bit-r>
This opcode divides the left operand by the right operand. If the
right operand is 0, then the result is NaN.
* %force <fofu-label>, <width>
Activate a force represented by the force functors <fofu-label>, which

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vthread.cc,v 1.105 2003/03/13 04:36:57 steve Exp $"
#ident "$Id: vthread.cc,v 1.106 2003/03/28 02:33:57 steve Exp $"
#endif
# include "vthread.h"
@ -1238,6 +1238,15 @@ bool of_DIV_S(vthread_t thr, vvp_code_t cp)
return true;
}
bool of_DIV_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 = l / r;
return true;
}
/*
* This terminates the current thread. If there is a parent who is
* waiting for me to die, then I schedule it. At any rate, I mark
@ -2675,6 +2684,9 @@ bool of_CALL_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.106 2003/03/28 02:33:57 steve
* Add support for division of real operands.
*
* Revision 1.105 2003/03/13 04:36:57 steve
* Remove the obsolete functor delete functions.
*