mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-22 05:47:31 +02:00
Implement vpi_put_value() for named events (GitHub issue #158).
(cherry picked from commit 3de7c234f7)
This commit is contained in:
+11
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2012 Stephen Williams ([email protected])
|
||||
* Copyright (c) 2002-2017 Stephen Williams ([email protected])
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* 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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
+11
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2016 Stephen Williams ([email protected])
|
||||
* Copyright (c) 2008-2017 Stephen Williams ([email protected])
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* 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 __vpiScope*scope;
|
||||
struct __vpiSignal*signal;
|
||||
struct __vpiNamedEvent*event;
|
||||
|
||||
if (obj == 0)
|
||||
return vpip_get_time_precision();
|
||||
@@ -483,6 +484,11 @@ int vpip_time_units_from_handle(vpiHandle obj)
|
||||
scope = vpip_scope(signal);
|
||||
return scope->time_units;
|
||||
|
||||
case vpiNamedEvent:
|
||||
event = dynamic_cast<__vpiNamedEvent*>(obj);
|
||||
scope = event->get_scope();
|
||||
return scope->time_units;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "ERROR: vpip_time_units_from_handle called with "
|
||||
"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;
|
||||
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
|
||||
* data to keep it available until the event is actually run. */
|
||||
switch (put->value.format) {
|
||||
|
||||
+3
-1
@@ -1,7 +1,7 @@
|
||||
#ifndef IVL_vpi_priv_H
|
||||
#define IVL_vpi_priv_H
|
||||
/*
|
||||
* Copyright (c) 2001-2015 Stephen Williams ([email protected])
|
||||
* Copyright (c) 2001-2017 Stephen Williams ([email protected])
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
@@ -442,8 +442,10 @@ class __vpiNamedEvent : public __vpiHandle {
|
||||
__vpiNamedEvent(__vpiScope*scope, const char*name);
|
||||
~__vpiNamedEvent();
|
||||
int get_type_code(void) const;
|
||||
__vpiScope*get_scope(void) const { return scope_; }
|
||||
int vpi_get(int code);
|
||||
char* vpi_get_str(int code);
|
||||
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
||||
vpiHandle vpi_handle(int code);
|
||||
|
||||
inline void add_vpi_callback(__vpiCallback*cb)
|
||||
|
||||
Reference in New Issue
Block a user