Skip to content

Commit

Permalink
Add signed modulus operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Jun 19, 2004
1 parent 03d7448 commit 050ec6f
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 105 deletions.
6 changes: 5 additions & 1 deletion vvp/codes.h
Expand Up @@ -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.65 2004/05/19 03:26:24 steve Exp $"
#ident "$Id: codes.h,v 1.66 2004/06/19 15:52:53 steve Exp $"
#endif


Expand Down Expand Up @@ -86,6 +86,7 @@ extern bool of_LOAD_WR(vthread_t thr, vvp_code_t code);
extern bool of_LOAD_X(vthread_t thr, vvp_code_t code);
extern bool of_LOADI_WR(vthread_t thr, vvp_code_t code);
extern bool of_MOD(vthread_t thr, vvp_code_t code);
extern bool of_MOD_S(vthread_t thr, vvp_code_t code);
extern bool of_MOV(vthread_t thr, vvp_code_t code);
extern bool of_MUL(vthread_t thr, vvp_code_t code);
extern bool of_MUL_WR(vthread_t thr, vvp_code_t code);
Expand Down Expand Up @@ -169,6 +170,9 @@ extern vvp_code_t codespace_null(void);

/*
* $Log: codes.h,v $
* Revision 1.66 2004/06/19 15:52:53 steve
* Add signed modulus operator.
*
* Revision 1.65 2004/05/19 03:26:24 steve
* Support delayed/non-blocking assignment to reals and others.
*
Expand Down
6 changes: 5 additions & 1 deletion vvp/compile.cc
Expand Up @@ -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.172 2004/06/16 16:33:26 steve Exp $"
#ident "$Id: compile.cc,v 1.173 2004/06/19 15:52:53 steve Exp $"
#endif

# include "arith.h"
Expand Down Expand Up @@ -133,6 +133,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%load/x", of_LOAD_X, 3, {OA_BIT1, OA_FUNC_PTR, OA_BIT2} },
{ "%loadi/wr",of_LOADI_WR,3,{OA_BIT1, OA_NUMBER, OA_BIT2} },
{ "%mod", of_MOD, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%mod/s", of_MOD_S, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%mov", of_MOV, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%mul", of_MUL, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%mul/wr", of_MUL_WR, 2, {OA_BIT1, OA_BIT2, OA_NONE} },
Expand Down Expand Up @@ -1578,6 +1579,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)

/*
* $Log: compile.cc,v $
* Revision 1.173 2004/06/19 15:52:53 steve
* Add signed modulus operator.
*
* Revision 1.172 2004/06/16 16:33:26 steve
* Add structural equality compare nodes.
*
Expand Down
6 changes: 4 additions & 2 deletions vvp/opcodes.txt
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.54 2004/05/19 03:26:24 steve Exp $
* $Id: opcodes.txt,v 1.55 2004/06/19 15:52:53 steve Exp $
*/


Expand Down Expand Up @@ -387,13 +387,15 @@ value. The sign bit is OR-ed into the <exp> value at bit 0x2000, and
is removed from the <exp> before calculating the real value.


* %mod <bit-l>, <bit-r>, <wid>
* %mod <bit-l>, <bit-r>, <wid>
* %mod/s <bit-l>, <bit-r>, <wid>

This instruction calculates the modulus %r of the left operand, and
replaces the left operand with the result. The <wid> gives the width
of the left and the right vectors, and the left vector is completely
replaced with the result.

The /s form does signed %.

* %mov <dst>, <src>, <wid>

Expand Down

0 comments on commit 050ec6f

Please sign in to comment.