/* * variable value change call back routine */ int var_prt_vclchg(p_vc_record vcp) { /* unsigned long long now, chgtim; */ int otyp, ltime, htime; handle net; char s1[1024], s2[1024], s3[1024]; /* current time */ ltime = tf_getlongsimtime(&htime); /* -- now = ((unsigned long long) ((unsigned long) htime)) << 32 | ((unsigned long long) ((unsigned long) ltime)); -* vc record time *- chgtim = ((unsigned long long) ((unsigned long) vcp->vc_hightime)) << 32 | ((unsigned long long) ((unsigned long) vcp->vc_lowtime)); -- */ /* net handle assigned to user data field */ net = (handle) vcp->user_data; otyp = acc_fetch_type(net); if (vcp->vc_reason != event_value_change) { /* these do not have value, i.e. get va8ue return NULL with error */ if (otyp == accPort || otyp == accPortBit || otyp == accTerminal) { sprintf(s1, "obj=%s", acc_fetch_type_str(otyp)); } else strcpy(s1, acc_fetch_value(net, "%b", NULL)); } switch (vcp->vc_reason) { case logic_value_change: sprintf(s2, "scalar=%u(%s)", (unsigned) vcp->out_value.logic_value, s1); break; case sregister_value_change: sprintf(s2, "sr-scalar=%u(%s)", (unsigned) vcp->out_value.logic_value, s1); break; case real_value_change: case realtime_value_change: sprintf(s2, "**error**"); break; case event_value_change: strcpy(s2, "**event**"); break; default: sprintf(s2, "vector=%s", s1); } /* -- io_printf("--> now %uL (chg time %uL): %s=%s\n", now, chgtim, -- */ if (otyp != accTerminal) strcpy(s3, acc_fetch_fullname(net)); else strcpy(s3, "**terminal**"); io_printf("--> now %d (chg time %d): %s=%s\n", ltime, vcp->vc_lowtime, s3, s2); return(0); }
/* * wire strength change value change call back routine */ int wire_prt_vclchg(p_vc_record vcp) { /* unsigned long long now, chgtim; */ int typ, ltime, htime; handle net; char s1[1024], s2[1024], s3[1024]; /* current time */ ltime = tf_getlongsimtime(&htime); /* --- now = ((unsigned long long) ((unsigned long) htime)) << 32 | ((unsigned long long) ((unsigned long) ltime)); -* vc record time *- chgtim = ((unsigned long long) ((unsigned long) vcp->vc_hightime)) << 32 | ((unsigned long long) ((unsigned long) vcp->vc_lowtime)); --- */ /* net handle assigned to user data field */ net = (handle) vcp->user_data; /* build strength value string */ sprintf(s1, "<%d, %d>=%d", (int) vcp->out_value.strengths_s.strength1, (int) vcp->out_value.strengths_s.strength2, (int) vcp->out_value.strengths_s.logic_value); /* also get value as internal strength %v string */ strcpy(s2, acc_fetch_value(net, "%v", NULL)); if (vcp->vc_reason != strength_value_change) { io_printf("*** ERROR: wire change reason %d - strength change expected\n", vcp->vc_reason); } /* --- io_printf("--> now %uL (chg time %uL): %s=%s(%s)\n", now, chgtim, -- */ /* terminals do not have names */ typ = acc_fetch_type(net); if (typ != accTerminal) strcpy(s3, acc_fetch_fullname(net)); else strcpy(s3, "**terminal**"); io_printf("--> now %d (chg time %d): %s=%s(%s)\n", ltime, vcp->vc_lowtime, s3, s2, s1); return(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; }