Update lxt_write implementation, and add compression control flags.

This commit is contained in:
steve 2003-02-20 00:50:06 +00:00
parent 9e63ed305d
commit 62ef34ea04
5 changed files with 1606 additions and 243 deletions

View File

@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.34 2003/02/13 18:13:28 steve Exp $"
#ident "$Id: Makefile.in,v 1.35 2003/02/20 00:50:06 steve Exp $"
#
#
SHELL = /bin/sh
@ -52,7 +52,7 @@ all: system.vpi
%.o: %.c
@[ -d dep ] || mkdir dep
$(CC) -Wall -I$(srcdir) -I$(srcdir)/.. $(CPPFLAGS) $(CFLAGS) -MD -c $< -o $*.o
$(CC) -Wall -I$(srcdir) -I.. $(CPPFLAGS) $(CFLAGS) -MD -c $< -o $*.o
mv $*.d dep
O = sys_table.o sys_deposit.o sys_display.o sys_finish.o sys_plusargs.o \
@ -60,7 +60,8 @@ sys_random.o sys_readmem.o sys_readmem_lex.o sys_time.o sys_vcd.o \
sys_lxt.o lxt_write.o vcd_priv.o \
mt19937int.o stringheap.o
SYSTEM_VPI_LDFLAGS = -L../vvp -lvpi
LIBS = @LIBS@
SYSTEM_VPI_LDFLAGS = -L../vvp -lvpi $(LIBS)
ifeq (@WIN32@,yes)
SYSTEM_VPI_LDFLAGS += -liberty
endif

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Tony Bybell.
* Copyright (c) 2001-3 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -19,9 +19,6 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: lxt_write.h,v 1.3 2002/08/12 01:35:04 steve Exp $"
#endif
#ifndef DEFS_LXT_H
#define DEFS_LXT_H
@ -31,57 +28,113 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <zlib.h>
#include <bzlib.h>
typedef struct dslxt_tree_node dslxt_Tree;
struct dslxt_tree_node {
dslxt_Tree * left, * right;
char *item;
unsigned int val;
};
#define LT_HDRID (0x0138)
#define LT_VERSION (0x0001)
#define LT_VERSION (0x0004)
#define LT_TRLID (0xB4)
#define LT_CLKPACK (4)
#define LT_CLKPACK_M (2)
#define LT_MVL_2 (1<<0)
#define LT_MVL_4 (1<<1)
#define LT_MVL_9 (1<<2)
#define LT_MINDICTWIDTH (16)
enum lt_zmode_types { LT_ZMODE_NONE, LT_ZMODE_GZIP, LT_ZMODE_BZIP2 };
typedef unsigned long long lxttime_t;
#define ULLDescriptor(x) x##ULL
struct lt_timetrail
{
struct lt_timetrail *next;
int timeval;
lxttime_t timeval;
unsigned int position;
};
#define LT_SYMPRIME 65519
#define LT_SECTION_END (0)
#define LT_SECTION_CHG (1)
#define LT_SECTION_SYNC_TABLE (2)
#define LT_SECTION_FACNAME (3)
#define LT_SECTION_FACNAME_GEOMETRY (4)
#define LT_SECTION_TIMESCALE (5)
#define LT_SECTION_TIME_TABLE (6)
#define LT_SECTION_INITIAL_VALUE (7)
#define LT_SECTION_DOUBLE_TEST (8)
#define LT_SECTION_END (0)
#define LT_SECTION_CHG (1)
#define LT_SECTION_SYNC_TABLE (2)
#define LT_SECTION_FACNAME (3)
#define LT_SECTION_FACNAME_GEOMETRY (4)
#define LT_SECTION_TIMESCALE (5)
#define LT_SECTION_TIME_TABLE (6)
#define LT_SECTION_INITIAL_VALUE (7)
#define LT_SECTION_DOUBLE_TEST (8)
#define LT_SECTION_TIME_TABLE64 (9)
#define LT_SECTION_ZFACNAME_PREDEC_SIZE (10)
#define LT_SECTION_ZFACNAME_SIZE (11)
#define LT_SECTION_ZFACNAME_GEOMETRY_SIZE (12)
#define LT_SECTION_ZSYNC_SIZE (13)
#define LT_SECTION_ZTIME_TABLE_SIZE (14)
#define LT_SECTION_ZCHG_PREDEC_SIZE (15)
#define LT_SECTION_ZCHG_SIZE (16)
#define LT_SECTION_ZDICTIONARY (17)
#define LT_SECTION_ZDICTIONARY_SIZE (18)
#define LT_SECTION_EXCLUDE_TABLE (19)
struct lt_trace
{
FILE *handle;
gzFile zhandle;
dslxt_Tree *dict; /* dictionary manipulation */
unsigned int mindictwidth;
unsigned int num_dict_entries;
unsigned int dict_string_mem_required;
dslxt_Tree **sorted_dict;
/* assume dict8_offset == filepos zero */
unsigned int dict16_offset;
unsigned int dict24_offset;
unsigned int dict32_offset;
int (*lt_emit_u8)(struct lt_trace *lt, int value);
int (*lt_emit_u16)(struct lt_trace *lt, int value);
int (*lt_emit_u24)(struct lt_trace *lt, int value);
int (*lt_emit_u32)(struct lt_trace *lt, int value);
int (*lt_emit_u64)(struct lt_trace *lt, int valueh, int valuel);
int (*lt_emit_double)(struct lt_trace *lt, double value);
int (*lt_emit_string)(struct lt_trace *lt, char *value);
unsigned int position;
unsigned int zfacname_predec_size, zfacname_size, zfacgeometry_size, zsync_table_size, ztime_table_size, zdictionary_size;
unsigned int zpackcount, zchg_table_size, chg_table_size;
struct lt_symbol *sym[LT_SYMPRIME];
struct lt_symbol **sorted_facs;
struct lt_symbol *symchain;
int numfacs;
int numfacs, numfacs_bytes;
int numfacbytes;
int longestname;
int mintime, maxtime;
lxttime_t mintime, maxtime;
int timescale;
int initial_value;
struct lt_timetrail *timehead, *timecurr, *timebuff;
int timechangecount;
char double_used;
char do_strip_brackets;
char clock_compress;
struct lt_timetrail *dumpoffhead, *dumpoffcurr;
int dumpoffcount;
unsigned int change_field_offset;
unsigned int facname_offset;
@ -91,11 +144,21 @@ unsigned int sync_table_offset;
unsigned int initial_value_offset;
unsigned int timescale_offset;
unsigned int double_test_offset;
unsigned int dictionary_offset;
unsigned int exclude_offset;
char *compress_fac_str;
int compress_fac_len;
int timeval; /* for clock induction */
lxttime_t timeval; /* for clock induction, current time */
unsigned dumpoff_active : 1; /* when set we're not dumping */
unsigned double_used : 1;
unsigned do_strip_brackets : 1;
unsigned clock_compress : 1;
unsigned dictmode : 1; /* dictionary compression enabled */
unsigned zmode : 2; /* for value changes */
unsigned emitted : 1; /* gate off change field zmode changes when set */
};
@ -116,10 +179,15 @@ int flags;
unsigned int last_change;
int clk_delta;
int clk_prevtrans;
int clk_numtrans;
char clk_prevval;
lxttime_t clk_delta;
lxttime_t clk_prevtrans;
int clk_numtrans;
int clk_prevval;
int clk_prevval1;
int clk_prevval2;
int clk_prevval3;
int clk_prevval4;
unsigned char clk_mask;
};
#define LT_SYM_F_BITS (0)
@ -137,10 +205,27 @@ struct lt_symbol * lt_symbol_add(struct lt_trace *lt, const char *name, unsigned
struct lt_symbol * lt_symbol_alias(struct lt_trace *lt, const char *existing_name, const char *alias, int msb, int lsb);
void lt_symbol_bracket_stripping(struct lt_trace *lt, int doit);
void lt_set_timescale(struct lt_trace *lt, int timescale);
void lt_set_initial_value(struct lt_trace *lt, char value);
int lt_set_time(struct lt_trace *lt, int timeval);
/* lt_set_no_interlace implies bzip2 compression. if you use lt_set_chg_compress before this, */
/* less efficient gzip compression will be used instead so make sure lt_set_no_interlace is first */
/* if you are using it! */
void lt_set_no_interlace(struct lt_trace *lt);
void lt_set_chg_compress(struct lt_trace *lt);
void lt_set_clock_compress(struct lt_trace *lt);
void lt_set_dict_compress(struct lt_trace *lt, unsigned int minwidth);
void lt_set_initial_value(struct lt_trace *lt, char value);
void lt_set_timescale(struct lt_trace *lt, int timescale);
int lt_set_time(struct lt_trace *lt, unsigned int timeval);
int lt_inc_time_by_delta(struct lt_trace *lt, unsigned int timeval);
int lt_set_time64(struct lt_trace *lt, lxttime_t timeval);
int lt_inc_time_by_delta64(struct lt_trace *lt, lxttime_t timeval);
/* allows blackout regions in LXT files */
void lt_set_dumpoff(struct lt_trace *lt);
void lt_set_dumpon(struct lt_trace *lt);
/*
* value change functions..note that if the value string len for
@ -157,13 +242,3 @@ int lt_emit_value_string(struct lt_trace *lt, struct lt_symbol *s, unsigned i
int lt_emit_value_bit_string(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, char *value);
#endif
/*
* $Log: lxt_write.h,v $
* Revision 1.3 2002/08/12 01:35:04 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2002/08/11 23:47:04 steve
* Add missing Log and Ident strings.
*
*/

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: sys_lxt.c,v 1.16 2003/02/13 18:13:28 steve Exp $"
#ident "$Id: sys_lxt.c,v 1.17 2003/02/20 00:50:06 steve Exp $"
#endif
# include "config.h"
@ -42,6 +42,13 @@
# include "stringheap.h"
static enum lxm_optimum_mode_e {
LXM_NONE = 0,
LXM_SPACE = 1,
LXM_SPEED = 2
} lxm_optimum_mode = LXM_SPEED;
/*
* The lxt_scope head and current pointers are used to keep a scope
* stack that can be accessed from the bottom. The lxt_scope_head
@ -300,6 +307,7 @@ static int sys_dumpoff_calltf(char*name)
vcd_cur_time = now.low;
vcd_checkpoint_x();
lt_set_dumpoff(dump_file);
return 0;
}
@ -319,6 +327,8 @@ static int sys_dumpon_calltf(char*name)
if (dump_header_pending())
return 0;
lt_set_dumpon(dump_file);
now.type = vpiSimTime;
vpi_get_time(0, &now);
if (now.low > vcd_cur_time)
@ -686,13 +696,34 @@ static int sys_dumpvars_calltf(char*name)
}
}
/* Most effective compression. */
if (lxm_optimum_mode == LXM_SPACE)
lt_set_no_interlace(dump_file);
return 0;
}
void sys_lxt_register()
{
int idx;
struct t_vpi_vlog_info vlog_info;
s_vpi_systf_data tf_data;
/* Scan the extended arguments, looking for lxt optimization
flags. */
vpi_get_vlog_info(&vlog_info);
for (idx = 0 ; idx < vlog_info.argc ; idx += 1) {
if (strcmp(vlog_info.argv[idx],"-lxt-space") == 0) {
lxm_optimum_mode = LXM_SPACE;
} else if (strcmp(vlog_info.argv[idx],"-lxt-speed") == 0) {
lxm_optimum_mode = LXM_SPEED;
}
}
tf_data.type = vpiSysTask;
tf_data.tfname = "$dumpall";
tf_data.calltf = sys_dumpall_calltf;
@ -736,6 +767,9 @@ void sys_lxt_register()
/*
* $Log: sys_lxt.c,v $
* Revision 1.17 2003/02/20 00:50:06 steve
* Update lxt_write implementation, and add compression control flags.
*
* Revision 1.16 2003/02/13 18:13:28 steve
* Make lxt use stringheap to perm-allocate strings.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: sys_table.c,v 1.17 2002/08/12 01:35:05 steve Exp $"
#ident "$Id: sys_table.c,v 1.18 2003/02/20 00:50:06 steve Exp $"
#endif
# include "config.h"
@ -38,6 +38,9 @@ extern void sys_lxt_register();
static void sys_lxt_or_vcd_register()
{
int idx;
struct t_vpi_vlog_info vlog_info;
char*dumper;
/* Get the dumper of choice from the IVERILOG_DUMPER
@ -52,6 +55,28 @@ static void sys_lxt_or_vcd_register()
dumper = "vcd";
}
/* Scan the extended arguments, looking for flags that select
major features. This can override the environment variable
settings. */
vpi_get_vlog_info(&vlog_info);
for (idx = 0 ; idx < vlog_info.argc ; idx += 1) {
if (strcmp(vlog_info.argv[idx],"-lxt") == 0) {
dumper = "lxt";
} else if (strcmp(vlog_info.argv[idx],"-lxt-space") == 0) {
dumper = "lxt";
} else if (strcmp(vlog_info.argv[idx],"-lxt-speed") == 0) {
dumper = "lxt";
} else if (strcmp(vlog_info.argv[idx],"-vcd") == 0) {
dumper = "vcd";
}
}
if (strcmp(dumper, "vcd") == 0)
sys_vcd_register();
@ -86,6 +111,9 @@ void (*vlog_startup_routines[])() = {
/*
* $Log: sys_table.c,v $
* Revision 1.18 2003/02/20 00:50:06 steve
* Update lxt_write implementation, and add compression control flags.
*
* Revision 1.17 2002/08/12 01:35:05 steve
* conditional ident string using autoconfig.
*