Make the dumpers match better (VCD, LXT, LXT2).

This patch removes some of the unneeded differences in the
various dumper routines. This is the start of a complete
refactoring, but the first task is to make them as common
as possible and this is the start of that.
This commit is contained in:
Cary R 2009-06-16 13:55:30 -07:00 committed by Stephen Williams
parent 63c7285113
commit 6146a98278
3 changed files with 92 additions and 96 deletions

View File

@ -17,10 +17,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
# include "sys_priv.h"
# include "lxt_write.h" # include "lxt_write.h"
# include "vcd_priv.h"
# include "sys_priv.h" # include "sys_priv.h"
# include "vcd_priv.h"
/* /*
* This file contains the implementations of the LXT related * This file contains the implementations of the LXT related
@ -39,6 +38,29 @@
# include "stringheap.h" # include "stringheap.h"
static char *dump_path = NULL;
static struct lt_trace *dump_file = NULL;
struct vcd_info {
vpiHandle item;
vpiHandle cb;
struct t_vpi_time time;
struct lt_symbol *sym;
struct vcd_info *next;
struct vcd_info *dmp_next;
int scheduled;
};
static struct vcd_info *vcd_list = NULL;
static struct vcd_info *vcd_dmp_list = NULL;
static PLI_UINT64 vcd_cur_time = 0;
static int dump_is_off = 0;
static long dump_limit = 0;
static int dump_is_full = 0;
static int finish_status = 0;
static enum lxm_optimum_mode_e { static enum lxm_optimum_mode_e {
LXM_NONE = 0, LXM_NONE = 0,
LXM_SPACE = 1, LXM_SPACE = 1,
@ -140,30 +162,6 @@ static char *create_full_name(const char *name)
return n; return n;
} }
static char *dump_path = 0;
static struct lt_trace *dump_file = 0;
struct vcd_info {
vpiHandle item;
vpiHandle cb;
struct t_vpi_time time;
struct lt_symbol *sym;
struct vcd_info *next;
struct vcd_info *dmp_next;
int scheduled;
};
static struct vcd_info*vcd_list = 0;
static struct vcd_info*vcd_dmp_list = 0;
static PLI_UINT64 vcd_cur_time = 0;
static int dump_is_off = 0;
static long dump_limit = 0;
static int dump_is_full = 0;
static int finish_status = 0;
static void show_this_item(struct vcd_info*info) static void show_this_item(struct vcd_info*info)
{ {
s_vpi_value value; s_vpi_value value;
@ -434,7 +432,8 @@ static PLI_INT32 sys_dumpall_calltf(PLI_BYTE8*name)
static void *close_dumpfile(void) static void *close_dumpfile(void)
{ {
lt_close(dump_file); lt_close(dump_file);
return (dump_file = NULL); dump_file = NULL;
return NULL;
} }
static void open_dumpfile(vpiHandle callh) static void open_dumpfile(vpiHandle callh)

View File

@ -17,10 +17,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
# include "sys_priv.h"
# include "lxt2_write.h" # include "lxt2_write.h"
# include "vcd_priv.h"
# include "sys_priv.h" # include "sys_priv.h"
# include "vcd_priv.h"
/* /*
* This file contains the implementations of the LXT2 related * This file contains the implementations of the LXT2 related
@ -39,6 +38,29 @@
# include "stringheap.h" # include "stringheap.h"
static char *dump_path = NULL;
static struct lxt2_wr_trace *dump_file = NULL;
struct vcd_info {
vpiHandle item;
vpiHandle cb;
struct t_vpi_time time;
struct lxt2_wr_symbol *sym;
struct vcd_info *next;
struct vcd_info *dmp_next;
int scheduled;
};
static struct vcd_info *vcd_list = NULL;
static struct vcd_info *vcd_dmp_list = NULL;
static PLI_UINT64 vcd_cur_time = 0;
static int dump_is_off = 0;
static long dump_limit = 0;
static int dump_is_full = 0;
static int finish_status = 0;
static enum lxm_optimum_mode_e { static enum lxm_optimum_mode_e {
LXM_NONE = 0, LXM_NONE = 0,
LXM_SPACE = 1, LXM_SPACE = 1,
@ -141,30 +163,6 @@ static char *create_full_name(const char *name)
return n; return n;
} }
static char *dump_path = 0;
static struct lxt2_wr_trace *dump_file = 0;
struct vcd_info {
vpiHandle item;
vpiHandle cb;
struct t_vpi_time time;
struct lxt2_wr_symbol *sym;
struct vcd_info *next;
struct vcd_info *dmp_next;
int scheduled;
};
static struct vcd_info*vcd_list = 0;
static struct vcd_info*vcd_dmp_list = 0;
static PLI_UINT64 vcd_cur_time = 0;
static int dump_is_off = 0;
static long dump_limit = 0;
static int dump_is_full = 0;
static int finish_status = 0;
static void show_this_item(struct vcd_info*info) static void show_this_item(struct vcd_info*info)
{ {
s_vpi_value value; s_vpi_value value;
@ -436,8 +434,8 @@ static PLI_INT32 sys_dumpall_calltf(PLI_BYTE8*name)
static void *close_dumpfile(void) static void *close_dumpfile(void)
{ {
lxt2_wr_close(dump_file); lxt2_wr_close(dump_file);
dump_file = 0; dump_file = NULL;
return 0; return NULL;
} }
static void open_dumpfile(vpiHandle callh) static void open_dumpfile(vpiHandle callh)

View File

@ -18,6 +18,7 @@
*/ */
# include "sys_priv.h" # include "sys_priv.h"
# include "vcd_priv.h"
/* /*
* This file contains the implementations of the VCD related * This file contains the implementations of the VCD related
@ -33,19 +34,9 @@
#ifdef HAVE_MALLOC_H #ifdef HAVE_MALLOC_H
# include <malloc.h> # include <malloc.h>
#endif #endif
# include "vcd_priv.h"
static char*dump_path = 0; static char *dump_path = NULL;
static FILE*dump_file = 0; static FILE *dump_file = NULL;
static const char*units_names[] = {
"s",
"ms",
"us",
"ns",
"ps",
"fs"
};
struct vcd_info { struct vcd_info {
vpiHandle item; vpiHandle item;
@ -58,6 +49,24 @@ struct vcd_info {
}; };
static struct vcd_info *vcd_list = NULL;
static struct vcd_info *vcd_dmp_list = NULL;
static PLI_UINT64 vcd_cur_time = 0;
static int dump_is_off = 0;
static long dump_limit = 0;
static int dump_is_full = 0;
static int finish_status = 0;
static const char*units_names[] = {
"s",
"ms",
"us",
"ns",
"ps",
"fs"
};
static char vcdid[8] = "!"; static char vcdid[8] = "!";
static void gen_new_vcd_id(void) static void gen_new_vcd_id(void)
@ -76,14 +85,6 @@ static void gen_new_vcd_id(void)
} }
} }
static struct vcd_info *vcd_list = 0;
static struct vcd_info *vcd_dmp_list = 0;
PLI_UINT64 vcd_cur_time = 0;
static int dump_is_off = 0;
static long dump_limit = 0;
static int dump_is_full = 0;
static int finish_status = 0;
static char *truncate_bitvec(char *s) static char *truncate_bitvec(char *s)
{ {
char l, r; char l, r;
@ -480,7 +481,6 @@ static PLI_INT32 sys_dumplimit_calltf(PLI_BYTE8 *name)
s_vpi_value val; s_vpi_value val;
/* Get the value and set the dump limit. */ /* Get the value and set the dump limit. */
assert(argv);
val.format = vpiIntVal; val.format = vpiIntVal;
vpi_get_value(vpi_scan(argv), &val); vpi_get_value(vpi_scan(argv), &val);
dump_limit = val.value.integer; dump_limit = val.value.integer;
@ -581,9 +581,8 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
cb.reason = cbValueChange; cb.reason = cbValueChange;
cb.cb_rtn = variable_cb_1; cb.cb_rtn = variable_cb_1;
info->next = vcd_list;
info->dmp_next = 0; info->dmp_next = 0;
info->next = vcd_list;
vcd_list = info; vcd_list = info;
info->cb = vpi_register_cb(&cb); info->cb = vpi_register_cb(&cb);