예제 #1
0
PLI_INT32 tf_isetrealdelay(double dly, void*obj)
{
      vpiHandle sys = (vpiHandle)obj;
      p_pli_data pli = vpi_get_userdata(sys);
      s_cb_data cb;
      s_vpi_time ti = {vpiSimTime};

      /* Scale delay to SimTime */
      ivl_u64_t delay = ((dly
			 / pow(10, tf_gettimeunit() - tf_gettimeprecision()))
			 + 0.5);
      ti.high = delay >> 32 & 0xffffffff;
      ti.low = delay & 0xffffffff;

      cb.reason = cbAfterDelay;
      cb.cb_rtn = callback;
      cb.obj = sys;
      cb.time = &ti;
      cb.user_data = (char *)pli;

      vpi_register_cb(&cb);

      if (pli_trace)
	    fprintf(pli_trace, "tf_isetrealdelay(%f, %p) --> %d\n",
		  dly, obj, 0);

      return 0;
}
예제 #2
0
static int
mytest(int ud, int reason)
{
    PLI_INT32 ht, lt;
    PLI_BYTE8 *cp;
    PLI_BYTE8 *inst = tf_getinstance();
    PLI_BYTE8 *name = tf_spname();

    (void)ud;  /* Parameter is not used. */
    (void)reason;  /* Parameter is not used. */

    io_printf("Module %s\n", name);

    lt = tf_gettime();
    io_printf("\ttf_gettime()\t\t\t-> %d\n", (int)lt);

    cp = tf_strgettime();
    io_printf("\ttf_strgettime()\t\t\t-> %s\n", cp);

    lt = tf_getlongtime(&ht);
    io_printf("\ttf_getlongtime()\t\t-> %d/%d\n", (int)ht, (int)lt);

    lt = tf_igetlongtime(&ht, inst);
    io_printf("\ttf_igetlongtime(inst)\t\t-> %d/%d\n", (int)ht, (int)lt);

    lt = tf_getlongsimtime(&ht);
    io_printf("\ttf_getlongsimtime()\t\t-> %d/%d\n", (int)ht, (int)lt);

    lt = tf_gettimeprecision();
    io_printf("\ttf_gettimeprecision()\t\t-> %d\n", (int)lt);

    lt = tf_igettimeprecision(inst);
    io_printf("\ttf_igettimeprecision(inst)\t-> %d\n", (int)lt);

    lt = tf_gettimeunit();
    io_printf("\ttf_gettimeunit()\t\t-> %d\n", (int)lt);

    lt = tf_igettimeunit(inst);
    io_printf("\ttf_gettimeunit(inst)\t\t-> %d\n", (int)lt);

    lt = tf_igettimeunit(0);
    io_printf("\ttf_gettimeunit(0)\t\t-> %d\n", (int)lt);

    return 0;
}