diff --git a/vvp/codes.h b/vvp/codes.h index b94d82d4b..24f49fc89 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.43 2002/05/31 20:04:22 steve Exp $" +#ident "$Id: codes.h,v 1.44 2002/06/02 18:55:58 steve Exp $" #endif @@ -45,6 +45,7 @@ extern bool of_ASSIGN_MEM(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_X0(vthread_t thr, vvp_code_t code); extern bool of_BREAKPOINT(vthread_t thr, vvp_code_t code); extern bool of_CASSIGN(vthread_t thr, vvp_code_t code); +extern bool of_CMPIU(vthread_t thr, vvp_code_t code); extern bool of_CMPS(vthread_t thr, vvp_code_t code); extern bool of_CMPU(vthread_t thr, vvp_code_t code); extern bool of_CMPX(vthread_t thr, vvp_code_t code); @@ -155,6 +156,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr); /* * $Log: codes.h,v $ + * Revision 1.44 2002/06/02 18:55:58 steve + * Add %cmpi/u instruction. + * * Revision 1.43 2002/05/31 20:04:22 steve * Add the %muli instruction. * diff --git a/vvp/compile.cc b/vvp/compile.cc index e1f21dbc5..16873f978 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.129 2002/05/31 20:04:22 steve Exp $" +#ident "$Id: compile.cc,v 1.130 2002/06/02 18:55:58 steve Exp $" #endif # include "arith.h" @@ -93,6 +93,7 @@ const static struct opcode_table_s opcode_table[] = { { "%cmp/u", of_CMPU, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%cmp/x", of_CMPX, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%cmp/z", of_CMPZ, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, + { "%cmpi/u", of_CMPIU, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%deassign",of_DEASSIGN,2,{OA_FUNC_PTR, OA_BIT1, OA_NONE} }, { "%delay", of_DELAY, 1, {OA_NUMBER, OA_NONE, OA_NONE} }, { "%delayx", of_DELAYX, 1, {OA_NUMBER, OA_NONE, OA_NONE} }, @@ -1413,6 +1414,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name) /* * $Log: compile.cc,v $ + * Revision 1.130 2002/06/02 18:55:58 steve + * Add %cmpi/u instruction. + * * Revision 1.129 2002/05/31 20:04:22 steve * Add the %muli instruction. * diff --git a/vvp/vthread.cc b/vvp/vthread.cc index d07e61c3d..793672d95 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.77 2002/05/31 20:04:22 steve Exp $" +#ident "$Id: vthread.cc,v 1.78 2002/06/02 18:55:58 steve Exp $" #endif # include "vthread.h" @@ -577,6 +577,49 @@ bool of_CMPS(vthread_t thr, vvp_code_t cp) return true; } +bool of_CMPIU(vthread_t thr, vvp_code_t cp) +{ + unsigned eq = 1; + unsigned eeq = 1; + unsigned lt = 0; + + unsigned idx1 = cp->bit_idx[0]; + unsigned imm = cp->bit_idx[1]; + + for (unsigned idx = 0 ; idx < cp->number ; idx += 1) { + unsigned lv = thr_get_bit(thr, idx1); + unsigned rv = imm & 1; + imm >>= 1; + + if (lv > rv) { + lt = 0; + eeq = 0; + } else if (lv < rv) { + lt = 1; + eeq = 0; + } + if (eq != 2) { + if ((lv == 0) && (rv != 0)) + eq = 0; + if ((lv == 1) && (rv != 1)) + eq = 0; + if ((lv | rv) >= 2) + eq = 2; + } + + if (idx1 >= 4) idx1 += 1; + } + + if (eq == 2) + lt = 2; + + thr_put_bit(thr, 4, eq); + thr_put_bit(thr, 5, lt); + thr_put_bit(thr, 6, eeq); + + return true; +} + bool of_CMPU(vthread_t thr, vvp_code_t cp) { unsigned eq = 1; @@ -2165,6 +2208,9 @@ bool of_CALL_UFUNC(vthread_t thr, vvp_code_t cp) /* * $Log: vthread.cc,v $ + * Revision 1.78 2002/06/02 18:55:58 steve + * Add %cmpi/u instruction. + * * Revision 1.77 2002/05/31 20:04:22 steve * Add the %muli instruction. *