diff --git a/vvp/debug.cc b/vvp/debug.cc index fb2bfecc9..d8995cb65 100644 --- a/vvp/debug.cc +++ b/vvp/debug.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: debug.cc,v 1.7 2001/09/15 18:27:05 steve Exp $" +#ident "$Id: debug.cc,v 1.8 2001/12/18 05:32:11 steve Exp $" #endif /* @@ -71,7 +71,7 @@ static void cmd_fbreak(unsigned argc, char*argv[]) continue; } - fp->breakpoint = 1; + fp->break_flag = 1; } } @@ -92,15 +92,7 @@ static void cmd_functor(unsigned argc, char*argv[]) continue; } - printf("0x%x: out pointer = 0x%x\n", fnc, fp->out); - printf("0x%x: input values = %c (%02x) %c (%02x)" - " %c (%02x) %c (%02x)\n", fnc, - bitval_tab[fp->ival&3], fp->istr[0], - bitval_tab[(fp->ival>>2)&3], fp->istr[1], - bitval_tab[(fp->ival>>4)&3], fp->istr[2], - bitval_tab[(fp->ival>>6)&3], fp->istr[3]); - printf("0x%x: out value = %c (%02x)\n", fnc, - bitval_tab[fp->oval], fp->ostr); + fp->debug_print(fnc); } } @@ -173,6 +165,9 @@ void breakpoint(void) #endif /* * $Log: debug.cc,v $ + * Revision 1.8 2001/12/18 05:32:11 steve + * Improved functor debug dumps. + * * Revision 1.7 2001/09/15 18:27:05 steve * Make configure detect malloc.h * diff --git a/vvp/functor.cc b/vvp/functor.cc index 2e2a9bdf3..9e8f3102b 100644 --- a/vvp/functor.cc +++ b/vvp/functor.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: functor.cc,v 1.36 2001/12/14 01:59:28 steve Exp $" +#ident "$Id: functor.cc,v 1.37 2001/12/18 05:32:11 steve Exp $" #endif # include "functor.h" @@ -123,7 +123,7 @@ functor_s::functor_s() cstr = StX; inhibit = 0; #if defined(WITH_DEBUG) - breakpoint = 0; + break_flag = 0; #endif } @@ -170,8 +170,35 @@ void extra_inputs_functor_s::set(vvp_ipoint_t i, bool push, edge_inputs_functor_s::~edge_inputs_functor_s() {} +#ifdef WITH_DEBUG +# include +static const char bitval_tab[4] = { '0', '1', 'x', 'z' }; + +void functor_s::debug_print(vvp_ipoint_t fnc) +{ + printf("0x%x: out pointer =", fnc); + vvp_ipoint_t cur = out; + while (cur) { + printf(" 0x%x", cur); + functor_t tmp = functor_index(cur); + cur = tmp->port[cur&3]; + } + printf("\n"); + printf("0x%x: input values = %c %c %c %c\n", fnc, + bitval_tab[ival&3], + bitval_tab[(ival>>2)&3], + bitval_tab[(ival>>4)&3], + bitval_tab[(ival>>6)&3]); + printf("0x%x: out value = %c (%02x)\n", fnc, + bitval_tab[get_oval()], get_ostr()); +} +#endif + /* * $Log: functor.cc,v $ + * Revision 1.37 2001/12/18 05:32:11 steve + * Improved functor debug dumps. + * * Revision 1.36 2001/12/14 01:59:28 steve * Better variable names for functor chunks. * @@ -201,73 +228,5 @@ edge_inputs_functor_s::~edge_inputs_functor_s() * * Revision 1.28 2001/10/27 03:43:56 steve * Propagate functor push, to make assign better. - * - * Revision 1.27 2001/10/12 03:00:09 steve - * M42 implementation of mode 2 (Stephan Boettcher) - * - * Revision 1.26 2001/08/08 01:05:06 steve - * Initial implementation of vvp_fvectors. - * (Stephan Boettcher) - * - * Revision 1.25 2001/07/30 03:53:01 steve - * Initialize initial functor tables. - * - * Revision 1.24 2001/07/16 18:06:01 steve - * Initialize allocated functors (Stephan Boettcher) - * - * Revision 1.23 2001/06/21 22:54:12 steve - * Support cbValueChange callbacks. - * - * Revision 1.22 2001/05/31 04:12:43 steve - * Make the bufif0 and bufif1 gates strength aware, - * and accurately propagate strengths of outputs. - * - * Revision 1.21 2001/05/30 03:02:35 steve - * Propagate strength-values instead of drive strengths. - * - * Revision 1.20 2001/05/12 20:38:06 steve - * A resolver that understands some simple strengths. - * - * Revision 1.19 2001/05/09 04:23:18 steve - * Now that the interactive debugger exists, - * there is no use for the output dump. - * - * Revision 1.18 2001/05/09 02:53:25 steve - * Implement the .resolv syntax. - * - * Revision 1.17 2001/05/08 23:32:26 steve - * Add to the debugger the ability to view and - * break on functors. - * - * Add strengths to functors at compile time, - * and Make functors pass their strengths as they - * propagate their output. - * - * Revision 1.16 2001/05/06 03:51:37 steve - * Regularize the mode-42 functor handling. - * - * Revision 1.15 2001/05/03 04:54:33 steve - * Fix handling of a mode 1 functor that feeds into a - * mode 2 functor. Feed the result only if the event - * is triggered, and do pass to the output even if no - * threads are waiting. - * - * Revision 1.14 2001/04/26 15:52:22 steve - * Add the mode-42 functor concept to UDPs. - * - * Revision 1.13 2001/04/24 02:23:59 steve - * Support for UDP devices in VVP (Stephen Boettcher) - * - * Revision 1.12 2001/04/18 04:21:23 steve - * Put threads into scopes. - * - * Revision 1.11 2001/04/14 05:10:56 steve - * support the .event/or statement. - * - * Revision 1.10 2001/04/03 03:18:34 steve - * support functor_set push for blocking assignment. - * - * Revision 1.9 2001/03/31 19:29:23 steve - * Fix compilation warnings. */ diff --git a/vvp/functor.h b/vvp/functor.h index 2cef85a39..739f32dde 100644 --- a/vvp/functor.h +++ b/vvp/functor.h @@ -19,11 +19,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: functor.h,v 1.41 2001/12/14 01:59:28 steve Exp $" +#ident "$Id: functor.h,v 1.42 2001/12/18 05:32:11 steve Exp $" #endif # include "pointers.h" # include "delay.h" +#ifdef ENABLE_VVP_DEBUG +# include "debug.h" +#endif /* * The vvp_ipoint_t is an integral type that is 32bits. The low 2 bits @@ -174,7 +177,8 @@ struct functor_s { public: #if defined(WITH_DEBUG) /* True if this functor triggers a breakpoint. */ - unsigned breakpoint : 1; + unsigned break_flag : 1; + virtual void debug_print(vvp_ipoint_t fnc); #endif public: @@ -220,7 +224,7 @@ inline void functor_s::propagate(unsigned val, unsigned str, bool push) } #if defined(WITH_DEBUG) - if (breakpoint) + if (break_flag) breakpoint(); #endif } @@ -299,7 +303,7 @@ void functor_set(vvp_ipoint_t ptr, unsigned val, unsigned str, bool push = true) fp->set(ptr, push, val, str); #if defined(WITH_DEBUG) - if (fp->breakpoint) + if (fp->break_flag) breakpoint(); #endif } @@ -375,6 +379,9 @@ extern vvp_fvector_t vvp_fvector_continuous_new(unsigned size, vvp_ipoint_t p); /* * $Log: functor.h,v $ + * Revision 1.42 2001/12/18 05:32:11 steve + * Improved functor debug dumps. + * * Revision 1.41 2001/12/14 01:59:28 steve * Better variable names for functor chunks. * diff --git a/vvp/resolv.cc b/vvp/resolv.cc index 35ef2de40..f1496bbc2 100644 --- a/vvp/resolv.cc +++ b/vvp/resolv.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: resolv.cc,v 1.11 2001/12/15 02:11:51 steve Exp $" +#ident "$Id: resolv.cc,v 1.12 2001/12/18 05:32:11 steve Exp $" #endif # include "resolv.h" @@ -185,8 +185,25 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str) put_ostr(val, sval, false); } +#ifdef WITH_DEBUG +# include + +static const char bitval_tab[4] = { '0', '1', 'x', 'z' }; +void resolv_functor_s::debug_print(vvp_ipoint_t fnc) +{ + printf("0x%x: Resolver tied to %02x\n", fnc, hiz_); + printf("0x%x: input strengths = %02x %02x %02x %02x\n", fnc, + istr[0], istr[1], istr[2], istr[3]); + functor_s::debug_print(fnc); +} +#endif + + /* * $Log: resolv.cc,v $ + * Revision 1.12 2001/12/18 05:32:11 steve + * Improved functor debug dumps. + * * Revision 1.11 2001/12/15 02:11:51 steve * Give tri0 and tri1 their proper strengths. * diff --git a/vvp/resolv.h b/vvp/resolv.h index 027dd5736..e19335f09 100644 --- a/vvp/resolv.h +++ b/vvp/resolv.h @@ -19,9 +19,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: resolv.h,v 1.5 2001/12/15 02:11:51 steve Exp $" +#ident "$Id: resolv.h,v 1.6 2001/12/18 05:32:11 steve Exp $" #endif +# include "config.h" # include "functor.h" /* @@ -38,6 +39,10 @@ class resolv_functor_s: public functor_s { virtual void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str); +#ifdef WITH_DEBUG + void debug_print(vvp_ipoint_t fnc); +#endif + private: unsigned char istr[4]; unsigned char hiz_; @@ -45,6 +50,9 @@ class resolv_functor_s: public functor_s { /* * $Log: resolv.h,v $ + * Revision 1.6 2001/12/18 05:32:11 steve + * Improved functor debug dumps. + * * Revision 1.5 2001/12/15 02:11:51 steve * Give tri0 and tri1 their proper strengths. *