Implement vpi_put_value() for named events (GitHub issue #158).
This commit is contained in:
parent
8a5cbd4415
commit
3de7c234f7
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2012 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2002-2017 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -63,6 +63,16 @@ char* __vpiNamedEvent::vpi_get_str(int code)
|
||||||
return generic_get_str(code, scope_, name_, NULL);
|
return generic_get_str(code, scope_, name_, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vpiHandle __vpiNamedEvent::vpi_put_value(p_vpi_value, int)
|
||||||
|
{
|
||||||
|
// p_vpi_value may be NULL, and an event doesn't care
|
||||||
|
// what the value is
|
||||||
|
vvp_vector4_t val;
|
||||||
|
vvp_net_ptr_t dest(funct, 0);
|
||||||
|
vvp_send_vec4(dest, val, vthread_get_wt_context());
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
vpiHandle __vpiNamedEvent::vpi_handle(int code)
|
vpiHandle __vpiNamedEvent::vpi_handle(int code)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2016 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2008-2017 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -464,6 +464,7 @@ int vpip_time_units_from_handle(vpiHandle obj)
|
||||||
struct __vpiSysTaskCall*task;
|
struct __vpiSysTaskCall*task;
|
||||||
__vpiScope*scope;
|
__vpiScope*scope;
|
||||||
struct __vpiSignal*signal;
|
struct __vpiSignal*signal;
|
||||||
|
struct __vpiNamedEvent*event;
|
||||||
|
|
||||||
if (obj == 0)
|
if (obj == 0)
|
||||||
return vpip_get_time_precision();
|
return vpip_get_time_precision();
|
||||||
|
|
@ -483,6 +484,11 @@ int vpip_time_units_from_handle(vpiHandle obj)
|
||||||
scope = vpip_scope(signal);
|
scope = vpip_scope(signal);
|
||||||
return scope->time_units;
|
return scope->time_units;
|
||||||
|
|
||||||
|
case vpiNamedEvent:
|
||||||
|
event = dynamic_cast<__vpiNamedEvent*>(obj);
|
||||||
|
scope = event->get_scope();
|
||||||
|
return scope->time_units;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "ERROR: vpip_time_units_from_handle called with "
|
fprintf(stderr, "ERROR: vpip_time_units_from_handle called with "
|
||||||
"object handle type=%u\n", obj->get_type_code());
|
"object handle type=%u\n", obj->get_type_code());
|
||||||
|
|
@ -1104,7 +1110,10 @@ vpiHandle vpi_put_value(vpiHandle obj, s_vpi_value*vp,
|
||||||
|
|
||||||
vpip_put_value_event*put = new vpip_put_value_event;
|
vpip_put_value_event*put = new vpip_put_value_event;
|
||||||
put->handle = obj;
|
put->handle = obj;
|
||||||
put->value = *vp;
|
if (!dynamic_cast<__vpiNamedEvent*>(obj)) {
|
||||||
|
assert(vp);
|
||||||
|
put->value = *vp;
|
||||||
|
}
|
||||||
/* Since this is a scheduled put event we must copy any pointer
|
/* Since this is a scheduled put event we must copy any pointer
|
||||||
* data to keep it available until the event is actually run. */
|
* data to keep it available until the event is actually run. */
|
||||||
switch (put->value.format) {
|
switch (put->value.format) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_vpi_priv_H
|
#ifndef IVL_vpi_priv_H
|
||||||
#define IVL_vpi_priv_H
|
#define IVL_vpi_priv_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch)
|
* Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -479,8 +479,10 @@ class __vpiNamedEvent : public __vpiHandle {
|
||||||
__vpiNamedEvent(__vpiScope*scope, const char*name);
|
__vpiNamedEvent(__vpiScope*scope, const char*name);
|
||||||
~__vpiNamedEvent();
|
~__vpiNamedEvent();
|
||||||
int get_type_code(void) const;
|
int get_type_code(void) const;
|
||||||
|
__vpiScope*get_scope(void) const { return scope_; }
|
||||||
int vpi_get(int code);
|
int vpi_get(int code);
|
||||||
char* vpi_get_str(int code);
|
char* vpi_get_str(int code);
|
||||||
|
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
||||||
vpiHandle vpi_handle(int code);
|
vpiHandle vpi_handle(int code);
|
||||||
|
|
||||||
inline void add_vpi_callback(__vpiCallback*cb)
|
inline void add_vpi_callback(__vpiCallback*cb)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue