/************************************************* lxt2_init - Open lxt file and enable collection ************************************************/ static void lxt2_init() { char* filename; if( lxt.inited ) { tf_error( "recording has alreay begun" ); tf_dofinish(); return; } if( lxt.filename ) { filename = lxt.filename; } else if( lxt.design ) { filename = (char*)malloc( strlen(lxt.design)+4+1 ); if( !filename ) { tf_error( "could not allocate memory" ); tf_dofinish(); return; } sprintf( filename, "%s.lxt", lxt.design ); lxt.filename = filename; } else { char* top = acc_fetch_name( acc_next_topmod(null) ); filename = (char*)malloc( strlen(top)+3+1 ); sprintf( filename, "%s.lxt", top ); lxt.filename = filename; } lxt.t = lxt2_wr_init( filename ); #if DEBUG io_printf( "lxt2_init: %p\n", lxt.t ); #endif if( !lxt.t ) { tf_error( "could not create file '%s'", filename ); tf_dofinish(); return; } lxt2_wr_set_timescale( lxt.t, acc_fetch_precision() ); if( lxt.compress ) { lxt2_wr_set_compression_depth(lxt.t, 9); lxt2_wr_set_partial_off(lxt.t); } else { lxt2_wr_set_compression_depth(lxt.t, 4); lxt2_wr_set_partial_on(lxt.t, 1); } lxt2_wr_set_break_size(lxt.t, lxt.incSize); lxt.inited = 1; lxt.enabled = 1; lxt.updateList = 0; lxt.eventList = 0; lxt.hunk = 0; lxt2_wr_set_initial_value( lxt.t, 'x' ); lxt2_wr_symbol_bracket_stripping( lxt.t, 1 ); lxt2_timemarker(); }
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); while (dep--) pop_scope(); } /* Most effective compression. */ if (lxm_optimum_mode == LXM_SPACE) { lxt2_wr_set_compression_depth(dump_file, 9); lxt2_wr_set_partial_off(dump_file); } return 0; }