Carry the type of the scope (Stephan Boettcher)
This commit is contained in:
parent
98d71de50f
commit
42dab181cd
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vvp_scope.c,v 1.48 2001/10/09 02:28:44 steve Exp $"
|
||||
#ident "$Id: vvp_scope.c,v 1.49 2001/10/15 02:58:27 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -1134,18 +1134,26 @@ static void draw_mem_in_scope(ivl_memory_t net)
|
|||
int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
||||
{
|
||||
unsigned idx;
|
||||
const char *type;
|
||||
switch (ivl_scope_type(net)) {
|
||||
case IVL_SCT_MODULE: type = "module"; break;
|
||||
case IVL_SCT_FUNCTION: type = "function"; break;
|
||||
case IVL_SCT_TASK: type = "task"; break;
|
||||
case IVL_SCT_BEGIN: type = "begin"; break;
|
||||
case IVL_SCT_FORK: type = "fork"; break;
|
||||
default: type = "?"; assert(0);
|
||||
}
|
||||
|
||||
fprintf(vvp_out, "S_%s .scope %s, \"%s\"",
|
||||
vvp_mangle_id(ivl_scope_name(net)),
|
||||
type,
|
||||
vvp_mangle_name(ivl_scope_name(net)));
|
||||
if (parent) {
|
||||
fprintf(vvp_out, "S_%s .scope \"%s\"",
|
||||
vvp_mangle_id(ivl_scope_name(net)),
|
||||
vvp_mangle_name(ivl_scope_name(net)));
|
||||
fprintf(vvp_out, ", S_%s;\n",
|
||||
vvp_mangle_id(ivl_scope_name(parent)));
|
||||
}
|
||||
else
|
||||
fprintf(vvp_out, "S_%s .scope \"%s\";\n",
|
||||
vvp_mangle_id(ivl_scope_name(net)),
|
||||
vvp_mangle_name(ivl_scope_name(net)));
|
||||
fprintf(vvp_out, ";\n");
|
||||
|
||||
/* Scan the scope for logic devices. For each device, draw out
|
||||
a functor that connects pin 0 to the output, and the
|
||||
|
|
@ -1200,6 +1208,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
|
||||
/*
|
||||
* $Log: vvp_scope.c,v $
|
||||
* Revision 1.49 2001/10/15 02:58:27 steve
|
||||
* Carry the type of the scope (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.48 2001/10/09 02:28:44 steve
|
||||
* handle nmos and pmos devices.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: compile.h,v 1.32 2001/07/11 04:43:57 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.33 2001/10/15 02:58:27 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -183,7 +183,7 @@ extern void compile_codelabel(char*label);
|
|||
* The parser uses these functions to compile .scope statements.
|
||||
* The implementations of these live in the vpi_scope.cc file.
|
||||
*/
|
||||
extern void compile_scope_decl(char*lab, char*nam, char*par);
|
||||
extern void compile_scope_decl(char*typ, char*lab, char*nam, char*par);
|
||||
extern void compile_scope_recall(char*sym);
|
||||
|
||||
/*
|
||||
|
|
@ -204,6 +204,9 @@ extern void compile_net(char*label, char*name,
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.33 2001/10/15 02:58:27 steve
|
||||
* Carry the type of the scope (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.32 2001/07/11 04:43:57 steve
|
||||
* support postpone of $systask parameters. (Stephan Boettcher)
|
||||
*
|
||||
|
|
|
|||
13
vvp/parse.y
13
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: parse.y,v 1.36 2001/07/11 04:43:57 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.37 2001/10/15 02:58:27 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -252,11 +252,11 @@ statement
|
|||
/* Scope statements come in two forms. There are the scope
|
||||
declaration and the scope recall. */
|
||||
|
||||
| T_LABEL K_SCOPE T_STRING ';'
|
||||
{ compile_scope_decl($1, $3, 0); }
|
||||
| T_LABEL K_SCOPE T_SYMBOL ',' T_STRING ';'
|
||||
{ compile_scope_decl($1, $3, $5, 0); }
|
||||
|
||||
| T_LABEL K_SCOPE T_STRING ',' T_SYMBOL ';'
|
||||
{ compile_scope_decl($1, $3, $5); }
|
||||
| T_LABEL K_SCOPE T_SYMBOL ',' T_STRING ',' T_SYMBOL ';'
|
||||
{ compile_scope_decl($1, $3, $5, $7); }
|
||||
|
||||
| K_SCOPE T_SYMBOL ';'
|
||||
{ compile_scope_recall($2); }
|
||||
|
|
@ -504,6 +504,9 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.37 2001/10/15 02:58:27 steve
|
||||
* Carry the type of the scope (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.36 2001/07/11 04:43:57 steve
|
||||
* support postpone of $systask parameters. (Stephan Boettcher)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_scope.cc,v 1.8 2001/10/15 01:49:50 steve Exp $"
|
||||
#ident "$Id: vpi_scope.cc,v 1.9 2001/10/15 02:58:27 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compile.h"
|
||||
|
|
@ -36,8 +36,10 @@ static char* scope_get_str(int code, vpiHandle obj)
|
|||
char *n, *nn;
|
||||
|
||||
assert((obj->vpi_type->type_code == vpiModule)
|
||||
|| (obj->vpi_type->type_code == vpiFunction)
|
||||
|| (obj->vpi_type->type_code == vpiTask)
|
||||
|| (obj->vpi_type->type_code == vpiNamedBegin)
|
||||
|| (obj->vpi_type->type_code == vpiTask));
|
||||
|| (obj->vpi_type->type_code == vpiNamedFork));
|
||||
|
||||
switch (code) {
|
||||
case vpiFullName:
|
||||
|
|
@ -63,8 +65,10 @@ static char* scope_get_str(int code, vpiHandle obj)
|
|||
static vpiHandle scope_get_handle(int code, vpiHandle obj)
|
||||
{
|
||||
assert((obj->vpi_type->type_code == vpiModule)
|
||||
|| (obj->vpi_type->type_code == vpiFunction)
|
||||
|| (obj->vpi_type->type_code == vpiTask)
|
||||
|| (obj->vpi_type->type_code == vpiNamedBegin)
|
||||
|| (obj->vpi_type->type_code == vpiTask));
|
||||
|| (obj->vpi_type->type_code == vpiNamedFork));
|
||||
|
||||
struct __vpiScope*rfp = (struct __vpiScope*)obj;
|
||||
|
||||
|
|
@ -81,9 +85,10 @@ static vpiHandle module_iter(int code, vpiHandle obj)
|
|||
{
|
||||
struct __vpiScope*ref = (struct __vpiScope*)obj;
|
||||
assert((obj->vpi_type->type_code == vpiModule)
|
||||
|| (obj->vpi_type->type_code == vpiNamedBegin)
|
||||
|| (obj->vpi_type->type_code == vpiFunction)
|
||||
|| (obj->vpi_type->type_code == vpiTask)
|
||||
|| (obj->vpi_type->type_code == vpiFunction));
|
||||
|| (obj->vpi_type->type_code == vpiNamedBegin)
|
||||
|| (obj->vpi_type->type_code == vpiNamedFork));
|
||||
|
||||
switch (code) {
|
||||
case vpiInternalScope:
|
||||
|
|
@ -92,7 +97,7 @@ static vpiHandle module_iter(int code, vpiHandle obj)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_scope_rt = {
|
||||
static const struct __vpirt vpip_scope_module_rt = {
|
||||
vpiModule,
|
||||
0,
|
||||
scope_get_str,
|
||||
|
|
@ -102,6 +107,46 @@ static const struct __vpirt vpip_scope_rt = {
|
|||
module_iter
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_task_rt = {
|
||||
vpiTask,
|
||||
0,
|
||||
scope_get_str,
|
||||
0,
|
||||
0,
|
||||
scope_get_handle,
|
||||
module_iter
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_function_rt = {
|
||||
vpiFunction,
|
||||
0,
|
||||
scope_get_str,
|
||||
0,
|
||||
0,
|
||||
scope_get_handle,
|
||||
module_iter
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_begin_rt = {
|
||||
vpiNamedBegin,
|
||||
0,
|
||||
scope_get_str,
|
||||
0,
|
||||
0,
|
||||
scope_get_handle,
|
||||
module_iter
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_fork_rt = {
|
||||
vpiNamedFork,
|
||||
0,
|
||||
scope_get_str,
|
||||
0,
|
||||
0,
|
||||
scope_get_handle,
|
||||
module_iter
|
||||
};
|
||||
|
||||
static struct __vpiScope*current_scope = 0;
|
||||
|
||||
static void attach_to_scope_(struct __vpiScope*scope, vpiHandle obj)
|
||||
|
|
@ -125,10 +170,19 @@ static void attach_to_scope_(struct __vpiScope*scope, vpiHandle obj)
|
|||
* and within the addressed parent. The label is used as a key in the
|
||||
* symbol table and the name is used to construct the actual object.
|
||||
*/
|
||||
void compile_scope_decl(char*label, char*name, char*parent)
|
||||
void compile_scope_decl(char*label, char*type, char*name, char*parent)
|
||||
{
|
||||
struct __vpiScope*scope = new struct __vpiScope;
|
||||
scope->base.vpi_type = &vpip_scope_rt;
|
||||
|
||||
switch(type[2]) {
|
||||
case 'd': scope->base.vpi_type = &vpip_scope_module_rt; break;
|
||||
case 'n': scope->base.vpi_type = &vpip_scope_function_rt; break;
|
||||
case 's': scope->base.vpi_type = &vpip_scope_task_rt; break;
|
||||
case 'r': scope->base.vpi_type = &vpip_scope_fork_rt; break;
|
||||
case 'g': scope->base.vpi_type = &vpip_scope_begin_rt; break;
|
||||
default: scope->base.vpi_type = &vpip_scope_module_rt; assert(0);
|
||||
}
|
||||
|
||||
scope->name = name;
|
||||
scope->intern = 0;
|
||||
scope->nintern = 0;
|
||||
|
|
@ -170,6 +224,9 @@ void vpip_attach_to_current_scope(vpiHandle obj)
|
|||
|
||||
/*
|
||||
* $Log: vpi_scope.cc,v $
|
||||
* Revision 1.9 2001/10/15 02:58:27 steve
|
||||
* Carry the type of the scope (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.8 2001/10/15 01:49:50 steve
|
||||
* Support getting scope of scope, and scope of signals.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue