Support getting scope of scope, and scope of signals.

This commit is contained in:
steve 2001-10-15 01:49:50 +00:00
parent a7054a91e5
commit 706f2ffc89
3 changed files with 65 additions and 6 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: vpi_priv.h,v 1.22 2001/08/08 01:05:06 steve Exp $" #ident "$Id: vpi_priv.h,v 1.23 2001/10/15 01:49:50 steve Exp $"
#endif #endif
# include "vpi_user.h" # include "vpi_user.h"
@ -81,6 +81,7 @@ extern vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args);
*/ */
struct __vpiScope { struct __vpiScope {
struct __vpiHandle base; struct __vpiHandle base;
struct __vpiScope *scope;
/* The scope has a name. */ /* The scope has a name. */
char*name; char*name;
/* Keep an array of internal scope items. */ /* Keep an array of internal scope items. */
@ -258,6 +259,9 @@ extern void vpip_set_time_precision(int pres);
/* /*
* $Log: vpi_priv.h,v $ * $Log: vpi_priv.h,v $
* Revision 1.23 2001/10/15 01:49:50 steve
* Support getting scope of scope, and scope of signals.
*
* Revision 1.22 2001/08/08 01:05:06 steve * Revision 1.22 2001/08/08 01:05:06 steve
* Initial implementation of vvp_fvectors. * Initial implementation of vvp_fvectors.
* (Stephan Boettcher) * (Stephan Boettcher)

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: vpi_scope.cc,v 1.7 2001/09/15 18:27:05 steve Exp $" #ident "$Id: vpi_scope.cc,v 1.8 2001/10/15 01:49:50 steve Exp $"
#endif #endif
# include "compile.h" # include "compile.h"
@ -33,6 +33,7 @@ static char* scope_get_str(int code, vpiHandle obj)
{ {
struct __vpiScope*ref = (struct __vpiScope*)obj; struct __vpiScope*ref = (struct __vpiScope*)obj;
char *n, *nn;
assert((obj->vpi_type->type_code == vpiModule) assert((obj->vpi_type->type_code == vpiModule)
|| (obj->vpi_type->type_code == vpiNamedBegin) || (obj->vpi_type->type_code == vpiNamedBegin)
@ -41,12 +42,41 @@ static char* scope_get_str(int code, vpiHandle obj)
switch (code) { switch (code) {
case vpiFullName: case vpiFullName:
return ref->name; return ref->name;
case vpiName:
nn = n = ref->name;
while (*n)
if (*n=='\\' && *++n)
++n;
else if (*n=='.')
nn = ++n;
else
++n;
return nn;
default: default:
assert(0); assert(0);
return 0; return 0;
} }
} }
static vpiHandle scope_get_handle(int code, vpiHandle obj)
{
assert((obj->vpi_type->type_code == vpiModule)
|| (obj->vpi_type->type_code == vpiNamedBegin)
|| (obj->vpi_type->type_code == vpiTask));
struct __vpiScope*rfp = (struct __vpiScope*)obj;
switch (code) {
case vpiScope:
return &rfp->scope->base;
}
return 0;
}
static vpiHandle module_iter(int code, vpiHandle obj) static vpiHandle module_iter(int code, vpiHandle obj)
{ {
struct __vpiScope*ref = (struct __vpiScope*)obj; struct __vpiScope*ref = (struct __vpiScope*)obj;
@ -68,7 +98,7 @@ static const struct __vpirt vpip_scope_rt = {
scope_get_str, scope_get_str,
0, 0,
0, 0,
0, scope_get_handle,
module_iter module_iter
}; };
@ -115,6 +145,9 @@ void compile_scope_decl(char*label, char*name, char*parent)
assert(obj); assert(obj);
struct __vpiScope*sp = (struct __vpiScope*) obj; struct __vpiScope*sp = (struct __vpiScope*) obj;
attach_to_scope_(sp, &scope->base); attach_to_scope_(sp, &scope->base);
scope->scope = (struct __vpiScope*)obj;
} else {
scope->scope = 0x0;
} }
} }
@ -137,6 +170,9 @@ void vpip_attach_to_current_scope(vpiHandle obj)
/* /*
* $Log: vpi_scope.cc,v $ * $Log: vpi_scope.cc,v $
* Revision 1.8 2001/10/15 01:49:50 steve
* Support getting scope of scope, and scope of signals.
*
* Revision 1.7 2001/09/15 18:27:05 steve * Revision 1.7 2001/09/15 18:27:05 steve
* Make configure detect malloc.h * Make configure detect malloc.h
* *

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: vpi_signal.cc,v 1.25 2001/09/30 05:18:46 steve Exp $" #ident "$Id: vpi_signal.cc,v 1.26 2001/10/15 01:49:50 steve Exp $"
#endif #endif
/* /*
@ -106,6 +106,22 @@ static char* signal_get_str(int code, vpiHandle ref)
return 0; return 0;
} }
static vpiHandle signal_get_handle(int code, vpiHandle ref)
{
assert((ref->vpi_type->type_code==vpiNet)
|| (ref->vpi_type->type_code==vpiReg));
struct __vpiSignal*rfp = (struct __vpiSignal*)ref;
switch (code) {
case vpiScope:
return &rfp->scope->base;
}
return 0;
}
static char buf[4096]; static char buf[4096];
static void signal_vpiDecStrVal(struct __vpiSignal*rfp, s_vpi_value*vp) static void signal_vpiDecStrVal(struct __vpiSignal*rfp, s_vpi_value*vp)
@ -455,7 +471,7 @@ static const struct __vpirt vpip_reg_rt = {
signal_get_str, signal_get_str,
signal_get_value, signal_get_value,
signal_put_value, signal_put_value,
0, signal_get_handle,
0 0
}; };
@ -465,7 +481,7 @@ static const struct __vpirt vpip_net_rt = {
signal_get_str, signal_get_str,
signal_get_value, signal_get_value,
signal_put_value, signal_put_value,
0, signal_get_handle,
0 0
}; };
@ -505,6 +521,9 @@ vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag,
/* /*
* $Log: vpi_signal.cc,v $ * $Log: vpi_signal.cc,v $
* Revision 1.26 2001/10/15 01:49:50 steve
* Support getting scope of scope, and scope of signals.
*
* Revision 1.25 2001/09/30 05:18:46 steve * Revision 1.25 2001/09/30 05:18:46 steve
* Reduce VCD output by removing duplicates. (Stephan Boettcher) * Reduce VCD output by removing duplicates. (Stephan Boettcher)
* *