Add the load/x instruction for bit selects.

This commit is contained in:
steve 2001-07-22 00:04:50 +00:00
parent 60c22aefeb
commit 54140dadcf
5 changed files with 40 additions and 6 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.32 2001/07/19 04:40:55 steve Exp $"
#ident "$Id: codes.h,v 1.33 2001/07/22 00:04:50 steve Exp $"
#endif
@ -63,6 +63,7 @@ extern bool of_JMP1(vthread_t thr, vvp_code_t code);
extern bool of_JOIN(vthread_t thr, vvp_code_t code);
extern bool of_LOAD(vthread_t thr, vvp_code_t code);
extern bool of_LOAD_MEM(vthread_t thr, vvp_code_t code);
extern bool of_LOAD_X(vthread_t thr, vvp_code_t code);
extern bool of_MOD(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);
@ -137,6 +138,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/*
* $Log: codes.h,v $
* Revision 1.33 2001/07/22 00:04:50 steve
* Add the load/x instruction for bit selects.
*
* Revision 1.32 2001/07/19 04:40:55 steve
* Add support for the delayx opcode.
*

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.88 2001/07/19 04:40:55 steve Exp $"
#ident "$Id: compile.cc,v 1.89 2001/07/22 00:04:50 steve Exp $"
#endif
# include "arith.h"
@ -102,6 +102,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%join", of_JOIN, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%load", of_LOAD, 2, {OA_BIT1, OA_FUNC_PTR, OA_NONE} },
{ "%load/m", of_LOAD_MEM,2, {OA_BIT1, OA_MEM_PTR, OA_NONE} },
{ "%load/x", of_LOAD_X, 3, {OA_BIT1, OA_FUNC_PTR, OA_BIT2} },
{ "%mod", of_MOD, 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} },
@ -707,7 +708,7 @@ void compile_udp_def(int sequ, char *label, char *name,
u->sequ = sequ;
u->nin = nin;
u->init = init;
u->table = table;
u->compile_table(table);
free(label);
}
@ -1545,6 +1546,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.89 2001/07/22 00:04:50 steve
* Add the load/x instruction for bit selects.
*
* Revision 1.88 2001/07/19 04:40:55 steve
* Add support for the delayx opcode.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.26 2001/07/19 04:40:55 steve Exp $
* $Id: opcodes.txt,v 1.27 2001/07/22 00:04:50 steve Exp $
*/
@ -233,6 +233,14 @@ Bit address zero is the LSB of the first memory word. This
instruction loads only a single bit.
* %load/x <bit>, <functor-label>, <idx>
This is an indexed load. It uses the contents of the specified index
register to select a bit from an array based at <functor-label>. The
bit is pulled from the addressed functor and loaded into the
destination bit. This function does not do any bounds checking.
* %mod <bit-l>, <bit-r>, <wid>

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: udp.h,v 1.6 2001/05/06 03:51:37 steve Exp $"
#ident "$Id: udp.h,v 1.7 2001/07/22 00:04:50 steve Exp $"
#endif
#include "pointers.h"
@ -39,6 +39,8 @@ class vvp_udp_s : public vvp_fobj_s
unsigned char init;
char **table;
void compile_table(char **t) { table = t; }
private:
unsigned char propagate_(vvp_ipoint_t i);
};
@ -49,6 +51,9 @@ struct vvp_udp_s *udp_find(char *label);
/*
* $Log: udp.h,v $
* Revision 1.7 2001/07/22 00:04:50 steve
* Add the load/x instruction for bit selects.
*
* Revision 1.6 2001/05/06 03:51:37 steve
* Regularize the mode-42 functor handling.
*

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.50 2001/07/20 04:57:00 steve Exp $"
#ident "$Id: vthread.cc,v 1.51 2001/07/22 00:04:50 steve Exp $"
#endif
# include "vthread.h"
@ -835,6 +835,16 @@ bool of_LOAD_MEM(vthread_t thr, vvp_code_t cp)
return true;
}
bool of_LOAD_X(vthread_t thr, vvp_code_t cp)
{
assert(cp->bit_idx1 >= 4);
assert(cp->bit_idx2 < 4);
vvp_ipoint_t ptr = ipoint_index(cp->iptr, thr->index[cp->bit_idx2]);
thr_put_bit(thr, cp->bit_idx1, functor_get(ptr));
return true;
}
bool of_MOD(vthread_t thr, vvp_code_t cp)
{
assert(cp->bit_idx1 >= 4);
@ -1326,6 +1336,9 @@ bool of_ZOMBIE(vthread_t thr, vvp_code_t)
/*
* $Log: vthread.cc,v $
* Revision 1.51 2001/07/22 00:04:50 steve
* Add the load/x instruction for bit selects.
*
* Revision 1.50 2001/07/20 04:57:00 steve
* Fix of_END when a middle thread ends.
*