2002-03-09 22:54:48 +01:00
|
|
|
/*
|
2013-04-15 20:53:07 +02:00
|
|
|
* Copyright (c) 2002-2013 Stephen Williams (steve@icarus.com)
|
2002-03-09 22:54:48 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-03-09 22:54:48 +01:00
|
|
|
*/
|
|
|
|
|
|
2010-05-17 18:38:23 +02:00
|
|
|
/* The sys_priv.h include must be before the lxt_write.h include! */
|
2003-09-30 03:33:39 +02:00
|
|
|
# include "sys_priv.h"
|
2010-05-17 18:38:23 +02:00
|
|
|
# include "lxt_write.h"
|
2009-06-16 22:55:30 +02:00
|
|
|
# include "vcd_priv.h"
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
/*
|
2010-06-02 01:48:46 +02:00
|
|
|
* This file contains the implementations of the LXT related functions.
|
2002-03-09 22:54:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include <stdio.h>
|
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
# include <string.h>
|
|
|
|
|
# include <assert.h>
|
|
|
|
|
# include <time.h>
|
2003-02-13 19:13:28 +01:00
|
|
|
# include "stringheap.h"
|
2010-10-24 00:52:56 +02:00
|
|
|
# include "ivl_alloc.h"
|
2003-02-13 19:13:28 +01:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2009-06-16 22:55:30 +02:00
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
2003-02-20 01:50:06 +01:00
|
|
|
static enum lxm_optimum_mode_e {
|
|
|
|
|
LXM_NONE = 0,
|
|
|
|
|
LXM_SPACE = 1,
|
|
|
|
|
LXM_SPEED = 2
|
|
|
|
|
} lxm_optimum_mode = LXM_SPEED;
|
|
|
|
|
|
|
|
|
|
|
2002-07-15 05:57:30 +02:00
|
|
|
/*
|
|
|
|
|
* 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
|
|
|
|
|
* points to the first (bottom) item in the stack and
|
|
|
|
|
* lxt_scope_current points to the last (top) item in the stack. The
|
|
|
|
|
* push_scope and pop_scope methods manipulate the stack.
|
|
|
|
|
*/
|
2002-03-09 22:54:48 +01:00
|
|
|
struct lxt_scope
|
|
|
|
|
{
|
2002-07-15 05:57:30 +02:00
|
|
|
struct lxt_scope *next, *prev;
|
|
|
|
|
char *name;
|
|
|
|
|
int len;
|
2002-03-09 22:54:48 +01:00
|
|
|
};
|
|
|
|
|
|
2002-07-15 05:57:30 +02:00
|
|
|
static struct lxt_scope *lxt_scope_head=NULL, *lxt_scope_current=NULL;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
static void push_scope(const char *name)
|
|
|
|
|
{
|
2002-07-15 05:57:30 +02:00
|
|
|
struct lxt_scope *t = (struct lxt_scope *)
|
|
|
|
|
calloc(1, sizeof(struct lxt_scope));
|
|
|
|
|
|
|
|
|
|
t->name = strdup(name);
|
|
|
|
|
t->len = strlen(name);
|
|
|
|
|
|
|
|
|
|
if(!lxt_scope_head) {
|
|
|
|
|
lxt_scope_head = lxt_scope_current = t;
|
|
|
|
|
} else {
|
|
|
|
|
lxt_scope_current->next = t;
|
|
|
|
|
t->prev = lxt_scope_current;
|
|
|
|
|
lxt_scope_current = t;
|
|
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void pop_scope(void)
|
|
|
|
|
{
|
2002-07-15 05:57:30 +02:00
|
|
|
struct lxt_scope *t;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2002-07-15 05:57:30 +02:00
|
|
|
assert(lxt_scope_current);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2002-07-15 05:57:30 +02:00
|
|
|
t=lxt_scope_current->prev;
|
|
|
|
|
free(lxt_scope_current->name);
|
|
|
|
|
free(lxt_scope_current);
|
|
|
|
|
lxt_scope_current = t;
|
|
|
|
|
if (lxt_scope_current) {
|
|
|
|
|
lxt_scope_current->next = 0;
|
|
|
|
|
} else {
|
|
|
|
|
lxt_scope_head = 0;
|
|
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
2002-07-15 05:57:30 +02:00
|
|
|
/*
|
|
|
|
|
* This function uses the scope stack to generate a hierarchical
|
|
|
|
|
* name. Scan the scope stack from the bottom up to construct the
|
|
|
|
|
* name.
|
|
|
|
|
*/
|
2002-03-09 22:54:48 +01:00
|
|
|
static char *create_full_name(const char *name)
|
|
|
|
|
{
|
2002-07-15 05:57:30 +02:00
|
|
|
char *n, *n2;
|
|
|
|
|
int len = 0;
|
2007-11-20 20:33:06 +01:00
|
|
|
int is_esc_id = is_escaped_id(name);
|
2002-07-15 05:57:30 +02:00
|
|
|
struct lxt_scope *t = lxt_scope_head;
|
|
|
|
|
|
|
|
|
|
/* Figure out how long the combined string will be. */
|
|
|
|
|
while(t) {
|
|
|
|
|
len+=t->len+1;
|
|
|
|
|
t=t->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
len += strlen(name) + 1;
|
2007-11-20 20:33:06 +01:00
|
|
|
if (is_esc_id) len += 1;
|
2002-07-15 05:57:30 +02:00
|
|
|
|
|
|
|
|
/* Allocate a string buffer. */
|
|
|
|
|
n = n2 = malloc(len);
|
|
|
|
|
|
|
|
|
|
t = lxt_scope_head;
|
|
|
|
|
while(t) {
|
|
|
|
|
strcpy(n2, t->name);
|
|
|
|
|
n2 += t->len;
|
|
|
|
|
*n2 = '.';
|
|
|
|
|
n2++;
|
|
|
|
|
t=t->next;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-20 20:33:06 +01:00
|
|
|
if (is_esc_id) {
|
|
|
|
|
*n2 = '\\';
|
|
|
|
|
n2++;
|
|
|
|
|
}
|
2002-07-15 05:57:30 +02:00
|
|
|
strcpy(n2, name);
|
|
|
|
|
n2 += strlen(n2);
|
|
|
|
|
assert( (n2 - n + 1) == len );
|
|
|
|
|
|
2003-02-13 19:13:28 +01:00
|
|
|
return n;
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void show_this_item(struct vcd_info*info)
|
|
|
|
|
{
|
|
|
|
|
s_vpi_value value;
|
|
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
if (vpi_get(vpiType, info->item) == vpiRealVar) {
|
2003-02-11 06:21:33 +01:00
|
|
|
value.format = vpiRealVal;
|
|
|
|
|
vpi_get_value(info->item, &value);
|
|
|
|
|
lt_emit_value_double(dump_file, info->sym, 0, value.value.real);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
value.format = vpiBinStrVal;
|
|
|
|
|
vpi_get_value(info->item, &value);
|
|
|
|
|
lt_emit_value_bit_string(dump_file, info->sym,
|
2009-02-25 01:47:46 +01:00
|
|
|
0 /* array row */,
|
|
|
|
|
value.value.str);
|
2003-02-11 06:21:33 +01:00
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void show_this_item_x(struct vcd_info*info)
|
|
|
|
|
{
|
2003-02-12 06:28:01 +01:00
|
|
|
if (vpi_get(vpiType,info->item) == vpiRealVar) {
|
|
|
|
|
/* Should write a NaN here? */
|
|
|
|
|
} else {
|
|
|
|
|
lt_emit_value_bit_string(dump_file, info->sym, 0, "x");
|
|
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* managed qsorted list of scope names for duplicates bsearching
|
|
|
|
|
*/
|
|
|
|
|
|
2003-02-11 06:21:33 +01:00
|
|
|
struct vcd_names_list_s lxt_tab;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
static int dumpvars_status = 0; /* 0:fresh 1:cb installed, 2:callback done */
|
2003-09-30 03:33:39 +02:00
|
|
|
static PLI_UINT64 dumpvars_time;
|
2008-09-30 03:06:47 +02:00
|
|
|
__inline__ static int dump_header_pending(void)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
|
|
|
|
return dumpvars_status != 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This function writes out all the traced variables, whether they
|
|
|
|
|
* changed or not.
|
|
|
|
|
*/
|
|
|
|
|
static void vcd_checkpoint()
|
|
|
|
|
{
|
|
|
|
|
struct vcd_info*cur;
|
|
|
|
|
|
|
|
|
|
for (cur = vcd_list ; cur ; cur = cur->next)
|
|
|
|
|
show_this_item(cur);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void vcd_checkpoint_x()
|
|
|
|
|
{
|
|
|
|
|
struct vcd_info*cur;
|
|
|
|
|
|
|
|
|
|
for (cur = vcd_list ; cur ; cur = cur->next)
|
|
|
|
|
show_this_item_x(cur);
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-30 23:45:36 +01:00
|
|
|
static PLI_INT32 variable_cb_2(p_cb_data cause)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
2003-04-27 04:22:27 +02:00
|
|
|
struct vcd_info* info = vcd_dmp_list;
|
2003-09-30 03:33:39 +02:00
|
|
|
PLI_UINT64 now = timerec_to_time64(cause->time);
|
2004-10-04 03:10:51 +02:00
|
|
|
|
|
|
|
|
if (now != vcd_cur_time) {
|
2003-09-30 03:33:39 +02:00
|
|
|
lt_set_time64(dump_file, now);
|
2002-03-09 22:54:48 +01:00
|
|
|
vcd_cur_time = now;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-27 04:22:27 +02:00
|
|
|
do {
|
|
|
|
|
show_this_item(info);
|
|
|
|
|
info->scheduled = 0;
|
|
|
|
|
} while ((info = info->dmp_next) != 0);
|
|
|
|
|
|
|
|
|
|
vcd_dmp_list = 0;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-30 23:45:36 +01:00
|
|
|
static PLI_INT32 variable_cb_1(p_cb_data cause)
|
2003-04-27 04:22:27 +02:00
|
|
|
{
|
|
|
|
|
struct t_cb_data cb;
|
|
|
|
|
struct vcd_info*info = (struct vcd_info*)cause->user_data;
|
|
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
if (dump_is_full) return 0;
|
|
|
|
|
if (dump_is_off) return 0;
|
2003-04-27 04:22:27 +02:00
|
|
|
if (dump_header_pending()) return 0;
|
2009-02-25 01:47:46 +01:00
|
|
|
if (info->scheduled) return 0;
|
2003-04-27 04:22:27 +02:00
|
|
|
|
2007-10-09 06:01:25 +02:00
|
|
|
if ((dump_limit > 0) && (ftell(dump_file->handle) > dump_limit)) {
|
|
|
|
|
dump_is_full = 1;
|
|
|
|
|
vpi_printf("WARNING: Dump file limit (%ld bytes) "
|
|
|
|
|
"exceeded.\n", dump_limit);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-27 04:22:27 +02:00
|
|
|
if (!vcd_dmp_list) {
|
|
|
|
|
cb = *cause;
|
|
|
|
|
cb.reason = cbReadOnlySynch;
|
|
|
|
|
cb.cb_rtn = variable_cb_2;
|
|
|
|
|
vpi_register_cb(&cb);
|
2004-10-04 03:10:51 +02:00
|
|
|
}
|
2003-04-27 04:22:27 +02:00
|
|
|
|
|
|
|
|
info->scheduled = 1;
|
|
|
|
|
info->dmp_next = vcd_dmp_list;
|
|
|
|
|
vcd_dmp_list = info;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-30 23:45:36 +01:00
|
|
|
static PLI_INT32 dumpvars_cb(p_cb_data cause)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
2009-02-25 01:47:46 +01:00
|
|
|
if (dumpvars_status != 1) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
dumpvars_status = 2;
|
|
|
|
|
|
2003-09-30 03:33:39 +02:00
|
|
|
dumpvars_time = timerec_to_time64(cause->time);
|
2002-03-09 22:54:48 +01:00
|
|
|
vcd_cur_time = dumpvars_time;
|
|
|
|
|
|
|
|
|
|
if (!dump_is_off) {
|
2003-09-30 03:33:39 +02:00
|
|
|
lt_set_time64(dump_file, dumpvars_time);
|
2002-03-09 22:54:48 +01:00
|
|
|
vcd_checkpoint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-09 00:56:10 +01:00
|
|
|
static PLI_INT32 finish_cb(p_cb_data cause)
|
|
|
|
|
{
|
2009-03-18 02:01:25 +01:00
|
|
|
struct vcd_info *cur, *next;
|
|
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
if (finish_status != 0) return 0;
|
2007-11-09 00:56:10 +01:00
|
|
|
|
|
|
|
|
finish_status = 1;
|
|
|
|
|
|
|
|
|
|
dumpvars_time = timerec_to_time64(cause->time);
|
|
|
|
|
if (!dump_is_off && !dump_is_full && dumpvars_time != vcd_cur_time) {
|
|
|
|
|
lt_set_time64(dump_file, dumpvars_time);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-18 02:01:25 +01:00
|
|
|
for (cur = vcd_list ; cur ; cur = next) {
|
|
|
|
|
next = cur->next;
|
|
|
|
|
free(cur);
|
|
|
|
|
}
|
|
|
|
|
vcd_list = 0;
|
|
|
|
|
|
|
|
|
|
vcd_names_delete(&lxt_tab);
|
|
|
|
|
nexus_ident_delete();
|
|
|
|
|
free(dump_path);
|
|
|
|
|
dump_path = 0;
|
|
|
|
|
|
2007-11-09 00:56:10 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
__inline__ static int install_dumpvars_callback(void)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
|
|
|
|
struct t_cb_data cb;
|
2008-12-18 17:45:47 +01:00
|
|
|
static struct t_vpi_time now;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
if (dumpvars_status == 1) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
if (dumpvars_status == 2) {
|
2008-06-04 02:12:27 +02:00
|
|
|
vpi_printf("LXT warning: $dumpvars ignored, previously"
|
|
|
|
|
" called at simtime %" PLI_UINT64_FMT "\n",
|
|
|
|
|
dumpvars_time);
|
2002-03-09 22:54:48 +01:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-18 17:45:47 +01:00
|
|
|
now.type = vpiSimTime;
|
|
|
|
|
cb.time = &now;
|
2002-03-09 22:54:48 +01:00
|
|
|
cb.reason = cbReadOnlySynch;
|
|
|
|
|
cb.cb_rtn = dumpvars_cb;
|
|
|
|
|
cb.user_data = 0x0;
|
|
|
|
|
cb.obj = 0x0;
|
|
|
|
|
|
|
|
|
|
vpi_register_cb(&cb);
|
|
|
|
|
|
2007-11-09 00:56:10 +01:00
|
|
|
cb.reason = cbEndOfSimulation;
|
|
|
|
|
cb.cb_rtn = finish_cb;
|
|
|
|
|
|
|
|
|
|
vpi_register_cb(&cb);
|
|
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
dumpvars_status = 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumpoff_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
|
|
|
|
s_vpi_time now;
|
2003-09-30 03:33:39 +02:00
|
|
|
PLI_UINT64 now64;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (dump_is_off) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
dump_is_off = 1;
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (dump_file == 0) return 0;
|
|
|
|
|
if (dump_header_pending()) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2002-12-21 01:55:57 +01:00
|
|
|
now.type = vpiSimTime;
|
2002-03-09 22:54:48 +01:00
|
|
|
vpi_get_time(0, &now);
|
2003-09-30 03:33:39 +02:00
|
|
|
now64 = timerec_to_time64(&now);
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (now64 > vcd_cur_time) {
|
2009-02-25 01:47:46 +01:00
|
|
|
lt_set_time64(dump_file, now64);
|
|
|
|
|
vcd_cur_time = now64;
|
2007-12-11 01:14:02 +01:00
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2003-02-20 01:50:06 +01:00
|
|
|
lt_set_dumpoff(dump_file);
|
2003-02-21 02:36:25 +01:00
|
|
|
vcd_checkpoint_x();
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumpon_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
|
|
|
|
s_vpi_time now;
|
2003-09-30 03:33:39 +02:00
|
|
|
PLI_UINT64 now64;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (!dump_is_off) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
dump_is_off = 0;
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (dump_file == 0) return 0;
|
|
|
|
|
if (dump_header_pending()) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2002-12-21 01:55:57 +01:00
|
|
|
now.type = vpiSimTime;
|
2002-03-09 22:54:48 +01:00
|
|
|
vpi_get_time(0, &now);
|
2003-09-30 03:33:39 +02:00
|
|
|
now64 = timerec_to_time64(&now);
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (now64 > vcd_cur_time) {
|
2009-02-25 01:47:46 +01:00
|
|
|
lt_set_time64(dump_file, now64);
|
|
|
|
|
vcd_cur_time = now64;
|
2007-12-11 01:14:02 +01:00
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2003-02-21 02:36:25 +01:00
|
|
|
lt_set_dumpon(dump_file);
|
2002-03-09 22:54:48 +01:00
|
|
|
vcd_checkpoint();
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumpall_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
|
|
|
|
s_vpi_time now;
|
2003-09-30 03:33:39 +02:00
|
|
|
PLI_UINT64 now64;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (dump_is_off) return 0;
|
|
|
|
|
if (dump_file == 0) return 0;
|
|
|
|
|
if (dump_header_pending()) return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2002-12-21 01:55:57 +01:00
|
|
|
now.type = vpiSimTime;
|
2002-03-09 22:54:48 +01:00
|
|
|
vpi_get_time(0, &now);
|
2003-09-30 03:33:39 +02:00
|
|
|
now64 = timerec_to_time64(&now);
|
|
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
if (now64 > vcd_cur_time) {
|
|
|
|
|
lt_set_time64(dump_file, now64);
|
|
|
|
|
vcd_cur_time = now64;
|
2007-12-11 01:14:02 +01:00
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
vcd_checkpoint();
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void *close_dumpfile(void)
|
|
|
|
|
{
|
2007-12-11 01:14:02 +01:00
|
|
|
lt_close(dump_file);
|
2009-06-16 22:55:30 +02:00
|
|
|
dump_file = NULL;
|
|
|
|
|
return NULL;
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
2008-06-04 02:12:27 +02:00
|
|
|
static void open_dumpfile(vpiHandle callh)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
2007-12-11 01:14:02 +01:00
|
|
|
if (dump_path == 0) dump_path = strdup("dump.lxt");
|
|
|
|
|
|
|
|
|
|
dump_file = lt_init(dump_path);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
if (dump_file == 0) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("LXT Error: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-04 02:12:27 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("Unable to open %s for output.\n", dump_path);
|
2007-12-11 01:14:02 +01:00
|
|
|
vpi_control(vpiFinish, 1);
|
2002-03-09 22:54:48 +01:00
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
int prec = vpi_get(vpiTimePrecision, 0);
|
|
|
|
|
|
2008-06-04 02:12:27 +02:00
|
|
|
vpi_printf("LXT info: dumpfile %s opened for output.\n",
|
|
|
|
|
dump_path);
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
assert(prec >= -15);
|
|
|
|
|
lt_set_timescale(dump_file, prec);
|
|
|
|
|
|
|
|
|
|
lt_set_initial_value(dump_file, 'x');
|
2009-02-25 01:47:46 +01:00
|
|
|
lt_set_clock_compress(dump_file);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
atexit((void(*)(void))close_dumpfile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumpfile_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
2007-12-11 01:14:02 +01:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
2009-02-25 01:47:46 +01:00
|
|
|
char *path;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
/* $dumpfile must be called before $dumpvars starts! */
|
|
|
|
|
if (dumpvars_status != 0) {
|
2011-05-02 18:09:22 +02:00
|
|
|
char msg[64];
|
|
|
|
|
snprintf(msg, sizeof(msg), "LXT warning: %s:%d:",
|
2009-02-25 01:47:46 +01:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
2011-05-02 18:09:22 +02:00
|
|
|
msg[sizeof(msg)-1] = 0;
|
2009-02-25 01:47:46 +01:00
|
|
|
vpi_printf("%s %s called after $dumpvars started,\n", msg, name);
|
|
|
|
|
vpi_printf("%*s using existing file (%s).\n",
|
|
|
|
|
(int) strlen(msg), " ", dump_path);
|
|
|
|
|
vpi_free_object(argv);
|
2007-12-11 01:14:02 +01:00
|
|
|
return 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
path = get_filename(callh, name, vpi_scan(argv));
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
if (! path) return 0;
|
2002-11-17 23:28:42 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (dump_path) {
|
2009-02-25 01:47:46 +01:00
|
|
|
vpi_printf("LXT warning: %s:%d: ", vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("Overriding dump file %s with %s.\n", dump_path, path);
|
2007-12-11 01:14:02 +01:00
|
|
|
free(dump_path);
|
|
|
|
|
}
|
|
|
|
|
dump_path = path;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-15 21:46:01 +01:00
|
|
|
/*
|
|
|
|
|
* The LXT1 format has no concept of file flushing.
|
|
|
|
|
*/
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumpflush_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
2004-02-15 21:46:01 +01:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumplimit_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
2007-10-09 06:01:25 +02:00
|
|
|
{
|
|
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
|
|
|
|
|
/* Get the value and set the dump limit. */
|
|
|
|
|
val.format = vpiIntVal;
|
2009-02-25 01:47:46 +01:00
|
|
|
vpi_get_value(vpi_scan(argv), &val);
|
2007-10-09 06:01:25 +02:00
|
|
|
dump_limit = val.value.integer;
|
|
|
|
|
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
static void scan_item(unsigned depth, vpiHandle item, int skip)
|
|
|
|
|
{
|
|
|
|
|
struct t_cb_data cb;
|
|
|
|
|
struct vcd_info* info;
|
|
|
|
|
|
|
|
|
|
const char* name;
|
|
|
|
|
const char* ident;
|
|
|
|
|
int nexus_id;
|
|
|
|
|
|
|
|
|
|
switch (vpi_get(vpiType, item)) {
|
|
|
|
|
|
2008-06-04 02:12:27 +02:00
|
|
|
case vpiMemoryWord:
|
2009-06-16 22:55:30 +02:00
|
|
|
if (vpi_get(vpiConstantSelect, item) == 0) {
|
2009-04-16 20:57:00 +02:00
|
|
|
/* Turn a non-constant array word select into a
|
|
|
|
|
* constant word select. */
|
|
|
|
|
vpiHandle array = vpi_handle(vpiParent, item);
|
2010-05-13 03:53:56 +02:00
|
|
|
PLI_INT32 idx = vpi_get(vpiIndex, item);
|
|
|
|
|
item = vpi_handle_by_index(array, idx);
|
2009-04-16 20:57:00 +02:00
|
|
|
}
|
|
|
|
|
case vpiIntegerVar:
|
2011-09-06 18:23:42 +02:00
|
|
|
case vpiBitVar:
|
|
|
|
|
case vpiByteVar:
|
|
|
|
|
case vpiShortIntVar:
|
|
|
|
|
case vpiIntVar:
|
|
|
|
|
case vpiLongIntVar:
|
2002-07-17 07:13:43 +02:00
|
|
|
case vpiTimeVar:
|
2011-10-19 23:19:57 +02:00
|
|
|
case vpiReg:
|
|
|
|
|
case vpiNet:
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2009-04-28 23:57:46 +02:00
|
|
|
/* An array word is implicitly escaped so look for an
|
|
|
|
|
* escaped identifier that this could conflict with. */
|
|
|
|
|
if (vpi_get(vpiType, item) == vpiMemoryWord &&
|
|
|
|
|
vpi_handle_by_name(vpi_get_str(vpiFullName, item), 0)) {
|
|
|
|
|
vpi_printf("LXT warning: dumping array word %s will "
|
|
|
|
|
"conflict with an escaped identifier.\n",
|
|
|
|
|
vpi_get_str(vpiFullName, item));
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-28 18:52:39 +01:00
|
|
|
if (skip || vpi_get(vpiAutomatic, item)) break;
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
name = vpi_get_str(vpiName, item);
|
|
|
|
|
nexus_id = vpi_get(_vpiNexusId, item);
|
|
|
|
|
if (nexus_id) {
|
|
|
|
|
ident = find_nexus_ident(nexus_id);
|
|
|
|
|
} else {
|
|
|
|
|
ident = 0;
|
|
|
|
|
}
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
if (!ident) {
|
2003-02-13 19:13:28 +01:00
|
|
|
char*tmp = create_full_name(name);
|
|
|
|
|
ident = strdup_sh(&name_heap, tmp);
|
|
|
|
|
free(tmp);
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
if (nexus_id) set_nexus_ident(nexus_id, ident);
|
2003-04-28 03:03:11 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
info = malloc(sizeof(*info));
|
|
|
|
|
|
|
|
|
|
info->time.type = vpiSimTime;
|
2009-06-16 22:55:30 +02:00
|
|
|
info->item = item;
|
|
|
|
|
info->sym = lt_symbol_add(dump_file, ident,
|
|
|
|
|
0 /* array rows */,
|
|
|
|
|
vpi_get(vpiLeftRange, item),
|
|
|
|
|
vpi_get(vpiRightRange, item),
|
|
|
|
|
LT_SYM_F_BITS);
|
2003-04-27 04:22:27 +02:00
|
|
|
info->scheduled = 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
cb.time = &info->time;
|
|
|
|
|
cb.user_data = (char*)info;
|
|
|
|
|
cb.value = NULL;
|
|
|
|
|
cb.obj = item;
|
|
|
|
|
cb.reason = cbValueChange;
|
2003-04-27 04:22:27 +02:00
|
|
|
cb.cb_rtn = variable_cb_1;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
info->next = vcd_list;
|
|
|
|
|
vcd_list = info;
|
|
|
|
|
|
|
|
|
|
info->cb = vpi_register_cb(&cb);
|
2002-07-15 05:57:30 +02:00
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
char *n = create_full_name(name);
|
|
|
|
|
lt_symbol_alias(dump_file, ident, n,
|
|
|
|
|
vpi_get(vpiSize, item)-1, 0);
|
|
|
|
|
free(n);
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
break;
|
2003-02-11 06:21:33 +01:00
|
|
|
|
|
|
|
|
case vpiRealVar:
|
|
|
|
|
|
2008-10-28 18:52:39 +01:00
|
|
|
if (skip || vpi_get(vpiAutomatic, item)) break;
|
2003-02-11 06:21:33 +01:00
|
|
|
|
|
|
|
|
name = vpi_get_str(vpiName, item);
|
2003-02-13 19:13:28 +01:00
|
|
|
{ char*tmp = create_full_name(name);
|
|
|
|
|
ident = strdup_sh(&name_heap, tmp);
|
|
|
|
|
free(tmp);
|
|
|
|
|
}
|
2003-02-11 06:21:33 +01:00
|
|
|
info = malloc(sizeof(*info));
|
|
|
|
|
|
|
|
|
|
info->time.type = vpiSimTime;
|
2009-02-25 01:47:46 +01:00
|
|
|
info->item = item;
|
|
|
|
|
info->sym = lt_symbol_add(dump_file, ident,
|
|
|
|
|
0 /* array rows */,
|
|
|
|
|
vpi_get(vpiSize, item)-1,
|
|
|
|
|
0, LT_SYM_F_DOUBLE);
|
2003-04-27 04:22:27 +02:00
|
|
|
info->scheduled = 0;
|
2003-02-11 06:21:33 +01:00
|
|
|
|
|
|
|
|
cb.time = &info->time;
|
|
|
|
|
cb.user_data = (char*)info;
|
|
|
|
|
cb.value = NULL;
|
|
|
|
|
cb.obj = item;
|
|
|
|
|
cb.reason = cbValueChange;
|
2003-04-27 04:22:27 +02:00
|
|
|
cb.cb_rtn = variable_cb_1;
|
2003-02-11 06:21:33 +01:00
|
|
|
|
|
|
|
|
info->next = vcd_list;
|
|
|
|
|
vcd_list = info;
|
|
|
|
|
|
|
|
|
|
info->cb = vpi_register_cb(&cb);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
2011-10-19 23:19:57 +02:00
|
|
|
case vpiModule:
|
2013-07-17 19:55:46 +02:00
|
|
|
case vpiGenScope:
|
2011-10-19 23:19:57 +02:00
|
|
|
case vpiFunction:
|
2013-07-17 19:55:46 +02:00
|
|
|
case vpiTask:
|
|
|
|
|
case vpiNamedBegin:
|
2011-10-19 23:19:57 +02:00
|
|
|
case vpiNamedFork:
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
if (depth > 0) {
|
2013-04-15 20:53:07 +02:00
|
|
|
const char* fullname = vpi_get_str(vpiFullName, item);
|
|
|
|
|
/* list of types to iterate upon */
|
|
|
|
|
static int types[] = {
|
|
|
|
|
/* Value */
|
|
|
|
|
/* vpiNamedEvent, */
|
|
|
|
|
vpiNet,
|
|
|
|
|
/* vpiParameter, */
|
|
|
|
|
vpiReg,
|
|
|
|
|
vpiVariables,
|
|
|
|
|
/* Scope */
|
|
|
|
|
vpiFunction,
|
2013-07-17 19:55:46 +02:00
|
|
|
vpiGenScope,
|
2013-04-15 20:53:07 +02:00
|
|
|
vpiModule,
|
|
|
|
|
vpiNamedBegin,
|
|
|
|
|
vpiNamedFork,
|
|
|
|
|
vpiTask,
|
|
|
|
|
-1
|
|
|
|
|
};
|
|
|
|
|
int i;
|
|
|
|
|
int nskip = (vcd_names_search(&lxt_tab, fullname) != 0);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2003-05-15 18:51:08 +02:00
|
|
|
#if 0
|
2008-06-04 02:12:27 +02:00
|
|
|
vpi_printf("LXT info: scanning scope %s, %u levels\n",
|
|
|
|
|
fullname, depth);
|
2003-05-15 18:51:08 +02:00
|
|
|
#endif
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2013-04-15 20:53:07 +02:00
|
|
|
if (nskip) {
|
|
|
|
|
vpi_printf("LXT warning: ignoring signals in "
|
|
|
|
|
"previously scanned scope %s\n", fullname);
|
|
|
|
|
} else {
|
2003-02-11 06:21:33 +01:00
|
|
|
vcd_names_add(&lxt_tab, fullname);
|
2013-04-15 20:53:07 +02:00
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
name = vpi_get_str(vpiName, item);
|
|
|
|
|
|
2011-10-19 23:19:57 +02:00
|
|
|
push_scope(name);
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-07-12 19:08:13 +02:00
|
|
|
for (i=0; types[i]>0; i++) {
|
|
|
|
|
vpiHandle hand;
|
2013-04-15 20:53:07 +02:00
|
|
|
vpiHandle argv = vpi_iterate(types[i], item);
|
2002-07-12 19:08:13 +02:00
|
|
|
while (argv && (hand = vpi_scan(argv))) {
|
|
|
|
|
scan_item(depth-1, hand, nskip);
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
}
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
pop_scope();
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
default:
|
2008-06-04 02:12:27 +02:00
|
|
|
vpi_printf("LXT warning: $dumpvars: Unsupported parameter "
|
|
|
|
|
"type (%s)\n", vpi_get_str(vpiType, item));
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
2002-07-15 05:57:30 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int draw_scope(vpiHandle item)
|
|
|
|
|
{
|
|
|
|
|
int depth;
|
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
|
|
vpiHandle scope = vpi_handle(vpiScope, item);
|
2009-02-25 01:47:46 +01:00
|
|
|
if (!scope) return 0;
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
depth = 1 + draw_scope(scope);
|
|
|
|
|
name = vpi_get_str(vpiName, scope);
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
push_scope(name);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
return depth;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 18:31:01 +02:00
|
|
|
static PLI_INT32 sys_dumpvars_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
2002-03-09 22:54:48 +01:00
|
|
|
{
|
2007-12-11 01:14:02 +01:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
vpiHandle item;
|
2002-03-09 22:54:48 +01:00
|
|
|
s_vpi_value value;
|
2007-12-11 01:14:02 +01:00
|
|
|
unsigned depth = 0;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
if (dump_file == 0) {
|
2008-06-04 02:12:27 +02:00
|
|
|
open_dumpfile(callh);
|
2009-02-25 01:47:46 +01:00
|
|
|
if (dump_file == 0) {
|
2010-04-30 03:21:13 +02:00
|
|
|
if (argv) vpi_free_object(argv);
|
2009-02-25 01:47:46 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
2009-02-25 01:47:46 +01:00
|
|
|
if (install_dumpvars_callback()) {
|
2010-04-30 03:21:13 +02:00
|
|
|
if (argv) vpi_free_object(argv);
|
2009-02-25 01:47:46 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
/* 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;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
/* This dumps all the modules in the design if none are given. */
|
|
|
|
|
if (!argv || !(item = vpi_scan(argv))) {
|
|
|
|
|
argv = vpi_iterate(vpiModule, 0x0);
|
2008-09-30 03:06:47 +02:00
|
|
|
assert(argv); /* There must be at least one top level module. */
|
2007-12-11 01:14:02 +01:00
|
|
|
item = vpi_scan(argv);
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
for ( ; item; item = vpi_scan(argv)) {
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
int dep = draw_scope(item);
|
|
|
|
|
|
|
|
|
|
scan_item(depth, item, 0);
|
2010-05-22 23:53:16 +02:00
|
|
|
/* The scope list must be sorted after we scan an item. */
|
|
|
|
|
vcd_names_sort(&lxt_tab);
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
while (dep--) pop_scope();
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|
|
|
|
|
|
2003-02-20 01:50:06 +01:00
|
|
|
/* Most effective compression. */
|
2009-02-25 01:47:46 +01:00
|
|
|
if (lxm_optimum_mode == LXM_SPACE) {
|
|
|
|
|
lt_set_no_interlace(dump_file);
|
|
|
|
|
}
|
2003-02-20 01:50:06 +01:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sys_lxt_register()
|
|
|
|
|
{
|
2003-02-20 01:50:06 +01:00
|
|
|
int idx;
|
|
|
|
|
struct t_vpi_vlog_info vlog_info;
|
2002-03-09 22:54:48 +01:00
|
|
|
s_vpi_systf_data tf_data;
|
2010-04-12 08:39:08 +02:00
|
|
|
vpiHandle res;
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2003-02-20 01:50:06 +01:00
|
|
|
|
2010-05-23 20:28:27 +02:00
|
|
|
/* Scan the extended arguments, looking for lxt optimization flags. */
|
2003-02-20 01:50:06 +01:00
|
|
|
vpi_get_vlog_info(&vlog_info);
|
|
|
|
|
|
2010-05-23 20:28:27 +02:00
|
|
|
/* The "speed" option is not used in this dumper. */
|
2003-02-20 01:50:06 +01:00
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
/* All the compiletf routines are located in vcd_priv.c. */
|
|
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
2002-04-06 23:33:29 +02:00
|
|
|
tf_data.tfname = "$dumpall";
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.calltf = sys_dumpall_calltf;
|
2008-06-04 02:12:27 +02:00
|
|
|
tf_data.compiletf = sys_no_arg_compiletf;
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.sizetf = 0;
|
2002-04-06 23:33:29 +02:00
|
|
|
tf_data.user_data = "$dumpall";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
|
|
|
|
tf_data.type = vpiSysTask;
|
2002-04-06 23:33:29 +02:00
|
|
|
tf_data.tfname = "$dumpfile";
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.calltf = sys_dumpfile_calltf;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.compiletf = sys_one_string_arg_compiletf;
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.sizetf = 0;
|
2002-04-06 23:33:29 +02:00
|
|
|
tf_data.user_data = "$dumpfile";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2002-03-09 22:54:48 +01:00
|
|
|
|
2004-02-15 21:46:01 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$dumpflush";
|
|
|
|
|
tf_data.calltf = sys_dumpflush_calltf;
|
2008-06-04 02:12:27 +02:00
|
|
|
tf_data.compiletf = sys_no_arg_compiletf;
|
2004-02-15 21:46:01 +01:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$dumpflush";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2004-02-15 21:46:01 +01:00
|
|
|
|
2007-10-09 06:01:25 +02:00
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$dumplimit";
|
|
|
|
|
tf_data.calltf = sys_dumplimit_calltf;
|
2008-06-06 04:25:19 +02:00
|
|
|
tf_data.compiletf = sys_one_numeric_arg_compiletf;
|
2007-10-09 06:01:25 +02:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$dumplimit";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2007-10-09 06:01:25 +02:00
|
|
|
|
2007-12-11 01:14:02 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$dumpoff";
|
|
|
|
|
tf_data.calltf = sys_dumpoff_calltf;
|
2008-06-04 02:12:27 +02:00
|
|
|
tf_data.compiletf = sys_no_arg_compiletf;
|
2007-12-11 01:14:02 +01:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$dumpoff";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2007-12-11 01:14:02 +01:00
|
|
|
|
|
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$dumpon";
|
|
|
|
|
tf_data.calltf = sys_dumpon_calltf;
|
2008-06-04 02:12:27 +02:00
|
|
|
tf_data.compiletf = sys_no_arg_compiletf;
|
2007-12-11 01:14:02 +01:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$dumpon";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2007-12-11 01:14:02 +01:00
|
|
|
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
2002-04-06 23:33:29 +02:00
|
|
|
tf_data.tfname = "$dumpvars";
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.calltf = sys_dumpvars_calltf;
|
2007-12-11 01:14:02 +01:00
|
|
|
tf_data.compiletf = sys_dumpvars_compiletf;
|
2002-03-09 22:54:48 +01:00
|
|
|
tf_data.sizetf = 0;
|
2002-04-06 23:33:29 +02:00
|
|
|
tf_data.user_data = "$dumpvars";
|
2010-04-12 08:39:08 +02:00
|
|
|
res = vpi_register_systf(&tf_data);
|
|
|
|
|
vpip_make_systf_system_defined(res);
|
2002-03-09 22:54:48 +01:00
|
|
|
}
|