2 * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: delay.c,v 1.3 2003/06/17 16:55:07 steve Exp $"
28 static PLI_INT32
delay_callback(struct t_cb_data
*cb
)
30 vpi_printf("XXXX delay_callback called.\n");
34 int tf_isetdelay(PLI_INT32 delay
, void*ss
)
36 vpiHandle sys
= (vpiHandle
)ss
;
37 int unit
= vpi_get(vpiTimeUnit
, sys
);
38 int prec
= vpi_get(vpiTimePrecision
, 0);
44 fprintf(pli_trace
, "%s: tf_isetdelay(%d, ...)"
45 " <unit=%d, prec=%d>;\n",
46 vpi_get_str(vpiName
, sys
), delay
, unit
, prec
);
50 /* Convert the delay from the UNITS of the specified
51 task/function to the precision of the simulation. */
55 PLI_INT32 tmp
= delay
* 10;
61 /* Create a VPI callback to schedule the delay. */
66 cb
.reason
= cbAfterDelay
;
67 cb
.cb_rtn
= delay_callback
;
77 int tf_setdelay(PLI_INT32 delay
)
79 return tf_isetdelay(delay
, tf_getinstance());
84 * Revision 1.3 2003/06/17 16:55:07 steve
85 * 1) setlinebuf() for vpi_trace
86 * 2) Addes error checks for trace file opens
87 * 3) removes now extraneous flushes
88 * 4) fixes acc_next() bug
90 * Revision 1.2 2003/05/28 02:42:43 steve
93 * Revision 1.1 2003/05/18 00:16:35 steve
94 * Add PLI_TRACE tracing of PLI1 modules.
96 * Add tf_isetdelay and friends, and add
97 * callback return values for acc_vcl support.