From fc9a90c9e07b37f85d3b36615f8bd813f01b0bb5 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 2 Mar 2007 06:13:22 +0000 Subject: [PATCH] Add support for edge sensitive spec paths. --- design_dump.cc | 10 +++++++-- elaborate.cc | 17 ++++++--------- ivl.def | 2 ++ ivl_target.h | 20 ++++++++++++----- netlist.cc | 27 ++++++++++++++++++++++- netlist.h | 12 +++++++++- t-dll-api.cc | 15 ++++++++++++- t-dll.cc | 7 +++++- t-dll.h | 7 +++++- tgt-stub/stub.c | 9 +++++++- tgt-vvp/vvp_scope.c | 10 +++++++-- vvp/compile.cc | 53 +++++++++++++++++++++++++++++++++++---------- vvp/compile.h | 7 +++++- vvp/delay.cc | 33 ++++++++++++++++++++++++++-- vvp/delay.h | 22 +++++++++++++++++-- vvp/parse.y | 17 ++++++++++++--- vvp/vvp_net.cc | 38 +++++++++++++++++++++++++++++++- vvp/vvp_net.h | 9 +++++++- 18 files changed, 268 insertions(+), 47 deletions(-) diff --git a/design_dump.cc b/design_dump.cc index a4db05df6..af0f396fb 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: design_dump.cc,v 1.173 2007/02/01 03:14:33 steve Exp $" +#ident "$Id: design_dump.cc,v 1.174 2007/03/02 06:13:22 steve Exp $" #endif # include "config.h" @@ -93,7 +93,10 @@ ostream& operator << (ostream&o, ivl_variable_type_t val) void NetDelaySrc::dump(ostream&o, unsigned ind) const { - o << setw(ind) << "" << "specify delay src " + o << setw(ind) << "" << "specify delay"; + if (posedge_) o << " posedge"; + if (negedge_) o << " negedge"; + o << " src " << "(" << transition_delays_[IVL_PE_01] << "," << transition_delays_[IVL_PE_10] << "," << transition_delays_[IVL_PE_0z] @@ -1202,6 +1205,9 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.174 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.173 2007/02/01 03:14:33 steve * Detect and report arrays without index in net contexts. * diff --git a/elaborate.cc b/elaborate.cc index 357e3db1c..f921263ef 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elaborate.cc,v 1.360 2007/03/01 06:19:38 steve Exp $" +#ident "$Id: elaborate.cc,v 1.361 2007/03/02 06:13:22 steve Exp $" #endif # include "config.h" @@ -2934,15 +2934,6 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const } ivl_assert(*this, conditional || (condition==0)); - - if (edge != 0) { - cerr << get_line() << ": sorry: Edge sensitive specify paths" - << " are not supported." << endl; - cerr << get_line() << ": : Use -g no-specify to ignore" - << " specify blocks." << endl; - des->errors += 1; - } - ivl_assert(*this, data_source_expression==0 || edge != 0); ndelays = delays.size(); @@ -3027,6 +3018,9 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const src.size(), condit_sig); path->set_line(*this); + if (edge > 0) path->set_posedge(); + if (edge < 0) path->set_negedge(); + switch (ndelays) { case 12: path->set_delays(delay_value[0], delay_value[1], @@ -3394,6 +3388,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.361 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.360 2007/03/01 06:19:38 steve * Add support for conditional specify delay paths. * diff --git a/ivl.def b/ivl.def index 9e34244ca..745a47b52 100644 --- a/ivl.def +++ b/ivl.def @@ -112,6 +112,8 @@ ivl_parameter_expr ivl_path_condit ivl_path_delay ivl_path_source +ivl_path_source_negedge +ivl_path_source_posedge ivl_scope_attr_cnt ivl_scope_attr_val diff --git a/ivl_target.h b/ivl_target.h index bfe01f1f7..422ea8c89 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: ivl_target.h,v 1.179 2007/03/01 06:19:38 steve Exp $" +#ident "$Id: ivl_target.h,v 1.180 2007/03/02 06:13:22 steve Exp $" #endif # include @@ -387,15 +387,22 @@ typedef const struct ivl_attribute_s*ivl_attribute_t; * This returns the nexus that is the source end of the delay * path. Transitions on the source are the start of the delay time * for this path. -* -* ivl_path_condit -* This returns the nexus that tracks the condition for the -* delay. If the delay path is unconditional, this returns nil. + * + * ivl_path_condit + * This returns the nexus that tracks the condition for the + * delay. If the delay path is unconditional, this returns nil. + * + * ivl_path_srouce_posedge + * ivl_path_source_negedge + * These functions return true if the source is edge sensitive. */ extern ivl_nexus_t ivl_path_source(ivl_delaypath_t obj); extern uint64_t ivl_path_delay(ivl_delaypath_t obj, ivl_path_edge_t pt); extern ivl_nexus_t ivl_path_condit(ivl_delaypath_t obj); +extern int ivl_path_source_posedge(ivl_delaypath_t obj); +extern int ivl_path_source_negedge(ivl_delaypath_t obj); + /* DESIGN * When handed a design (ivl_design_t) there are a few things that you * can do with it. The Verilog program has one design that carries the @@ -1772,6 +1779,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.180 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.179 2007/03/01 06:19:38 steve * Add support for conditional specify delay paths. * diff --git a/netlist.cc b/netlist.cc index 7eeaebb3f..37778f481 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: netlist.cc,v 1.255 2007/03/01 06:19:38 steve Exp $" +#ident "$Id: netlist.cc,v 1.256 2007/03/02 06:13:22 steve Exp $" #endif # include "config.h" @@ -242,6 +242,8 @@ NetDelaySrc::NetDelaySrc(NetScope*s, perm_string n, : NetObj(s, n, npins + (condit_src?1:0)) { condit_flag_ = false; + posedge_ = false; + negedge_ = false; for (unsigned idx = 0 ; idx < npins ; idx += 1) { pin(idx).set_name(perm_string::literal("I"), idx); pin(idx).set_dir(Link::INPUT); @@ -338,6 +340,26 @@ uint64_t NetDelaySrc::get_delay(unsigned idx) const return transition_delays_[idx]; } +void NetDelaySrc::set_posedge() +{ + posedge_ = true; +} + +void NetDelaySrc::set_negedge() +{ + negedge_ = true; +} + +bool NetDelaySrc::is_posedge() const +{ + return posedge_; +} + +bool NetDelaySrc::is_negedge() const +{ + return negedge_; +} + unsigned NetDelaySrc::src_count() const { if (condit_flag_) @@ -2265,6 +2287,9 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.256 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.255 2007/03/01 06:19:38 steve * Add support for conditional specify delay paths. * diff --git a/netlist.h b/netlist.h index 4ad593f87..9726f8bdd 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: netlist.h,v 1.370 2007/03/01 06:19:38 steve Exp $" +#ident "$Id: netlist.h,v 1.371 2007/03/02 06:13:22 steve Exp $" #endif /* @@ -402,6 +402,11 @@ class NetDelaySrc : public NetObj { uint64_t get_delay(unsigned pe) const; + void set_posedge(); + void set_negedge(); + bool is_posedge() const; + bool is_negedge() const; + unsigned src_count() const; Link&src_pin(unsigned); const Link&src_pin(unsigned) const; @@ -415,6 +420,8 @@ class NetDelaySrc : public NetObj { private: uint64_t transition_delays_[12]; bool condit_flag_; + bool posedge_; + bool negedge_; private: // Not implemented NetDelaySrc(const NetDelaySrc&); @@ -3485,6 +3492,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.371 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.370 2007/03/01 06:19:38 steve * Add support for conditional specify delay paths. * diff --git a/t-dll-api.cc b/t-dll-api.cc index 54b5873d1..1d94dc593 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll-api.cc,v 1.141 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.142 2007/03/02 06:13:22 steve Exp $" #endif # include "config.h" @@ -1259,6 +1259,16 @@ extern ivl_nexus_t ivl_path_source(ivl_delaypath_t net) return net->src; } +extern int ivl_path_source_posedge(ivl_delaypath_t net) +{ + return net->posedge ? 1 : 0; +} + +extern int ivl_path_source_negedge(ivl_delaypath_t net) +{ + return net->negedge ? 1 : 0; +} + extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net) { return net->type_; @@ -1940,6 +1950,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.142 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.141 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/t-dll.cc b/t-dll.cc index 1c5a42028..c7b93c133 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll.cc,v 1.165 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: t-dll.cc,v 1.166 2007/03/02 06:13:22 steve Exp $" #endif # include "config.h" @@ -2180,6 +2180,8 @@ bool dll_target::signal_paths(const NetNet*net) assert(nex->t_cookie()); obj->path[ptr].src = (ivl_nexus_t) nex->t_cookie(); obj->path[ptr].condit = path_condit; + obj->path[ptr].posedge = src->is_posedge(); + obj->path[ptr].negedge = src->is_negedge(); for (unsigned pe = 0 ; pe < 12 ; pe += 1) { obj->path[ptr].delay[pe] = src->get_delay(pe); } @@ -2197,6 +2199,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.166 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.165 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/t-dll.h b/t-dll.h index 629a86eef..d13d34182 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll.h,v 1.138 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: t-dll.h,v 1.139 2007/03/02 06:13:22 steve Exp $" #endif # include "target.h" @@ -176,6 +176,8 @@ struct dll_target : public target_t, public expr_scan_t { struct ivl_delaypath_s { ivl_nexus_t src; ivl_nexus_t condit; + bool posedge; + bool negedge; uint64_t delay[12]; }; @@ -667,6 +669,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.139 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.138 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index f1fa0d9dd..816d6bf87 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: stub.c,v 1.146 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: stub.c,v 1.147 2007/03/02 06:13:22 steve Exp $" #endif /* @@ -1131,8 +1131,12 @@ static void show_signal(ivl_signal_t net) ivl_delaypath_t path = ivl_signal_path(net,idx); ivl_nexus_t nex = ivl_path_source(path); ivl_nexus_t con = ivl_path_condit(path); + int posedge = ivl_path_source_posedge(path); + int negedge = ivl_path_source_negedge(path); fprintf(out, " path %s", ivl_nexus_name(nex)); + if (posedge) fprintf(out, " posedge"); + if (negedge) fprintf(out, " negedge"); if (con) fprintf(out, " (if %s)", ivl_nexus_name(con)); fprintf(out, " %" PRIu64 ",%" PRIu64 ",%" PRIu64 " %" PRIu64 ",%" PRIu64 ",%" PRIu64 @@ -1487,6 +1491,9 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.147 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.146 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index ab7d4c69a..ed5d80a39 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_scope.c,v 1.154 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.155 2007/03/02 06:13:22 steve Exp $" #endif # include "vvp_priv.h" @@ -693,7 +693,10 @@ static void draw_modpath(const char*label, const char*driver, for (idx = 0 ; idx < ivl_signal_npath(path_sig); idx += 1) { ivl_delaypath_t path = ivl_signal_path(path_sig, idx); - fprintf(vvp_out, ",\n %s", src_drivers[idx]); + int ppos = ivl_path_source_posedge(path); + int pneg = ivl_path_source_negedge(path); + const char*edge = ppos? " +" : pneg ? " -" : ""; + fprintf(vvp_out, ",\n %s%s", src_drivers[idx], edge); fprintf(vvp_out, " (%"PRIu64",%"PRIu64",%"PRIu64 ", %"PRIu64",%"PRIu64",%"PRIu64 @@ -2366,6 +2369,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.155 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.154 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/vvp/compile.cc b/vvp/compile.cc index 93eb7d793..62ee9933e 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.229 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: compile.cc,v 1.230 2007/03/02 06:13:22 steve Exp $" #endif # include "arith.h" @@ -1099,22 +1099,49 @@ vvp_fun_modpath* compile_modpath(char*label, struct symb_s src) return obj; } -static vvp_net_t*make_modpath_src(vvp_fun_modpath*dst, - struct symb_s src, - struct numbv_s vals) +static vvp_net_t*make_modpath_src(vvp_fun_modpath*dst, char edge, + struct symb_s src, struct numbv_s vals) { vvp_time64_t use_delay[12]; assert(vals.cnt == 12); - for (unsigned idx = 0 ; idx < vals.cnt ; idx += 1) { use_delay[idx] = vals.nvec[idx]; } numbv_clear(&vals); + vvp_fun_modpath_src*obj = 0; + + if (edge == 0) { + obj = new vvp_fun_modpath_src(use_delay); + + } else { + bool posedge, negedge; + switch (edge) { + case 0: + posedge = false; + negedge = false; + break; + case '+': + posedge = true; + negedge = false; + break; + case '-': + posedge = false; + negedge = true; + break; + case '*': + posedge = true; + negedge = false; + break; + default: + assert(0); + } + obj = new vvp_fun_modpath_edge(use_delay, posedge, negedge); + } + vvp_net_t*net = new vvp_net_t; - vvp_fun_modpath_src*obj = new vvp_fun_modpath_src(use_delay); net->fun = obj; input_connect(net, 0, src.text); @@ -1123,19 +1150,18 @@ static vvp_net_t*make_modpath_src(vvp_fun_modpath*dst, return net; } -void compile_modpath_src(vvp_fun_modpath*dst, - struct symb_s src, - struct numbv_s vals) +void compile_modpath_src(vvp_fun_modpath*dst, char edge, + struct symb_s src, struct numbv_s vals) { - make_modpath_src(dst, src, vals); + make_modpath_src(dst, edge, src, vals); } -void compile_modpath_src(vvp_fun_modpath*dst, +void compile_modpath_src(vvp_fun_modpath*dst, char edge, struct symb_s src, struct numbv_s vals, struct symb_s condit_src) { - vvp_net_t*net = make_modpath_src(dst, src, vals); + vvp_net_t*net = make_modpath_src(dst, edge, src, vals); input_connect(net, 1, condit_src.text); } @@ -1597,6 +1623,9 @@ void compile_param_string(char*label, char*name, char*value) /* * $Log: compile.cc,v $ + * Revision 1.230 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.229 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/vvp/compile.h b/vvp/compile.h index 827b31986..6c2cc8ca4 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.86 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: compile.h,v 1.87 2007/03/02 06:13:22 steve Exp $" #endif # include @@ -164,9 +164,11 @@ extern void compile_dff(char*label, class vvp_fun_modpath; extern vvp_fun_modpath* compile_modpath(char*label, struct symb_s src); extern void compile_modpath_src(vvp_fun_modpath*dst, + char edge, struct symb_s input, struct numbv_s d); extern void compile_modpath_src(vvp_fun_modpath*dst, + char edge, struct symb_s input, struct numbv_s d, struct symb_s condit_input); @@ -366,6 +368,9 @@ extern void compile_alias_real(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.87 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.86 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/vvp/delay.cc b/vvp/delay.cc index 401c4bf76..8a3bdb9d8 100644 --- a/vvp/delay.cc +++ b/vvp/delay.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: delay.cc,v 1.17 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: delay.cc,v 1.18 2007/03/02 06:13:22 steve Exp $" #endif #include "delay.h" @@ -440,7 +440,8 @@ void vvp_fun_modpath_src::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) { if (port.port() == 0) { // The modpath input... - wake_time_ = schedule_simtime(); + if (test_vec4(bit)) + wake_time_ = schedule_simtime(); } else if (port.port() == 1) { // The modpath condition input... @@ -451,8 +452,36 @@ void vvp_fun_modpath_src::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) } } +bool vvp_fun_modpath_src::test_vec4(const vvp_vector4_t&) +{ + return true; +} + +vvp_fun_modpath_edge::vvp_fun_modpath_edge(vvp_time64_t del[12], + bool pos, bool neg) +: vvp_fun_modpath_src(del) +{ + old_value_ = BIT4_X; + posedge_ = pos; + negedge_ = neg; +} + +bool vvp_fun_modpath_edge::test_vec4(const vvp_vector4_t&bit) +{ + vvp_bit4_t tmp = old_value_; + old_value_ = bit.value(0); + + int edge_flag = edge(tmp, old_value_); + if (edge_flag > 0) return posedge_; + if (edge_flag < 0) return negedge_; + return false; +} + /* * $Log: delay.cc,v $ + * Revision 1.18 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.17 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/vvp/delay.h b/vvp/delay.h index 5875f066e..7aea03e3c 100644 --- a/vvp/delay.h +++ b/vvp/delay.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: delay.h,v 1.14 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: delay.h,v 1.15 2007/03/02 06:13:22 steve Exp $" #endif /* @@ -180,12 +180,14 @@ class vvp_fun_modpath_src : public vvp_net_fun_t { public: vvp_fun_modpath_src(vvp_time64_t d[12]); - private: + protected: ~vvp_fun_modpath_src(); public: void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit); + virtual bool test_vec4(const vvp_vector4_t&bit); + private: // FIXME: Needs to be a 12-value array vvp_time64_t delay_[12]; @@ -200,8 +202,24 @@ class vvp_fun_modpath_src : public vvp_net_fun_t { vvp_fun_modpath_src& operator = (const vvp_fun_modpath_src&); }; +class vvp_fun_modpath_edge : public vvp_fun_modpath_src { + + public: + vvp_fun_modpath_edge(vvp_time64_t del[12], bool pos, bool neg); + + bool test_vec4(const vvp_vector4_t&bit); + + private: + vvp_bit4_t old_value_; + bool posedge_; + bool negedge_; +}; + /* * $Log: delay.h,v $ + * Revision 1.15 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.14 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/vvp/parse.y b/vvp/parse.y index 5d5bafa22..9490db235 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.88 2007/03/01 06:19:39 steve Exp $" +#ident "$Id: parse.y,v 1.89 2007/03/02 06:13:22 steve Exp $" #endif # include "parse_misc.h" @@ -745,9 +745,17 @@ modpath_src_list modpath_src : symbol '(' numbers ')' - { compile_modpath_src(modpath_dst, $1, $3); } + { compile_modpath_src(modpath_dst, 0, $1, $3); } | symbol '(' numbers '?' symbol ')' - { compile_modpath_src(modpath_dst, $1, $3, $5); } + { compile_modpath_src(modpath_dst, 0, $1, $3, $5); } + | symbol '+' '(' numbers ')' + { compile_modpath_src(modpath_dst, '+', $1, $4); } + | symbol '+' '(' numbers '?' symbol ')' + { compile_modpath_src(modpath_dst, '+', $1, $4, $6); } + | symbol '-' '(' numbers ')' + { compile_modpath_src(modpath_dst, '-', $1, $4); } + | symbol '-' '(' numbers '?' symbol ')' + { compile_modpath_src(modpath_dst, '-', $1, $4, $6); } ; udp_table @@ -805,6 +813,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.89 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.88 2007/03/01 06:19:39 steve * Add support for conditional specify delay paths. * diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 4b4d045d7..0d5d6a8e6 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.58 2007/02/05 01:08:10 steve Exp $" +#ident "$Id: vvp_net.cc,v 1.59 2007/03/02 06:13:22 steve Exp $" # include "config.h" # include "vvp_net.h" @@ -130,6 +130,39 @@ ostream& operator<<(ostream&out, vvp_bit4_t bit) return out; } +typedef unsigned short edge_t; + +inline edge_t VVP_EDGE(vvp_bit4_t from, vvp_bit4_t to) +{ + return 1 << ((from << 2) | to); +} + +const edge_t vvp_edge_posedge + = VVP_EDGE(BIT4_0,BIT4_1) + | VVP_EDGE(BIT4_0,BIT4_X) + | VVP_EDGE(BIT4_0,BIT4_Z) + | VVP_EDGE(BIT4_X,BIT4_1) + | VVP_EDGE(BIT4_Z,BIT4_1) + ; + +const edge_t vvp_edge_negedge + = VVP_EDGE(BIT4_1,BIT4_0) + | VVP_EDGE(BIT4_1,BIT4_X) + | VVP_EDGE(BIT4_1,BIT4_Z) + | VVP_EDGE(BIT4_X,BIT4_0) + | VVP_EDGE(BIT4_Z,BIT4_0) + ; + +int edge(vvp_bit4_t from, vvp_bit4_t to) +{ + edge_t mask = VVP_EDGE(from, to); + if (mask & vvp_edge_posedge) + return 1; + if (mask & vvp_edge_negedge) + return -1; + return 0; +} + void vvp_send_vec8(vvp_net_ptr_t ptr, vvp_vector8_t val) { while (struct vvp_net_t*cur = ptr.ptr()) { @@ -2257,6 +2290,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a, /* * $Log: vvp_net.cc,v $ + * Revision 1.59 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.58 2007/02/05 01:08:10 steve * Handle relink of continuous assignment. * diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index a56af8196..beb92cd24 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -18,7 +18,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.h,v 1.55 2007/02/05 01:08:10 steve Exp $" +#ident "$Id: vvp_net.h,v 1.56 2007/03/02 06:13:22 steve Exp $" # include "config.h" # include @@ -76,6 +76,10 @@ extern vvp_bit4_t operator | (vvp_bit4_t a, vvp_bit4_t b); extern vvp_bit4_t operator ^ (vvp_bit4_t a, vvp_bit4_t b); extern ostream& operator<< (ostream&o, vvp_bit4_t a); + /* Return >0, ==0 or <0 if the from-to transition represents a + posedge, no edge, or negedge. */ +extern int edge(vvp_bit4_t from, vvp_bit4_t to); + /* * This class represents scalar values collected into vectors. The * vector values can be accessed individually, or treated as a @@ -1036,6 +1040,9 @@ inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val, /* * $Log: vvp_net.h,v $ + * Revision 1.56 2007/03/02 06:13:22 steve + * Add support for edge sensitive spec paths. + * * Revision 1.55 2007/02/05 01:08:10 steve * Handle relink of continuous assignment. *