static PLI_INT32 sys_dumpvars_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) { vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle item; s_vpi_value value; unsigned depth = 0; (void)name; /* Parameter is not used. */ if (dump_file == 0) { open_dumpfile(callh); if (dump_file == 0) { if (argv) vpi_free_object(argv); return 0; } } if (install_dumpvars_callback()) { if (argv) vpi_free_object(argv); return 0; } /* Get the depth if it exists. */ if (argv) { value.format = vpiIntVal; vpi_get_value(vpi_scan(argv), &value); depth = value.value.integer; } if (!depth) depth = 10000; /* This dumps all the modules in the design if none are given. */ if (!argv || !(item = vpi_scan(argv))) { argv = vpi_iterate(vpiModule, 0x0); assert(argv); /* There must be at least one top level module. */ item = vpi_scan(argv); } for ( ; item; item = vpi_scan(argv)) { int dep = draw_scope(item); scan_item(depth, item, 0); /* The scope list must be sorted after we scan an item. */ vcd_names_sort(&lxt_tab); while (dep--) pop_scope(); } /* Most effective compression. */ if (lxm_optimum_mode == LXM_SPACE) { lt_set_no_interlace(dump_file); } return 0; }
static int sys_dumpvars_calltf(char*name) { if (dump_file == 0) { open_dumpfile("dumpfile.vcd"); if (dump_file == 0) return 0; } return 0; }
static int sys_dumpfile_calltf(char*name) { char*path; vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); vpiHandle item; if (argv && (item = vpi_scan(argv))) { s_vpi_value value; if (vpi_get(vpiType, item) != vpiConstant || vpi_get(vpiConstType, item) != vpiStringConst) { vpi_mcd_printf(6, "VCD Error:" " %s parameter must be a string constant\n", name); return 0; } value.format = vpiStringVal; vpi_get_value(item, &value); path = strdup(value.value.str); vpi_free_object(argv); } else { path = strdup("dumpfile.vcd"); } if (dump_file) { fclose(dump_file); dump_file = 0; } assert(dump_file == 0); open_dumpfile(path); free(path); return 0; }
static int sys_dumpvars_calltf(char*name) { unsigned depth; s_vpi_value value; vpiHandle item = 0; vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv; if (dump_file == 0) { open_dumpfile(); if (dump_file == 0) return 0; } if (install_dumpvars_callback()) { return 0; } argv = vpi_iterate(vpiArgument, sys); depth = 0; if (argv && (item = vpi_scan(argv))) switch (vpi_get(vpiType, item)) { case vpiConstant: case vpiNet: case vpiReg: case vpiIntegerVar: case vpiMemoryWord: value.format = vpiIntVal; vpi_get_value(item, &value); depth = value.value.integer; break; } if (!depth) depth = 10000; if (!argv) { // $dumpvars; // search for the toplevel module vpiHandle parent = vpi_handle(vpiScope, sys); while (parent) { item = parent; parent = vpi_handle(vpiScope, item); } } else if (!item || !(item = vpi_scan(argv))) { // $dumpvars(level); // $dumpvars(); // dump the current scope item = vpi_handle(vpiScope, sys); argv = 0x0; } for ( ; item; item = argv ? vpi_scan(argv) : 0x0) { int dep = draw_scope(item); vcd_names_sort(&vcd_tab); scan_item(depth, item, 0); while (dep--) { fprintf(dump_file, "$upscope $end\n"); } } return 0; }
void tty_debug() { char filename[256]; if( tty_debug_flag == 0 ) { return; } /* File for dumping adaptive codebook gain */ open_dumpfile(&acbgain_fp, "acbgain.pcm"); /* File for dumping decoder's adaptive codebook */ open_dumpfile(&dec_acbk_fp, "dec_acbk.pcm"); /* File for dumping decoder's fixed codebook */ open_dumpfile(&dec_fcbk_fp, "dec_fcbk.pcm"); /* File for dumping dits */ open_dumpfile(&dit_fp, "dit.pcm"); /* File for dumping encoder's fixed codebook */ open_dumpfile(&enc_fcbk_fp, "enc_fcbk.pcm"); /* File for dumping fixed codebook gain */ open_dumpfile(&fcbgain_fp,"fcbgain.pcm"); /* File for dumping pitch lag */ open_dumpfile(&lag_fp,"lag.pcm"); /* File for dumping pitch lag */ open_dumpfile(&pow_fp,"pow.pcm"); /* File for dumping pitch lag */ open_dumpfile(&pow01_fp,"pow01.pcm"); /* File for dumping rate info */ open_dumpfile(&rate_fp,"rate.pcm"); /* File for dumping text */ if( debugfp != NULL ) { sprintf(filename,"%s\\debug.txt",DUMP_DIR); fprintf(stderr,"Opening file %s\n",filename); if( (debugfp=fopen(filename,"w")) == NULL ) { fprintf(stderr,"debug.c: Error opening %s\n", filename ); exit(1); } } /* File for dumping rate */ open_dumpfile(&tempfp,"temp.pcm"); /* File for dumping rate */ open_dumpfile(&temp2fp,"temp2.pcm"); } /* end debug() */
static PLI_INT32 sys_dumpvars_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) { vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle item; s_vpi_value value; unsigned depth = 0; (void)name; /* Parameter is not used. */ if (dump_file == 0) { open_dumpfile(callh); if (dump_file == 0) { if (argv) vpi_free_object(argv); return 0; } } if (install_dumpvars_callback()) { if (argv) vpi_free_object(argv); return 0; } /* Get the depth if it exists. */ if (argv) { value.format = vpiIntVal; vpi_get_value(vpi_scan(argv), &value); depth = value.value.integer; } if (!depth) depth = 10000; /* This dumps all the modules in the design if none are given. */ if (!argv || !(item = vpi_scan(argv))) { argv = vpi_iterate(vpiModule, 0x0); assert(argv); /* There must be at least one top level module. */ item = vpi_scan(argv); } for ( ; item; item = vpi_scan(argv)) { char *scname; const char *fullname; int add_var = 0; int dep; PLI_INT32 item_type = vpi_get(vpiType, item); /* If this is a signal make sure it has not already * been included. */ switch (item_type) { case vpiIntegerVar: case vpiBitVar: case vpiByteVar: case vpiShortIntVar: case vpiIntVar: case vpiLongIntVar: case vpiMemoryWord: case vpiNamedEvent: case vpiNet: case vpiParameter: case vpiRealVar: case vpiReg: case vpiTimeVar: /* Warn if the variables scope (which includes the * variable) or the variable itself was already * included. A scope does not automatically include * memory words so do not check the scope for them. */ scname = strdup(vpi_get_str(vpiFullName, vpi_handle(vpiScope, item))); fullname = vpi_get_str(vpiFullName, item); if (((item_type != vpiMemoryWord) && vcd_names_search(&fst_tab, scname)) || vcd_names_search(&fst_var, fullname)) { vpi_printf("FST warning: skipping signal %s, " "it was previously included.\n", fullname); free(scname); continue; } else { add_var = 1; } free(scname); } dep = draw_scope(item, callh); scan_item(depth, item, 0); /* The scope list must be sorted after we scan an item. */ vcd_names_sort(&fst_tab); while (dep--) fstWriterSetUpscope(dump_file); /* Add this signal to the variable list so we can verify it * is not included twice. This must be done after it has * been added */ if (add_var) { vcd_names_add(&fst_var, vpi_get_str(vpiFullName, item)); vcd_names_sort(&fst_var); } } return 0; }