diff --git a/vvp/compile.h b/vvp/compile.h index f72fbcff9..591b491d3 100644 --- a/vvp/compile.h +++ b/vvp/compile.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compile.h,v 1.83 2006/09/23 04:57:19 steve Exp $" +#ident "$Id: compile.h,v 1.84 2006/11/22 06:10:05 steve Exp $" #endif # include @@ -260,16 +260,10 @@ extern void compile_ufunc(char*label, char*code, unsigned wid, * the threads. */ extern void compile_event(char*label, char*type, - unsigned argc, struct symb_s*argv); + unsigned argc, struct symb_s*argv, + bool debug_flag); extern void compile_named_event(char*label, char*type); -#if 0 -/* - * Word declarations include a label, a type symbol, and a vpi name. - * TAKEN OVER BY compile_var_real. - */ -extern void compile_word(char*label, char*type, char*name); -#endif /* * A code statement is a label, an opcode and up to 3 operands. There @@ -352,6 +346,9 @@ extern void compile_alias_real(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.84 2006/11/22 06:10:05 steve + * Fix spurious event from net8 that is forced. + * * Revision 1.83 2006/09/23 04:57:19 steve * Basic support for specify timing. * diff --git a/vvp/event.cc b/vvp/event.cc index ec0851453..0625a6136 100644 --- a/vvp/event.cc +++ b/vvp/event.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: event.cc,v 1.21 2006/02/21 04:57:26 steve Exp $" +#ident "$Id: event.cc,v 1.22 2006/11/22 06:10:05 steve Exp $" #endif # include "event.h" @@ -33,6 +33,8 @@ # include #endif +# include + void waitable_hooks_s::run_waiting_threads_() { if (threads == 0) @@ -66,8 +68,8 @@ const vvp_fun_edge::edge_t vvp_edge_negedge const vvp_fun_edge::edge_t vvp_edge_none = 0; -vvp_fun_edge::vvp_fun_edge(edge_t e) -: edge_(e) +vvp_fun_edge::vvp_fun_edge(edge_t e, bool debug_flag) +: edge_(e), debug_(debug_flag) { bits_[0] = BIT4_X; bits_[1] = BIT4_X; @@ -96,7 +98,8 @@ void vvp_fun_edge::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) } -vvp_fun_anyedge::vvp_fun_anyedge() +vvp_fun_anyedge::vvp_fun_anyedge(bool debug_flag) +: debug_(debug_flag) { } @@ -164,8 +167,8 @@ void vvp_named_event::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) /* ** Create an event functor -** edge: compile_event(label, type, argc, argv) -** or: compile_event(label, NULL, argc, argv) +** edge: compile_event(label, type, argc, argv, debug_flag) +** or: compile_event(label, NULL, argc, argv, debug_flag) ** ** Named events are handled elsewhere. */ @@ -173,7 +176,8 @@ void vvp_named_event::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) static void compile_event_or(char*label, unsigned argc, struct symb_s*argv); void compile_event(char*label, char*type, - unsigned argc, struct symb_s*argv) + unsigned argc, struct symb_s*argv, + bool debug_flag) { vvp_net_fun_t*fun = 0; @@ -185,7 +189,7 @@ void compile_event(char*label, char*type, if (strcmp(type,"edge") == 0) { free(type); - fun = new vvp_fun_anyedge; + fun = new vvp_fun_anyedge(debug_flag); } else { @@ -199,7 +203,7 @@ void compile_event(char*label, char*type, assert(argc <= 4); free(type); - fun = new vvp_fun_edge(edge); + fun = new vvp_fun_edge(edge, debug_flag); } vvp_net_t* ptr = new vvp_net_t; @@ -250,6 +254,9 @@ void compile_named_event(char*label, char*name) /* * $Log: event.cc,v $ + * Revision 1.22 2006/11/22 06:10:05 steve + * Fix spurious event from net8 that is forced. + * * Revision 1.21 2006/02/21 04:57:26 steve * Callbacks for named event triggers. * diff --git a/vvp/event.h b/vvp/event.h index a0f196694..39a204e2c 100644 --- a/vvp/event.h +++ b/vvp/event.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: event.h,v 1.11 2005/06/22 00:04:49 steve Exp $" +#ident "$Id: event.h,v 1.12 2006/11/22 06:10:05 steve Exp $" #endif # include "vvp_net.h" @@ -52,7 +52,7 @@ class vvp_fun_edge : public vvp_net_fun_t, public waitable_hooks_s { public: typedef unsigned short edge_t; - explicit vvp_fun_edge(edge_t e); + explicit vvp_fun_edge(edge_t e, bool debug_flag); virtual ~vvp_fun_edge(); @@ -61,6 +61,7 @@ class vvp_fun_edge : public vvp_net_fun_t, public waitable_hooks_s { private: vvp_bit4_t bits_[4]; edge_t edge_; + bool debug_; }; extern const vvp_fun_edge::edge_t vvp_edge_posedge; @@ -76,12 +77,13 @@ extern const vvp_fun_edge::edge_t vvp_edge_none; class vvp_fun_anyedge : public vvp_net_fun_t, public waitable_hooks_s { public: - explicit vvp_fun_anyedge(); + explicit vvp_fun_anyedge(bool debug_flag); virtual ~vvp_fun_anyedge(); void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit); private: + bool debug_; vvp_vector4_t bits_[4]; }; @@ -120,6 +122,9 @@ class vvp_named_event : public vvp_net_fun_t, public waitable_hooks_s { /* * $Log: event.h,v $ + * Revision 1.12 2006/11/22 06:10:05 steve + * Fix spurious event from net8 that is forced. + * * Revision 1.11 2005/06/22 00:04:49 steve * Reduce vvp_vector4 copies by using const references. * diff --git a/vvp/lexor.lex b/vvp/lexor.lex index 59b63f0b2..2db436db7 100644 --- a/vvp/lexor.lex +++ b/vvp/lexor.lex @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: lexor.lex,v 1.63 2006/09/23 04:57:20 steve Exp $" +#ident "$Id: lexor.lex,v 1.64 2006/11/22 06:10:05 steve Exp $" #endif # include "parse_misc.h" @@ -148,6 +148,7 @@ ".mem" { return K_MEM; } ".mem/p"(ort)? { return K_MEM_P; } ".mem/i"(nit)? { return K_MEM_I; } +"-debug" { return K_DEBUG; } /* instructions start with a % character. The compiler decides what kind of instruction this really is. The few exceptions (that have @@ -211,6 +212,9 @@ int yywrap() /* * $Log: lexor.lex,v $ + * Revision 1.64 2006/11/22 06:10:05 steve + * Fix spurious event from net8 that is forced. + * * Revision 1.63 2006/09/23 04:57:20 steve * Basic support for specify timing. * diff --git a/vvp/parse.y b/vvp/parse.y index 7b51c9ea5..b395d132f 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: parse.y,v 1.85 2006/09/23 04:57:20 steve Exp $" +#ident "$Id: parse.y,v 1.86 2006/11/22 06:10:05 steve Exp $" #endif # include "parse_misc.h" @@ -70,7 +70,7 @@ static vvp_fun_modpath*modpath_dst = 0; %token K_ARITH_SUB K_ARITH_SUB_R K_ARITH_SUM %token K_CMP_EEQ K_CMP_EQ K_CMP_NEE K_CMP_NE %token K_CMP_GE K_CMP_GE_S K_CMP_GT K_CMP_GT_S -%token K_CONCAT K_DELAY K_DFF +%token K_CONCAT K_DEBUG K_DELAY K_DFF %token K_EVENT K_EVENT_OR K_EXTEND_S K_FUNCTOR K_MODPATH K_NET K_NET_S K_NET_R %token K_NET8 K_NET8_S %token K_PARAM_STR K_PARAM_L K_PART K_PART_PV @@ -372,13 +372,16 @@ statement named event instead. */ | T_LABEL K_EVENT T_SYMBOL ',' symbols ';' - { compile_event($1, $3, $5.cnt, $5.vect); } + { compile_event($1, $3, $5.cnt, $5.vect, false); } + + | T_LABEL K_EVENT K_DEBUG T_SYMBOL ',' symbols ';' + { compile_event($1, $4, $6.cnt, $6.vect, true); } | T_LABEL K_EVENT T_STRING ';' { compile_named_event($1, $3); } | T_LABEL K_EVENT_OR symbols ';' - { compile_event($1, 0, $3.cnt, $3.vect); } + { compile_event($1, 0, $3.cnt, $3.vect, false); } /* Instructions may have a label, and have zero or more @@ -778,6 +781,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.86 2006/11/22 06:10:05 steve + * Fix spurious event from net8 that is forced. + * * Revision 1.85 2006/09/23 04:57:20 steve * Basic support for specify timing. * diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index af7a5a97a..ba7dd0456 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: vvp_net.cc,v 1.54 2006/07/08 21:48:00 steve Exp $" +#ident "$Id: vvp_net.cc,v 1.55 2006/11/22 06:10:05 steve Exp $" # include "config.h" # include "vvp_net.h" @@ -1570,8 +1570,7 @@ void vvp_fun_signal8::recv_vec8(vvp_net_ptr_t ptr, vvp_vector8_t bit) if (needs_init_ || !bits8_.eeq(bit)) { bits8_ = bit; needs_init_ = false; - vvp_send_vec8(ptr.ptr()->out, bit); - run_vpi_callbacks(); + calculate_output_(ptr); } } break; @@ -1579,8 +1578,7 @@ void vvp_fun_signal8::recv_vec8(vvp_net_ptr_t ptr, vvp_vector8_t bit) case 1: // Continuous assign value continuous_assign_active_ = true; bits8_ = bit; - vvp_send_vec8(ptr.ptr()->out, bits8_); - run_vpi_callbacks(); + calculate_output_(ptr); break; case 2: // Force value @@ -1593,8 +1591,7 @@ void vvp_fun_signal8::recv_vec8(vvp_net_ptr_t ptr, vvp_vector8_t bit) force_ = bit; force_mask_ = vvp_vector2_t(vvp_vector2_t::FILL1, size()); - vvp_send_vec8(ptr.ptr()->out, force_); - run_vpi_callbacks(); + calculate_output_(ptr); break; default: @@ -1603,6 +1600,25 @@ void vvp_fun_signal8::recv_vec8(vvp_net_ptr_t ptr, vvp_vector8_t bit) } } +void vvp_fun_signal8::calculate_output_(vvp_net_ptr_t ptr) +{ + if (force_mask_.size()) { + assert(bits8_.size() == force_mask_.size()); + assert(bits8_.size() == force_.size()); + vvp_vector8_t bits (bits8_); + for (unsigned idx = 0 ; idx < bits.size() ; idx += 1) { + if (force_mask_.value(idx)) + bits.set_bit(idx, force_.value(idx)); + } + vvp_send_vec8(ptr.ptr()->out, bits); + + } else { + vvp_send_vec8(ptr.ptr()->out, bits8_); + } + + run_vpi_callbacks(); +} + void vvp_fun_signal8::release(vvp_net_ptr_t ptr, bool net) { force_mask_ = vvp_vector2_t(); @@ -2193,6 +2209,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a, /* * $Log: vvp_net.cc,v $ + * Revision 1.55 2006/11/22 06:10:05 steve + * Fix spurious event from net8 that is forced. + * * Revision 1.54 2006/07/08 21:48:00 steve * Delay object supports real valued delays. *