Add $push flag for threads.
This commit is contained in:
parent
f495c75faf
commit
59c5759fdf
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* $Id: README.txt,v 1.44 2003/04/11 05:15:38 steve Exp $
|
* $Id: README.txt,v 1.45 2003/09/04 20:26:30 steve Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VVP SIMULATION ENGINE
|
VVP SIMULATION ENGINE
|
||||||
|
|
@ -537,13 +537,22 @@ Thread statements create the initial threads for a simulation. These
|
||||||
represent the initial and always blocks, and possibly other causes to
|
represent the initial and always blocks, and possibly other causes to
|
||||||
create threads at startup.
|
create threads at startup.
|
||||||
|
|
||||||
.thread <symbol>
|
.thread <symbol> [, <flag>]
|
||||||
|
|
||||||
This statement creates a thread with a starting address at the
|
This statement creates a thread with a starting address at the
|
||||||
instruction given by <symbol>.
|
instruction given by <symbol>. When the simulation starts, a thread is
|
||||||
|
created for the .thread statement, and it starts at the <symbol>
|
||||||
|
addressed instruction.
|
||||||
|
|
||||||
|
The <flag> modifies the creation/execution behavior of the
|
||||||
|
thread. Supported flags are:
|
||||||
|
|
||||||
THREADS IN GENERAL:
|
$push -- Cause the thread to be pushed in the scheduler. This
|
||||||
|
only effects startup (time 0) by arranging for pushed
|
||||||
|
threads to be started before non-pushed threads. This
|
||||||
|
is useful for resolving time-0 races.
|
||||||
|
|
||||||
|
* Threads in general
|
||||||
|
|
||||||
Thread statements create the initial threads of a design. These
|
Thread statements create the initial threads of a design. These
|
||||||
include the ``initial'' and ``always'' statements of the original
|
include the ``initial'' and ``always'' statements of the original
|
||||||
|
|
@ -575,7 +584,7 @@ parent, and %end in the child. Without this proper matching, the
|
||||||
hierarchical relationships can get confused. The behavior of erroneous
|
hierarchical relationships can get confused. The behavior of erroneous
|
||||||
code is undefined.
|
code is undefined.
|
||||||
|
|
||||||
THREADS AND SCOPES:
|
* Threads and scopes
|
||||||
|
|
||||||
The Verilog ``disable'' statement deserves some special mention
|
The Verilog ``disable'' statement deserves some special mention
|
||||||
because of how it interacts with threads. In particular, threads
|
because of how it interacts with threads. In particular, threads
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: compile.cc,v 1.169 2003/07/30 01:13:28 steve Exp $"
|
#ident "$Id: compile.cc,v 1.170 2003/09/04 20:26:31 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "arith.h"
|
# include "arith.h"
|
||||||
|
|
@ -1456,8 +1456,10 @@ void compile_vpi_func_call(char*label, char*name,
|
||||||
* with the start address referenced by the program symbol passed to
|
* with the start address referenced by the program symbol passed to
|
||||||
* me.
|
* me.
|
||||||
*/
|
*/
|
||||||
void compile_thread(char*start_sym)
|
void compile_thread(char*start_sym, char*flag)
|
||||||
{
|
{
|
||||||
|
bool push_flag = false;
|
||||||
|
|
||||||
symbol_value_t tmp = sym_get_value(sym_codespace, start_sym);
|
symbol_value_t tmp = sym_get_value(sym_codespace, start_sym);
|
||||||
vvp_code_t pc = reinterpret_cast<vvp_code_t>(tmp.ptr);
|
vvp_code_t pc = reinterpret_cast<vvp_code_t>(tmp.ptr);
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
|
|
@ -1465,9 +1467,15 @@ void compile_thread(char*start_sym)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flag && (strcmp(flag,"$push") == 0))
|
||||||
|
push_flag = true;
|
||||||
|
|
||||||
vthread_t thr = vthread_new(pc, vpip_peek_current_scope());
|
vthread_t thr = vthread_new(pc, vpip_peek_current_scope());
|
||||||
schedule_vthread(thr, 0);
|
schedule_vthread(thr, 0, push_flag);
|
||||||
|
|
||||||
free(start_sym);
|
free(start_sym);
|
||||||
|
if (flag != 0)
|
||||||
|
free(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1539,6 +1547,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.cc,v $
|
* $Log: compile.cc,v $
|
||||||
|
* Revision 1.170 2003/09/04 20:26:31 steve
|
||||||
|
* Add $push flag for threads.
|
||||||
|
*
|
||||||
* Revision 1.169 2003/07/30 01:13:28 steve
|
* Revision 1.169 2003/07/30 01:13:28 steve
|
||||||
* Add support for triand and trior.
|
* Add support for triand and trior.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: compile.h,v 1.52 2003/05/29 02:21:45 steve Exp $"
|
#ident "$Id: compile.h,v 1.53 2003/09/04 20:26:31 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
|
@ -250,7 +250,7 @@ extern void compile_scope_recall(char*sym);
|
||||||
* The parser uses this function to declare a thread. The start_sym is
|
* The parser uses this function to declare a thread. The start_sym is
|
||||||
* the start instruction, and must already be defined.
|
* the start instruction, and must already be defined.
|
||||||
*/
|
*/
|
||||||
extern void compile_thread(char*start_sym);
|
extern void compile_thread(char*start_sym, char*flag);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is called to create a var vector with the given name.
|
* This function is called to create a var vector with the given name.
|
||||||
|
|
@ -264,6 +264,9 @@ extern void compile_net(char*label, char*name,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.h,v $
|
* $Log: compile.h,v $
|
||||||
|
* Revision 1.53 2003/09/04 20:26:31 steve
|
||||||
|
* Add $push flag for threads.
|
||||||
|
*
|
||||||
* Revision 1.52 2003/05/29 02:21:45 steve
|
* Revision 1.52 2003/05/29 02:21:45 steve
|
||||||
* Implement acc_fetch_defname and its infrastructure in vvp.
|
* Implement acc_fetch_defname and its infrastructure in vvp.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
13
vvp/parse.y
13
vvp/parse.y
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: parse.y,v 1.55 2003/08/22 23:14:27 steve Exp $"
|
#ident "$Id: parse.y,v 1.56 2003/09/04 20:26:31 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -345,10 +345,14 @@ statement
|
||||||
{ compile_timescale(-$3); }
|
{ compile_timescale(-$3); }
|
||||||
|
|
||||||
/* Thread statements declare a thread with its starting address. The
|
/* Thread statements declare a thread with its starting address. The
|
||||||
starting address must already be defined. */
|
starting address must already be defined. The .thread statement
|
||||||
|
may also take an optional flag word. */
|
||||||
|
|
||||||
| K_THREAD T_SYMBOL ';'
|
| K_THREAD T_SYMBOL ';'
|
||||||
{ compile_thread($2); }
|
{ compile_thread($2, 0); }
|
||||||
|
|
||||||
|
| K_THREAD T_SYMBOL ',' T_SYMBOL ';'
|
||||||
|
{ compile_thread($2, $4); }
|
||||||
|
|
||||||
/* Var statements declare a bit of a variable. This also implicitly
|
/* Var statements declare a bit of a variable. This also implicitly
|
||||||
creates a functor with the same name that acts as the output of
|
creates a functor with the same name that acts as the output of
|
||||||
|
|
@ -613,6 +617,9 @@ int compile_design(const char*path)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: parse.y,v $
|
* $Log: parse.y,v $
|
||||||
|
* Revision 1.56 2003/09/04 20:26:31 steve
|
||||||
|
* Add $push flag for threads.
|
||||||
|
*
|
||||||
* Revision 1.55 2003/08/22 23:14:27 steve
|
* Revision 1.55 2003/08/22 23:14:27 steve
|
||||||
* Preserve variable ranges all the way to the vpi.
|
* Preserve variable ranges all the way to the vpi.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue