Add support for the delayx opcode.

This commit is contained in:
steve 2001-07-19 04:40:55 +00:00
parent 83de770387
commit e773ccfe49
4 changed files with 31 additions and 4 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: codes.h,v 1.31 2001/06/30 21:07:26 steve Exp $" #ident "$Id: codes.h,v 1.32 2001/07/19 04:40:55 steve Exp $"
#endif #endif
@ -46,6 +46,7 @@ extern bool of_CMPU(vthread_t thr, vvp_code_t code);
extern bool of_CMPX(vthread_t thr, vvp_code_t code); extern bool of_CMPX(vthread_t thr, vvp_code_t code);
extern bool of_CMPZ(vthread_t thr, vvp_code_t code); extern bool of_CMPZ(vthread_t thr, vvp_code_t code);
extern bool of_DELAY(vthread_t thr, vvp_code_t code); extern bool of_DELAY(vthread_t thr, vvp_code_t code);
extern bool of_DELAYX(vthread_t thr, vvp_code_t code);
extern bool of_DISABLE(vthread_t thr, vvp_code_t code); extern bool of_DISABLE(vthread_t thr, vvp_code_t code);
extern bool of_END(vthread_t thr, vvp_code_t code); 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_FORK(vthread_t thr, vvp_code_t code);
@ -136,6 +137,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/* /*
* $Log: codes.h,v $ * $Log: codes.h,v $
* Revision 1.32 2001/07/19 04:40:55 steve
* Add support for the delayx opcode.
*
* Revision 1.31 2001/06/30 21:07:26 steve * Revision 1.31 2001/06/30 21:07:26 steve
* Support non-const right shift (unsigned). * Support non-const right shift (unsigned).
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: compile.cc,v 1.87 2001/07/11 04:43:57 steve Exp $" #ident "$Id: compile.cc,v 1.88 2001/07/19 04:40:55 steve Exp $"
#endif #endif
# include "arith.h" # include "arith.h"
@ -87,6 +87,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%cmp/x", of_CMPX, 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} }, { "%cmp/z", of_CMPZ, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%delay", of_DELAY, 1, {OA_NUMBER, OA_NONE, OA_NONE} }, { "%delay", of_DELAY, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
{ "%delayx", of_DELAYX, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
{ "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%inv", of_INV, 2, {OA_BIT1, OA_BIT2, 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/add", of_IX_ADD, 2, {OA_BIT1, OA_NUMBER, OA_NONE} },
@ -1544,6 +1545,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/* /*
* $Log: compile.cc,v $ * $Log: compile.cc,v $
* Revision 1.88 2001/07/19 04:40:55 steve
* Add support for the delayx opcode.
*
* Revision 1.87 2001/07/11 04:43:57 steve * Revision 1.87 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher) * support postpone of $systask parameters. (Stephan Boettcher)
* *

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com) * Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* *
* $Id: opcodes.txt,v 1.25 2001/06/30 21:07:26 steve Exp $ * $Id: opcodes.txt,v 1.26 2001/07/19 04:40:55 steve Exp $
*/ */
@ -118,6 +118,12 @@ future to reschedule, and is >= 0. If the %delay is zero, then the
thread yields the processor for another thread, but will be resumed in thread yields the processor for another thread, but will be resumed in
the current time step. the current time step.
* %delayx <idx>
This is similar to the %delay opcode, except that the parameter
selects an index register, which contains the actual delay. This
supports run-time calculated delays.
* %disable <scope-label> * %disable <scope-label>
This instruction terminates threads that are part of a specific This instruction terminates threads that are part of a specific

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: vthread.cc,v 1.48 2001/07/04 04:57:10 steve Exp $" #ident "$Id: vthread.cc,v 1.49 2001/07/19 04:40:55 steve Exp $"
#endif #endif
# include "vthread.h" # include "vthread.h"
@ -539,6 +539,16 @@ bool of_DELAY(vthread_t thr, vvp_code_t cp)
return false; return false;
} }
bool of_DELAYX(vthread_t thr, vvp_code_t cp)
{
unsigned long delay;
assert(cp->number < 4);
delay = thr->index[cp->number];
schedule_vthread(thr, delay);
return false;
}
/* /*
* Implement the %disable instruction by scanning the target scope for * Implement the %disable instruction by scanning the target scope for
* all the target threads. Kill the target threads and wake up a * all the target threads. Kill the target threads and wake up a
@ -1281,6 +1291,9 @@ bool of_ZOMBIE(vthread_t thr, vvp_code_t)
/* /*
* $Log: vthread.cc,v $ * $Log: vthread.cc,v $
* Revision 1.49 2001/07/19 04:40:55 steve
* Add support for the delayx opcode.
*
* Revision 1.48 2001/07/04 04:57:10 steve * Revision 1.48 2001/07/04 04:57:10 steve
* Relax limit on behavioral subtraction. * Relax limit on behavioral subtraction.
* *