$dumpall checkpointing in VCD dump.
This commit is contained in:
parent
121b6c2ecb
commit
dc5bd8ea59
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: sys_vcd.c,v 1.3 2000/01/13 04:48:50 steve Exp $"
|
||||
#ident "$Id: sys_vcd.c,v 1.4 2000/01/20 06:04:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -44,10 +44,36 @@ struct vcd_info {
|
|||
static struct vcd_info*vcd_list = 0;
|
||||
unsigned long vcd_cur_time = 0;
|
||||
|
||||
static void show_this_item(struct vcd_info*info)
|
||||
{
|
||||
s_vpi_value value;
|
||||
|
||||
if (vpi_get(vpiSize, info->item) == 1) {
|
||||
value.format = vpiBinStrVal;
|
||||
vpi_get_value(info->item, &value);
|
||||
fprintf(dump_file, "%s%s\n", value.value.str, info->ident);
|
||||
} else {
|
||||
value.format = vpiBinStrVal;
|
||||
vpi_get_value(info->item, &value);
|
||||
fprintf(dump_file, "b%s %s\n", value.value.str, info->ident);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 int variable_cb(p_cb_data cause)
|
||||
{
|
||||
unsigned long now = cause->time->low;
|
||||
s_vpi_value value;
|
||||
struct t_cb_data cb;
|
||||
struct vcd_info*info = (struct vcd_info*)cause->user_data;
|
||||
|
||||
|
|
@ -61,21 +87,19 @@ static int variable_cb(p_cb_data cause)
|
|||
vcd_cur_time = now;
|
||||
}
|
||||
|
||||
if (vpi_get(vpiSize, info->item) == 1) {
|
||||
value.format = vpiBinStrVal;
|
||||
vpi_get_value(info->item, &value);
|
||||
fprintf(dump_file, "%s%s\n", value.value.str, info->ident);
|
||||
} else {
|
||||
value.format = vpiBinStrVal;
|
||||
vpi_get_value(info->item, &value);
|
||||
fprintf(dump_file, "b%s %s\n", value.value.str, info->ident);
|
||||
}
|
||||
show_this_item(info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sys_dumpall_calltf(char*name)
|
||||
{
|
||||
s_vpi_time now;
|
||||
vpi_get_time(0, &now);
|
||||
fprintf(dump_file, "#%u\n", now.low);
|
||||
vcd_cur_time = now.low;
|
||||
vcd_checkpoint();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -176,6 +200,7 @@ static void scan_scope(unsigned depth, vpiHandle argv)
|
|||
|
||||
static int sys_dumpvars_calltf(char*name)
|
||||
{
|
||||
s_vpi_time now;
|
||||
vpiHandle item;
|
||||
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
||||
vpiHandle argv = vpi_iterate(vpiArgument, sys);
|
||||
|
|
@ -192,7 +217,11 @@ static int sys_dumpvars_calltf(char*name)
|
|||
scan_scope(99, argv);
|
||||
|
||||
fprintf(dump_file, "$enddefinitions $end\n");
|
||||
fprintf(dump_file, "#0\n");
|
||||
|
||||
vpi_get_time(0, &now);
|
||||
fprintf(dump_file, "#%u\n", now.low);
|
||||
|
||||
vcd_checkpoint();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -228,6 +257,9 @@ void sys_vcd_register()
|
|||
|
||||
/*
|
||||
* $Log: sys_vcd.c,v $
|
||||
* Revision 1.4 2000/01/20 06:04:55 steve
|
||||
* $dumpall checkpointing in VCD dump.
|
||||
*
|
||||
* Revision 1.3 2000/01/13 04:48:50 steve
|
||||
* Catch some parameter problems.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_user.h,v 1.10 1999/12/15 04:01:14 steve Exp $"
|
||||
#ident "$Id: vpi_user.h,v 1.11 2000/01/20 06:04:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -208,6 +208,7 @@ extern vpiHandle vpi_handle(int type, vpiHandle ref);
|
|||
extern vpiHandle vpi_iterate(int type, vpiHandle ref);
|
||||
extern vpiHandle vpi_scan(vpiHandle iter);
|
||||
|
||||
extern void vpi_get_time(vpiHandle obj, s_vpi_time*t);
|
||||
extern int vpi_get(int property, vpiHandle ref);
|
||||
extern char* vpi_get_str(int property, vpiHandle ref);
|
||||
extern void vpi_get_value(vpiHandle expr, p_vpi_value value);
|
||||
|
|
@ -226,6 +227,9 @@ extern void (*vlog_startup_routines[])();
|
|||
|
||||
/*
|
||||
* $Log: vpi_user.h,v $
|
||||
* Revision 1.11 2000/01/20 06:04:55 steve
|
||||
* $dumpall checkpointing in VCD dump.
|
||||
*
|
||||
* Revision 1.10 1999/12/15 04:01:14 steve
|
||||
* Add the VPI implementation of $readmemh.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_priv.c,v 1.2 1999/12/15 04:01:14 steve Exp $"
|
||||
#ident "$Id: vpi_priv.c,v 1.3 2000/01/20 06:04:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_priv.h"
|
||||
|
|
@ -95,6 +95,15 @@ char* vpi_get_str(int property, vpiHandle ref)
|
|||
return (ref->vpi_type->vpi_get_str_)(property, ref);
|
||||
}
|
||||
|
||||
void vpi_get_time(vpiHandle obj, s_vpi_time*t)
|
||||
{
|
||||
s_vpi_value value;
|
||||
vpiHandle tm = vpip_sim_time();
|
||||
value.format = vpiTimeVal;
|
||||
vpi_get_value(tm, &value);
|
||||
memcpy(t, value.value.time, sizeof (*t));
|
||||
}
|
||||
|
||||
void vpi_get_value(vpiHandle expr, s_vpi_value*vp)
|
||||
{
|
||||
if (expr->vpi_type->vpi_get_value_) {
|
||||
|
|
@ -159,6 +168,9 @@ void vpi_register_systf(const struct t_vpi_systf_data*systf)
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.c,v $
|
||||
* Revision 1.3 2000/01/20 06:04:55 steve
|
||||
* $dumpall checkpointing in VCD dump.
|
||||
*
|
||||
* Revision 1.2 1999/12/15 04:01:14 steve
|
||||
* Add the VPI implementation of $readmemh.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue