Start runtime trace aids
The runtime is a vvp runtime engine debug aid that allows for detailed dump into a debug log. The trace is enabled by setting the VVP_DEBUG variable and activating specific debug messages in the vvp source. Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
parent
b54ef4f585
commit
7132b8ff6b
|
|
@ -1197,6 +1197,9 @@ void compile_resolver(char*label, char*type, unsigned argc, struct symb_s*argv)
|
||||||
if (strcmp(type,"tri") == 0) {
|
if (strcmp(type,"tri") == 0) {
|
||||||
obj = new resolv_functor(vvp_scalar_t(BIT4_Z, 0));
|
obj = new resolv_functor(vvp_scalar_t(BIT4_Z, 0));
|
||||||
|
|
||||||
|
} else if (strncmp(type,"tri$",4) == 0) {
|
||||||
|
obj = new resolv_functor(vvp_scalar_t(BIT4_Z, 0), strdup(type+4));
|
||||||
|
|
||||||
} else if (strcmp(type,"tri0") == 0) {
|
} else if (strcmp(type,"tri0") == 0) {
|
||||||
obj = new resolv_functor(vvp_scalar_t(BIT4_0, 5));
|
obj = new resolv_functor(vvp_scalar_t(BIT4_0, 5));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
# include <fstream>
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
# include "vpi_user.h"
|
# include "vpi_user.h"
|
||||||
# include "vvp_net.h"
|
# include "vvp_net.h"
|
||||||
|
|
@ -44,6 +45,12 @@ extern void compile_cleanup(void);
|
||||||
|
|
||||||
extern bool verbose_flag;
|
extern bool verbose_flag;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this file opened, then write debug information to this
|
||||||
|
* file. This is used for debugging the VVP runtime itself.
|
||||||
|
*/
|
||||||
|
extern ofstream debug_file;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect a list of symbols to a contiguous set of ipoints.
|
* Connect a list of symbols to a contiguous set of ipoints.
|
||||||
* Constants C<?> are handled by setting the ival of the ipoint.
|
* Constants C<?> are handled by setting the ival of the ipoint.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
DEBUG AIDS FOR VVP
|
||||||
|
|
||||||
|
Debuging vvp can be fiendishly difficult, so there are some built in
|
||||||
|
debugging aids. These are enabled by setting the environment variable
|
||||||
|
VVP_DEBUG to the path to an output file. Then, various detailed debug
|
||||||
|
tools can be enabled as described below.
|
||||||
|
|
||||||
|
* .resolv
|
||||||
|
|
||||||
|
The .resolv can print debug information along with a label by
|
||||||
|
specifying the debug output label on the .resolv line:
|
||||||
|
|
||||||
|
.resolv tri$<label>
|
||||||
|
|
||||||
|
In this case, the "$" character directly after the "tri" enables debug
|
||||||
|
dumps for this node, and the <label> is the label to prepend to log
|
||||||
|
messages from this node.
|
||||||
|
|
@ -47,6 +47,8 @@
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ofstream debug_file;
|
||||||
|
|
||||||
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)
|
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)
|
||||||
extern "C" int getopt(int argc, char*argv[], const char*fmt);
|
extern "C" int getopt(int argc, char*argv[], const char*fmt);
|
||||||
extern "C" int optind;
|
extern "C" int optind;
|
||||||
|
|
@ -205,6 +207,13 @@ int main(int argc, char*argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the VVP_DEBUG variable is set, then it contains the path
|
||||||
|
to the vvp debug file. Open it for output. */
|
||||||
|
|
||||||
|
if (char*path = getenv("VVP_DEBUG")) {
|
||||||
|
debug_file.open(path, ios_base::out);
|
||||||
|
}
|
||||||
|
|
||||||
design_path = argv[optind];
|
design_path = argv[optind];
|
||||||
|
|
||||||
/* This is needed to get the MCD I/O routines ready for
|
/* This is needed to get the MCD I/O routines ready for
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,14 @@
|
||||||
|
|
||||||
# include "resolv.h"
|
# include "resolv.h"
|
||||||
# include "schedule.h"
|
# include "schedule.h"
|
||||||
|
# include "compile.h"
|
||||||
# include "statistics.h"
|
# include "statistics.h"
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
resolv_functor::resolv_functor(vvp_scalar_t hiz_value)
|
resolv_functor::resolv_functor(vvp_scalar_t hiz_value, const char*debug_l)
|
||||||
: hiz_(hiz_value)
|
: hiz_(hiz_value), debug_label_(debug_l)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,11 +73,10 @@ void resolv_functor::recv_vec8(vvp_net_ptr_t port, vvp_vector8_t bit)
|
||||||
vvp_vector8_t out (bit);
|
vvp_vector8_t out (bit);
|
||||||
|
|
||||||
for (unsigned idx = 0 ; idx < 4 ; idx += 1) {
|
for (unsigned idx = 0 ; idx < 4 ; idx += 1) {
|
||||||
if (val_[idx].size() == 0)
|
|
||||||
continue;
|
|
||||||
if (idx == pdx)
|
if (idx == pdx)
|
||||||
continue;
|
continue;
|
||||||
|
if (val_[idx].size() == 0)
|
||||||
|
continue;
|
||||||
out = resolve(out, val_[idx]);
|
out = resolve(out, val_[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,43 +87,17 @@ void resolv_functor::recv_vec8(vvp_net_ptr_t port, vvp_vector8_t bit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug_label_ && debug_file.is_open())
|
||||||
|
debug_file << "[" << schedule_simtime() << "] "
|
||||||
|
<< debug_label_ << ": Resolv out=" << out
|
||||||
|
<< " in=" << val_[0] << ", " << val_[1]
|
||||||
|
<< ", " << val_[2] << ", " << val_[3] << endl;
|
||||||
|
|
||||||
vvp_send_vec8(ptr->out, out);
|
vvp_send_vec8(ptr->out, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: resolv.cc,v $
|
* $Log: resolv.cc,v $
|
||||||
* Revision 1.26 2005/06/22 18:30:12 steve
|
|
||||||
* Inline more simple stuff, and more vector4_t by const reference for performance.
|
|
||||||
*
|
|
||||||
* Revision 1.25 2005/06/22 00:04:49 steve
|
|
||||||
* Reduce vvp_vector4 copies by using const references.
|
|
||||||
*
|
|
||||||
* Revision 1.24 2005/06/15 00:47:15 steve
|
|
||||||
* Resolv do not propogate inputs that do not change.
|
|
||||||
*
|
|
||||||
* Revision 1.23 2005/04/13 06:34:20 steve
|
|
||||||
* Add vvp driver functor for logic outputs,
|
|
||||||
* Add ostream output operators for debugging.
|
|
||||||
*
|
|
||||||
* Revision 1.22 2005/03/12 04:27:43 steve
|
|
||||||
* Implement VPI access to signal strengths,
|
|
||||||
* Fix resolution of ambiguous drive pairs,
|
|
||||||
* Fix spelling of scalar.
|
|
||||||
*
|
|
||||||
* Revision 1.21 2005/02/13 05:26:30 steve
|
|
||||||
* tri0 and tri1 resolvers must replace HiZ with 0/1 after resolution.
|
|
||||||
*
|
|
||||||
* Revision 1.20 2005/01/09 20:11:16 steve
|
|
||||||
* Add the .part/pv node and related functionality.
|
|
||||||
*
|
|
||||||
* Revision 1.19 2004/12/31 06:00:06 steve
|
|
||||||
* Implement .resolv functors, and stub signals recv_vec8 method.
|
|
||||||
*
|
|
||||||
* Revision 1.18 2004/12/11 02:31:30 steve
|
|
||||||
* Rework of internals to carry vectors through nexus instead
|
|
||||||
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
|
|
||||||
* down this path.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
class resolv_functor : public vvp_net_fun_t {
|
class resolv_functor : public vvp_net_fun_t {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit resolv_functor(vvp_scalar_t hiz_value);
|
explicit resolv_functor(vvp_scalar_t hiz_value, const char* debug =0);
|
||||||
~resolv_functor();
|
~resolv_functor();
|
||||||
|
|
||||||
void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit);
|
void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit);
|
||||||
|
|
@ -51,7 +51,10 @@ class resolv_functor : public vvp_net_fun_t {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vvp_vector8_t val_[4];
|
vvp_vector8_t val_[4];
|
||||||
|
// Bit value to emit for HiZ bits.
|
||||||
vvp_scalar_t hiz_;
|
vvp_scalar_t hiz_;
|
||||||
|
// True if debugging is enabled
|
||||||
|
const char* debug_label_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue