Add the set/x0/x instruction.
This commit is contained in:
parent
b82a2d4773
commit
e157b3f9c5
|
|
@ -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.60 2003/05/07 03:39:12 steve Exp $"
|
||||
#ident "$Id: codes.h,v 1.61 2003/05/26 04:44:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -103,6 +103,7 @@ extern bool of_SET_MEM(vthread_t thr, vvp_code_t code);
|
|||
extern bool of_SET_VEC(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SET_WORDR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SET_X0(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SET_X0_X(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_SUB(vthread_t thr, vvp_code_t code);
|
||||
|
|
@ -172,6 +173,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
|
|||
|
||||
/*
|
||||
* $Log: codes.h,v $
|
||||
* Revision 1.61 2003/05/26 04:44:54 steve
|
||||
* Add the set/x0/x instruction.
|
||||
*
|
||||
* Revision 1.60 2003/05/07 03:39:12 steve
|
||||
* ufunc calls to functions can have scheduling complexities.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.163 2003/05/25 03:04:55 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.164 2003/05/26 04:44:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "arith.h"
|
||||
|
|
@ -148,6 +148,7 @@ const static struct opcode_table_s opcode_table[] = {
|
|||
{ "%set/v", of_SET_VEC,3, {OA_FUNC_PTR, OA_BIT1, OA_BIT2} },
|
||||
{ "%set/wr", of_SET_WORDR,2,{OA_VPI_PTR, OA_BIT1, OA_NONE} },
|
||||
{ "%set/x0", of_SET_X0, 3, {OA_FUNC_PTR, OA_BIT1, OA_BIT2} },
|
||||
{ "%set/x0/x",of_SET_X0_X,3,{OA_FUNC_PTR, OA_BIT1, OA_BIT2} },
|
||||
{ "%shiftl/i0", of_SHIFTL_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} },
|
||||
|
|
@ -1555,6 +1556,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.164 2003/05/26 04:44:54 steve
|
||||
* Add the set/x0/x instruction.
|
||||
*
|
||||
* Revision 1.163 2003/05/25 03:04:55 steve
|
||||
* Useless cast.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* $Id: opcodes.txt,v 1.51 2003/03/28 02:33:56 steve Exp $
|
||||
* $Id: opcodes.txt,v 1.52 2003/05/26 04:44:54 steve Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -518,6 +518,7 @@ sets only a single bit.
|
|||
This instruction writes a real word to the specified VPI-like object.
|
||||
|
||||
* %set/x0 <var-label>, <bit>, <top>
|
||||
* %set/x0/x <var-label>, <bit>, <word>
|
||||
|
||||
This sets the bit of a variable functor, the address calculated by
|
||||
using the index register 0 to index the functor address of
|
||||
|
|
@ -529,6 +530,10 @@ performed. Also, if the index value is > the immediate top value, then
|
|||
the set is not performed. The 0 and <top> values suffice to provide
|
||||
complete bounds checking.
|
||||
|
||||
The %set/x0/x instruction is the same, except the bound value is in
|
||||
a word register instead of in the opcode. This allows for bounds that
|
||||
are larger then 0xffff.
|
||||
|
||||
|
||||
* %shiftl/i0 <bit>, <wid>
|
||||
|
||||
|
|
|
|||
|
|
@ -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.107 2003/05/07 03:39:12 steve Exp $"
|
||||
#ident "$Id: vthread.cc,v 1.108 2003/05/26 04:44:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vthread.h"
|
||||
|
|
@ -2387,6 +2387,31 @@ bool of_SET_X0(vthread_t thr, vvp_code_t cp)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool of_SET_X0_X(vthread_t thr, vvp_code_t cp)
|
||||
{
|
||||
unsigned char bit_val = thr_get_bit(thr, cp->bit_idx[0]);
|
||||
long idx = thr->words[0].w_int;
|
||||
long lim = thr->words[cp->bit_idx[1]].w_int;
|
||||
|
||||
/* If idx < 0, then the index value is probably generated from
|
||||
an undefined value. At any rate, this is defined to have no
|
||||
effect so quit now. */
|
||||
if (idx < 0)
|
||||
return true;
|
||||
|
||||
if (idx > lim)
|
||||
return true;
|
||||
|
||||
/* Form the functor pointer from the base pointer and the
|
||||
index from the index register. */
|
||||
vvp_ipoint_t itmp = ipoint_index(cp->iptr, idx);
|
||||
|
||||
/* Set the value. */
|
||||
functor_set(itmp, bit_val, strong_values[bit_val], true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool of_SHIFTL_I0(vthread_t thr, vvp_code_t cp)
|
||||
{
|
||||
unsigned base = cp->bit_idx[0];
|
||||
|
|
@ -2699,6 +2724,9 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
|
|||
|
||||
/*
|
||||
* $Log: vthread.cc,v $
|
||||
* Revision 1.108 2003/05/26 04:44:54 steve
|
||||
* Add the set/x0/x instruction.
|
||||
*
|
||||
* Revision 1.107 2003/05/07 03:39:12 steve
|
||||
* ufunc calls to functions can have scheduling complexities.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue