Enhance vpi_handle_by_name to accept either a scope or a module.

It appears that other simulators allow the second argument to
vpi_handle_by_name to be either a scope or a module. Allowing
a module in addition to a scope significantly increases the
usability of this function.
This commit is contained in:
Cary R 2007-08-15 16:09:38 -07:00 committed by Stephen Williams
parent 951f9f2bbf
commit 6653202e91
1 changed files with 9 additions and 126 deletions

View File

@ -815,10 +815,16 @@ vpiHandle vpi_handle_by_name(const char *name, vpiHandle scope)
* traverse the hierarchy specified in name to find the leaf module
* and try finding it there.
*/
if (scope)
hand = vpi_handle(vpiModule, scope);
else
if (scope) {
/* Some implementations support either a module or a scope. */
if (vpi_get(vpiType, scope ) == vpiScope) {
hand = vpi_handle(vpiModule, scope);
} else {
hand = scope;
}
} else {
hand = find_scope(name, NULL, 0);
}
if (hand) {
/* remove hierarchical portion of name */
@ -891,126 +897,3 @@ extern "C" void vpi_control(PLI_INT32 operation, ...)
va_end(ap);
}
/*
* $Log: vpi_priv.cc,v $
* Revision 1.54 2007/04/18 01:57:07 steve
* Fix vpi_get_value vpiRealVal of signed constants.
*
* Revision 1.53 2007/04/12 04:45:52 steve
* Support for vpi_get_value of scaler values. (ravi@bluespec)
*
* Revision 1.52 2007/03/07 00:38:16 steve
* Lint fixes.
*
* Revision 1.51 2007/01/31 22:28:55 steve
* Fix missing check for thread bits width in ADDI
*
* Revision 1.50 2006/03/06 05:43:15 steve
* Cleanup vpi_const to use vec4 values.
*
* Revision 1.49 2005/12/05 21:19:55 steve
* Be more careful with double types.
*
* Revision 1.48 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.47 2005/06/02 16:02:11 steve
* Add support for notif0/1 gates.
* Make delay nodes support inertial delay.
* Add the %force/link instruction.
*
* Revision 1.46 2004/05/19 03:26:24 steve
* Support delayed/non-blocking assignment to reals and others.
*
* Revision 1.45 2004/02/18 17:52:00 steve
* PRototypes match the standard.
*
* Revision 1.44 2004/02/18 02:51:59 steve
* Fix type mismatches of various VPI functions.
*
* Revision 1.43 2003/06/25 04:04:19 steve
* Fix mingw portability problems.
*
* Revision 1.42 2003/06/22 04:19:26 steve
* vpi_handle diagnostic message.
*
* Revision 1.41 2003/06/17 16:55:08 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.40 2003/05/30 04:08:28 steve
* vpi_trace of vpi_free_object.
*
* Revision 1.39 2003/05/15 16:51:09 steve
* Arrange for mcd id=00_00_00_01 to go to stdout
* as well as a user specified log file, set log
* file to buffer lines.
*
* Add vpi_flush function, and clear up some cunfused
* return codes from other vpi functions.
*
* Adjust $display and vcd/lxt messages to use the
* standard output/log file.
*
* Revision 1.38 2003/05/15 01:24:46 steve
* Return all 64bits of time in vpi_get_time.
*
* Revision 1.37 2003/05/02 04:29:57 steve
* Add put_value with transport delay.
*
* Revision 1.36 2003/04/27 04:19:24 steve
* Support vpiScaledRealTime.
*
* Revision 1.35 2003/03/14 05:02:34 steve
* More detail in vpi tracing.
*
* Revision 1.34 2003/03/13 04:34:18 steve
* Add VPI_TRACE tracing of VPI calls.
* vpi_handle_by_name takes a const char*.
*
* Revision 1.33 2003/03/12 02:50:32 steve
* Add VPI tracing.
*
* Revision 1.32 2003/03/06 04:32:00 steve
* Use hashed name strings for identifiers.
*
* Revision 1.31 2003/02/21 03:40:35 steve
* Add vpiStop and interactive mode.
*
* Revision 1.30 2003/02/09 23:33:26 steve
* Spelling fixes.
*
* Revision 1.29 2003/02/02 01:40:24 steve
* Five vpi_free_object a default behavior.
*
* Revision 1.28 2003/01/10 19:02:21 steve
* Add missing vpi entry points.
*
* Revision 1.27 2003/01/10 03:06:32 steve
* Remove vpithunk, and move libvpi to vvp directory.
*
* Revision 1.26 2002/12/21 00:55:58 steve
* The $time system task returns the integer time
* scaled to the local units. Change the internal
* implementation of vpiSystemTime the $time functions
* to properly account for this. Also add $simtime
* to get the simulation time.
*
* Revision 1.25 2002/12/11 23:55:22 steve
* Add vpi_handle_by_name to the VPI interface,
* and bump the vpithunk magic number.
*
* Revision 1.24 2002/08/24 05:02:58 steve
* Fix = vs == error.
*
* Revision 1.23 2002/08/12 01:35:09 steve
* conditional ident string using autoconfig.
*
* Revision 1.22 2002/07/19 01:57:26 steve
* Add vpi_chk_error and vpi_control functions.
*
* Revision 1.21 2002/07/19 01:12:50 steve
* vpi_iterate returns 0 on error.
*/