Add the %ix/get instruction. (Stephan Boettcher)

This commit is contained in:
steve 2001-05-06 17:42:22 +00:00
parent 78af3dbdc0
commit e328cf9fed
4 changed files with 43 additions and 5 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: codes.h,v 1.24 2001/05/05 23:55:46 steve Exp $"
#ident "$Id: codes.h,v 1.25 2001/05/06 17:42:22 steve Exp $"
#endif
@ -51,6 +51,7 @@ extern bool of_END(vthread_t thr, vvp_code_t code);
extern bool of_FORK(vthread_t thr, vvp_code_t code);
extern bool of_INV(vthread_t thr, vvp_code_t code);
extern bool of_IX_ADD(vthread_t thr, vvp_code_t code);
extern bool of_IX_GET(vthread_t thr, vvp_code_t code);
extern bool of_IX_LOAD(vthread_t thr, vvp_code_t code);
extern bool of_IX_MUL(vthread_t thr, vvp_code_t code);
extern bool of_IX_SUB(vthread_t thr, vvp_code_t code);
@ -128,6 +129,9 @@ extern void codespace_dump(FILE*fd);
/*
* $Log: codes.h,v $
* Revision 1.25 2001/05/06 17:42:22 steve
* Add the %ix/get instruction. (Stephan Boettcher)
*
* Revision 1.24 2001/05/05 23:55:46 steve
* Add the beginnings of an interactive debugger.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.cc,v 1.56 2001/05/06 03:51:37 steve Exp $"
#ident "$Id: compile.cc,v 1.57 2001/05/06 17:42:22 steve Exp $"
#endif
# include "compile.h"
@ -82,6 +82,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%inv", of_INV, 2, {OA_BIT1, OA_BIT2, OA_NONE} },
{ "%ix/add", of_IX_ADD, 2, {OA_BIT1, OA_NUMBER, OA_NONE} },
{ "%ix/get", of_IX_GET, 2, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%ix/load",of_IX_LOAD,2, {OA_BIT1, OA_NUMBER, OA_NONE} },
{ "%ix/mul", of_IX_MUL, 2, {OA_BIT1, OA_NUMBER, OA_NONE} },
{ "%ix/sub", of_IX_SUB, 2, {OA_BIT1, OA_NUMBER, OA_NONE} },
@ -1048,6 +1049,9 @@ void compile_dump(FILE*fd)
/*
* $Log: compile.cc,v $
* Revision 1.57 2001/05/06 17:42:22 steve
* Add the %ix/get instruction. (Stephan Boettcher)
*
* Revision 1.56 2001/05/06 03:51:37 steve
* Regularize the mode-42 functor handling.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.18 2001/05/05 23:55:46 steve Exp $
* $Id: opcodes.txt,v 1.19 2001/05/06 17:42:22 steve Exp $
*/
@ -141,12 +141,24 @@ bit:
z --> x
* %ix/get <idx>, <bit>, <wid>
This instruction loads a thread vector starting at <bit>, size <wid>,
into the index register <idx>. The <bit> is the lsb of the value in
thread bit space, and <wid> is the width of the vector.
The function converts the 4-value bits into a binary number, without
sign extension. If any of the bits of the vector is x or z, then the
index register gets the value 0.
* %ix/load <idx>, <value>
This instruction loads an immediate value into the addressed index
register. The index register holds numeric values, so the <value> is a
number. The idx value selects the index register, and may be 0, 1, 2
or 3.
or 3. This is different from %is/get, which loads the index register
from a value in the thread bit vector.
* %ix/add <idx>, <value>

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vthread.cc,v 1.35 2001/05/05 23:55:46 steve Exp $"
#ident "$Id: vthread.cc,v 1.36 2001/05/06 17:42:22 steve Exp $"
#endif
# include "vthread.h"
@ -663,6 +663,21 @@ bool of_IX_LOAD(vthread_t thr, vvp_code_t cp)
return true;
}
bool of_IX_GET(vthread_t thr, vvp_code_t cp)
{
unsigned long v = 0;
for (int i = 0; i<cp->number; i++) {
unsigned char vv = thr_get_bit(thr, cp->bit_idx2 + i);
if (vv&2) {
v = ~0UL;
break;
}
v |= vv << i;
}
thr->index[cp->bit_idx1 & 3] = v;
return true;
}
/*
* The various JMP instruction work simply by pulling the new program
@ -978,6 +993,9 @@ bool of_ZOMBIE(vthread_t thr, vvp_code_t)
/*
* $Log: vthread.cc,v $
* Revision 1.36 2001/05/06 17:42:22 steve
* Add the %ix/get instruction. (Stephan Boettcher)
*
* Revision 1.35 2001/05/05 23:55:46 steve
* Add the beginnings of an interactive debugger.
*