From 36814b768197df492eb61726cfc48caece732c16 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 22 Oct 2013 22:02:53 -0400 Subject: [PATCH] Support vpi_get_time, bug688. --- Changes | 2 ++ include/verilated_vpi.h | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 397069f58..e6d60ea1a 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Support vpi_get of vpiSuppressVal, bug687. [Varun Koyyalagunta] +**** Support vpi_get_time, bug688. [Varun Koyyalagunta] + **** Fix evaluation of chained parameter functions, bug684. [Ted Campbell] **** Fix multiple VPI variable callbacks, bug679. [Rich Porter] diff --git a/include/verilated_vpi.h b/include/verilated_vpi.h index e2d0a77b6..830edb40a 100644 --- a/include/verilated_vpi.h +++ b/include/verilated_vpi.h @@ -1308,7 +1308,21 @@ void vpi_put_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, // time processing void vpi_get_time(vpiHandle object, p_vpi_time time_p) { - _VL_VPI_UNIMP(); return; + if (VL_UNLIKELY(!time_p)) { + _VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_get_time with NULL value pointer"); + return; + } + if (time_p->type == vpiSimTime) { + QData qtime = VL_TIME_Q(); + IData itime[2]; + VL_SET_WQ(itime, qtime); + time_p->low = itime[0]; + time_p->high = itime[1]; + return; + } + _VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported type (%d)", + VL_FUNC, time_p->type); + return; } // I/O routines