From a3813c006dff5220b22674d86006ffdfbe51b8da Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 11 Oct 2011 21:16:26 +0100 Subject: [PATCH] Corrected tf_getlongsimtime() to match behaviour of other simulators. The PLI tf_getlongsimtime() function is a non-standard function provided for compatibility with some commercial simulators. To match the behaviour of those simulators, it should return the raw simulation time, not a scaled time. --- libveriuser/getsimtime.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libveriuser/getsimtime.c b/libveriuser/getsimtime.c index 5791ac13a..866d17b31 100644 --- a/libveriuser/getsimtime.c +++ b/libveriuser/getsimtime.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2010 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2002-2011 Michael Ruff (mruff at chiaro.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -83,9 +83,21 @@ PLI_INT32 tf_getlongtime(PLI_INT32 *high) return tf_igetlongtime(high, 0); } -/* Alias for commercial simulators */ -PLI_INT32 tf_getlongsimtime(PLI_INT32 *high) \ - __attribute__ ((weak, alias ("tf_getlongtime"))); +/* + * This function is not defined in the IEE standard, but is provided for + * compatibility with other simulators. Make it a weak symbol just in + * case the user has defined their own function for this. + */ +PLI_INT32 tf_getlongsimtime(PLI_INT32 *high) __attribute__ ((weak)); +PLI_INT32 tf_getlongsimtime(PLI_INT32 *high) +{ + s_vpi_time timerec; + timerec.type = vpiSimTime; + vpi_get_time (0, &timerec); + + *high = timerec.high; + return timerec.low; +} void tf_scale_longdelay(void*obj, PLI_INT32 low, PLI_INT32 high, PLI_INT32 *alow, PLI_INT32 *ahigh)