Add the reduction nor instruction.

This commit is contained in:
steve 2001-04-01 22:25:33 +00:00
parent f8e6d782e1
commit bf30a0bc07
4 changed files with 45 additions and 4 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.14 2001/04/01 07:22:08 steve Exp $"
#ident "$Id: codes.h,v 1.15 2001/04/01 22:25:33 steve Exp $"
#endif
@ -53,6 +53,7 @@ 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_MOV(vthread_t thr, vvp_code_t code);
extern bool of_NOOP(vthread_t thr, vvp_code_t code);
extern bool of_NORR(vthread_t thr, vvp_code_t code);
extern bool of_OR(vthread_t thr, vvp_code_t code);
extern bool of_SET(vthread_t thr, vvp_code_t code);
extern bool of_VPI_CALL(vthread_t thr, vvp_code_t code);
@ -104,6 +105,9 @@ extern void codespace_dump(FILE*fd);
/*
* $Log: codes.h,v $
* Revision 1.15 2001/04/01 22:25:33 steve
* Add the reduction nor instruction.
*
* Revision 1.14 2001/04/01 07:22:08 steve
* Implement the less-then and %or instructions.
*

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.27 2001/04/01 21:31:46 steve Exp $"
#ident "$Id: compile.cc,v 1.28 2001/04/01 22:25:33 steve Exp $"
#endif
# include "compile.h"
@ -83,6 +83,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%load", of_LOAD, 2, {OA_BIT1, OA_FUNC_PTR, OA_NONE} },
{ "%mov", of_MOV, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%noop", of_NOOP, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%nor/r", of_NORR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%or", of_OR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%set", of_SET, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} },
{ "%wait", of_WAIT, 1, {OA_FUNC_PTR, OA_NONE, OA_NONE} },
@ -711,6 +712,9 @@ void compile_dump(FILE*fd)
/*
* $Log: compile.cc,v $
* Revision 1.28 2001/04/01 22:25:33 steve
* Add the reduction nor instruction.
*
* Revision 1.27 2001/04/01 21:31:46 steve
* Add the buf functor type.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.10 2001/04/01 07:22:08 steve Exp $
* $Id: opcodes.txt,v 1.11 2001/04/01 22:25:33 steve Exp $
*/
@ -154,6 +154,12 @@ width and non-overlapping. The <dst> may not be 0-3, but if the <src>
is one of the 4 constant bits, the effect is to replicate the value
into the destination vector. Useful for filling a vector.
* %nor/r <dst>, <src>, <wid>
The %nor/r instruction is a reduction nor. That is, the <src> is a
vector with width, but the result is a single bit. The <src> vector is
not affected by the operation unless the <dst> bit is within the vector.
* %or <dst>, <src>, <wid>
Perform the bitwise or of the vectors.

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.19 2001/04/01 07:22:08 steve Exp $"
#ident "$Id: vthread.cc,v 1.20 2001/04/01 22:25:33 steve Exp $"
#endif
# include "vthread.h"
@ -418,6 +418,30 @@ bool of_NOOP(vthread_t thr, vvp_code_t cp)
return true;
}
bool of_NORR(vthread_t thr, vvp_code_t cp)
{
assert(cp->bit_idx1 >= 4);
unsigned lb = 0;
unsigned idx2 = cp->bit_idx2;
for (unsigned idx = 0 ; idx < cp->number ; idx += 1) {
unsigned rb = thr_get_bit(thr, idx2);
if (rb == 1) {
lb = 1;
break;
}
if (rb != 0)
lb = 2;
}
thr_put_bit(thr, cp->bit_idx1, lb);
return true;
}
bool of_OR(vthread_t thr, vvp_code_t cp)
{
assert(cp->bit_idx1 >= 4);
@ -480,6 +504,9 @@ bool of_WAIT(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.20 2001/04/01 22:25:33 steve
* Add the reduction nor instruction.
*
* Revision 1.19 2001/04/01 07:22:08 steve
* Implement the less-then and %or instructions.
*