Add the %sub/wr instruction.

This commit is contained in:
steve 2003-02-06 17:41:47 +00:00
parent 68de9bf5d2
commit dd56d9a17c
4 changed files with 39 additions and 6 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: codes.h,v 1.56 2003/01/26 18:16:22 steve Exp $" #ident "$Id: codes.h,v 1.57 2003/02/06 17:41:47 steve Exp $"
#endif #endif
@ -104,6 +104,7 @@ extern bool of_SET_X0(vthread_t thr, vvp_code_t code);
extern bool of_SHIFTL_I0(vthread_t thr, vvp_code_t code); extern bool of_SHIFTL_I0(vthread_t thr, vvp_code_t code);
extern bool of_SHIFTR_I0(vthread_t thr, vvp_code_t code); extern bool of_SHIFTR_I0(vthread_t thr, vvp_code_t code);
extern bool of_SUB(vthread_t thr, vvp_code_t code); extern bool of_SUB(vthread_t thr, vvp_code_t code);
extern bool of_SUB_WR(vthread_t thr, vvp_code_t code);
extern bool of_SUBI(vthread_t thr, vvp_code_t code); extern bool of_SUBI(vthread_t thr, vvp_code_t code);
extern bool of_VPI_CALL(vthread_t thr, vvp_code_t code); extern bool of_VPI_CALL(vthread_t thr, vvp_code_t code);
extern bool of_WAIT(vthread_t thr, vvp_code_t code); extern bool of_WAIT(vthread_t thr, vvp_code_t code);
@ -168,6 +169,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/* /*
* $Log: codes.h,v $ * $Log: codes.h,v $
* Revision 1.57 2003/02/06 17:41:47 steve
* Add the %sub/wr instruction.
*
* Revision 1.56 2003/01/26 18:16:22 steve * Revision 1.56 2003/01/26 18:16:22 steve
* Add %cvt/ir and %cvt/ri instructions, and support * Add %cvt/ir and %cvt/ri instructions, and support
* real values passed as arguments to VPI tasks. * real values passed as arguments to VPI tasks.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: compile.cc,v 1.152 2003/02/03 01:09:20 steve Exp $" #ident "$Id: compile.cc,v 1.153 2003/02/06 17:41:47 steve Exp $"
#endif #endif
# include "arith.h" # include "arith.h"
@ -149,6 +149,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%shiftl/i0", of_SHIFTL_I0, 2, {OA_BIT1,OA_NUMBER, OA_NONE} }, { "%shiftl/i0", of_SHIFTL_I0, 2, {OA_BIT1,OA_NUMBER, OA_NONE} },
{ "%shiftr/i0", of_SHIFTR_I0, 2, {OA_BIT1,OA_NUMBER, OA_NONE} }, { "%shiftr/i0", of_SHIFTR_I0, 2, {OA_BIT1,OA_NUMBER, OA_NONE} },
{ "%sub", of_SUB, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%sub", of_SUB, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%sub/wr", of_SUB_WR, 2, {OA_BIT1, OA_BIT2, OA_NONE} },
{ "%subi", of_SUBI, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%subi", of_SUBI, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%wait", of_WAIT, 1, {OA_FUNC_PTR, OA_NONE, OA_NONE} }, { "%wait", of_WAIT, 1, {OA_FUNC_PTR, OA_NONE, OA_NONE} },
{ "%xnor", of_XNOR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%xnor", of_XNOR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
@ -1519,6 +1520,9 @@ void compile_net(char*label, char*name, int msb, int lsb, bool signed_flag,
/* /*
* $Log: compile.cc,v $ * $Log: compile.cc,v $
* Revision 1.153 2003/02/06 17:41:47 steve
* Add the %sub/wr instruction.
*
* Revision 1.152 2003/02/03 01:09:20 steve * Revision 1.152 2003/02/03 01:09:20 steve
* Allow $display of $simtime. * Allow $display of $simtime.
* *

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
* *
* $Id: opcodes.txt,v 1.47 2003/01/26 18:16:22 steve Exp $ * $Id: opcodes.txt,v 1.48 2003/02/06 17:41:47 steve Exp $
*/ */
@ -33,6 +33,12 @@ See also the %sub instruction.
* %add/wr <bit-l>, <bit-r> * %add/wr <bit-l>, <bit-r>
This is the real valued version of hte %add instruction. The arguments
are word indices of the operands. The right operand is added into the
left operand.
See also the %sub/wr instruction.
* %addi <bit-l>, <imm>, <wid> * %addi <bit-l>, <imm>, <wid>
@ -548,6 +554,14 @@ the <wid> of the left vector. The result replaces the left vector.
See also the %addi instruction. See also the %addi instruction.
* %sub/wr <bit-l>, <bit-r>
This instruction operates on real values in word registers. The right
indexed value is subtracted from the left indexed value, and the
result placed in the left index.
* %vpi_call <name> [, ...] * %vpi_call <name> [, ...]
This instruction makes a call to a system task that was declared using This instruction makes a call to a system task that was declared using
@ -598,7 +612,7 @@ and leaves the result in the <dst> vector. xor is this:
/* /*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: vthread.cc,v 1.99 2003/01/27 00:14:37 steve Exp $" #ident "$Id: vthread.cc,v 1.100 2003/02/06 17:41:47 steve Exp $"
#endif #endif
# include "vthread.h" # include "vthread.h"
@ -2417,6 +2417,14 @@ bool of_SUB(vthread_t thr, vvp_code_t cp)
return true; return true;
} }
bool of_SUB_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;
}
bool of_SUBI(vthread_t thr, vvp_code_t cp) bool of_SUBI(vthread_t thr, vvp_code_t cp)
{ {
assert(cp->bit_idx[0] >= 4); assert(cp->bit_idx[0] >= 4);
@ -2608,6 +2616,9 @@ bool of_CALL_UFUNC(vthread_t thr, vvp_code_t cp)
/* /*
* $Log: vthread.cc,v $ * $Log: vthread.cc,v $
* Revision 1.100 2003/02/06 17:41:47 steve
* Add the %sub/wr instruction.
*
* Revision 1.99 2003/01/27 00:14:37 steve * Revision 1.99 2003/01/27 00:14:37 steve
* Support in various contexts the $realtime * Support in various contexts the $realtime
* system task. * system task.