diff --git a/vvp/compile.cc b/vvp/compile.cc index 1a67a23fc..77ee4dee7 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compile.cc,v 1.202 2005/05/24 01:43:27 steve Exp $" +#ident "$Id: compile.cc,v 1.203 2005/05/25 05:44:51 steve Exp $" #endif # include "arith.h" @@ -36,6 +36,7 @@ #ifdef HAVE_MALLOC_H # include #endif +# include # include # include # include @@ -765,6 +766,9 @@ void input_connect(vvp_net_t*fdx, unsigned port, char*label) void inputs_connect(vvp_net_t*fdx, unsigned argc, struct symb_s*argv) { + if (argc > 4) { + cerr << "XXXX argv[0] = " << argv[0].text << endl; + } assert(argc <= 4); for (unsigned idx = 0; idx < argc; idx += 1) { @@ -1543,6 +1547,9 @@ void compile_param_string(char*label, char*name, char*str, char*value) /* * $Log: compile.cc,v $ + * Revision 1.203 2005/05/25 05:44:51 steve + * Handle event/or with specific, efficient nodes. + * * Revision 1.202 2005/05/24 01:43:27 steve * Add a sign-extension node. * diff --git a/vvp/event.cc b/vvp/event.cc index 520983f50..3679d7bb2 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.17 2004/12/29 23:45:13 steve Exp $" +#ident "$Id: event.cc,v 1.18 2005/05/25 05:44:51 steve Exp $" #endif # include "event.h" @@ -130,6 +130,21 @@ void vvp_fun_anyedge::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit) } } +vvp_fun_event_or::vvp_fun_event_or() +{ +} + +vvp_fun_event_or::~vvp_fun_event_or() +{ +} + +void vvp_fun_event_or::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit) +{ + run_waiting_threads_(); + vvp_net_t*net = port.ptr(); + vvp_send_vec4(net->out, bit); +} + vvp_named_event::vvp_named_event(struct __vpiHandle*h) { handle_ = h; @@ -154,12 +169,19 @@ void vvp_named_event::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit) ** Named events are handled elsewhere. */ +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) { vvp_net_fun_t*fun = 0; - if (type && (strcmp(type,"edge") == 0) ) { + if (type == 0) { + compile_event_or(label, argc, argv); + return; + } + + if (strcmp(type,"edge") == 0) { free(type); fun = new vvp_fun_anyedge; @@ -168,15 +190,13 @@ void compile_event(char*label, char*type, vvp_fun_edge::edge_t edge = vvp_edge_none; - if (type) { - if (strcmp(type,"posedge") == 0) - edge = vvp_edge_posedge; - else if (strcmp(type,"negedge") == 0) - edge = vvp_edge_negedge; + if (strcmp(type,"posedge") == 0) + edge = vvp_edge_posedge; + else if (strcmp(type,"negedge") == 0) + edge = vvp_edge_negedge; - assert(argc <= 4); - free(type); - } + assert(argc <= 4); + free(type); fun = new vvp_fun_edge(edge); } @@ -190,6 +210,23 @@ void compile_event(char*label, char*type, inputs_connect(ptr, argc, argv); } +static void compile_event_or(char*label, unsigned argc, struct symb_s*argv) +{ + vvp_net_fun_t*fun = new vvp_fun_event_or; + vvp_net_t* ptr = new vvp_net_t; + ptr->fun = fun; + + define_functor_symbol(label, ptr); + free(label); + + /* This is a very special case. Point all the source inputs to + the same input. It doesn't matter that the streams get + tangled because data values are irrelevant. */ + for (unsigned idx = 0 ; idx < argc ; idx += 1) { + input_connect(ptr, 0, argv[idx].text); + } +} + /* * This handles the compile of named events. This functor has no * inputs, it is only accessed by behavioral trigger statements, which @@ -212,6 +249,9 @@ void compile_named_event(char*label, char*name) /* * $Log: event.cc,v $ + * Revision 1.18 2005/05/25 05:44:51 steve + * Handle event/or with specific, efficient nodes. + * * Revision 1.17 2004/12/29 23:45:13 steve * Add the part concatenation node (.concat). * diff --git a/vvp/event.h b/vvp/event.h index 5a94ccc6a..f172763db 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.8 2004/12/29 23:45:13 steve Exp $" +#ident "$Id: event.h,v 1.9 2005/05/25 05:44:51 steve Exp $" #endif # include "vvp_net.h" @@ -83,6 +83,21 @@ class vvp_fun_anyedge : public vvp_net_fun_t, public waitable_hooks_s { vvp_vector4_t bits_[4]; }; +/* + * This functor triggers anytime any input is set, no matter what the + * value. This is similar to a named event, but it has no handle. + */ +class vvp_fun_event_or : public vvp_net_fun_t, public waitable_hooks_s { + + public: + explicit vvp_fun_event_or(); + ~vvp_fun_event_or(); + + void recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit); + + private: +}; + /* * A named event is simpler then a vvp_fun_edge in that it triggers on * any input at all to port-0. The idea here is that behavioral code @@ -103,6 +118,9 @@ class vvp_named_event : public vvp_net_fun_t, public waitable_hooks_s { /* * $Log: event.h,v $ + * Revision 1.9 2005/05/25 05:44:51 steve + * Handle event/or with specific, efficient nodes. + * * Revision 1.8 2004/12/29 23:45:13 steve * Add the part concatenation node (.concat). *