diff --git a/vvp/codes.h b/vvp/codes.h index 7f026b2ff..de558d541 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -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. * diff --git a/vvp/compile.cc b/vvp/compile.cc index f02f804d1..fa0da258c 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -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. * diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 91a81d276..640dc6081 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -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 may not be 0-3, but if the 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 , , + +The %nor/r instruction is a reduction nor. That is, the is a +vector with width, but the result is a single bit. The vector is +not affected by the operation unless the bit is within the vector. + * %or , , Perform the bitwise or of the vectors. diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 5ddd4b314..15481f9d1 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -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. *