diff --git a/tgt-vvp/eval_real.c b/tgt-vvp/eval_real.c index 616ca989e..23719d9a3 100644 --- a/tgt-vvp/eval_real.c +++ b/tgt-vvp/eval_real.c @@ -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. * diff --git a/vvp/codes.h b/vvp/codes.h index 03915ba58..9f16b0a77 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -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. * diff --git a/vvp/compile.cc b/vvp/compile.cc index 2bd69e16e..4467f9d60 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -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. * diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 8775ae16b..8cbefd7ec 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -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 , + +This opcode divides the left operand by the right operand. If the +right operand is 0, then the result is NaN. + + * %force , Activate a force represented by the force functors , which diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 1cb0f9533..eb38970b5 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -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. *