static void show_this_item(struct vcd_info*info) { s_vpi_value value; PLI_INT32 type = vpi_get(vpiType, info->item); if (type == vpiRealVar) { value.format = vpiRealVal; vpi_get_value(info->item, &value); fstWriterEmitValueChange(dump_file, info->handle, &value.value.real); } else { value.format = vpiBinStrVal; vpi_get_value(info->item, &value); fstWriterEmitValueChange(dump_file, info->handle, value.value.str); } }
/* Dump values for a $dumpoff. */ static void show_this_item_x(struct vcd_info*info) { PLI_INT32 type = vpi_get(vpiType, info->item); if (type == vpiRealVar) { /* Some tools dump nothing here...? */ double mynan = strtod("NaN", NULL); fstWriterEmitValueChange(dump_file, info->handle, &mynan); } else if (type == vpiNamedEvent) { /* Do nothing for named events. */ } else { int siz = vpi_get(vpiSize, info->item); char *xmem = malloc(siz); memset(xmem, 'x', siz); fstWriterEmitValueChange(dump_file, info->handle, xmem); free(xmem); } }
static void fst_fmt_chars(tree_t decl, watch_t *w, fst_data_t *data) { const int nvals = data->size; char buf[nvals + 1]; rt_watch_string(w, data->type.map, buf, nvals + 1); if (likely(data->type.map != NULL)) fstWriterEmitValueChange(fst_ctx, data->handle, buf); else fstWriterEmitVariableLengthValueChange( fst_ctx, data->handle, buf, data->size); }
static void fst_fmt_int(tree_t decl, watch_t *w, fst_data_t *data) { uint64_t val; rt_watch_value(w, &val, 1, false); char buf[data->size + 1]; for (size_t i = 0; i < data->size; i++) buf[data->size - 1 - i] = (val & (1 << i)) ? '1' : '0'; buf[data->size] = '\0'; fstWriterEmitValueChange(fst_ctx, data->handle, buf); }