From 243cf9416562380282e82bb885b81bb7b7e9132e Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 1 Mar 2007 06:19:38 +0000 Subject: [PATCH] Add support for conditional specify delay paths. --- elaborate.cc | 39 ++++++++++++++++++++++++++++---- ivl.def | 4 ++++ ivl_target.h | 11 +++++++-- netlist.cc | 54 ++++++++++++++++++++++++++++++++++++++++++--- netlist.h | 17 ++++++++++++-- parse.y | 7 ++++-- t-dll-api.cc | 11 ++++++++- t-dll.cc | 21 +++++++++++++----- t-dll.h | 6 ++++- tgt-stub/stub.c | 7 +++++- tgt-vvp/vvp_scope.c | 21 ++++++++++++++++-- vvp/README.txt | 4 ++-- vvp/compile.cc | 28 +++++++++++++++++++---- vvp/compile.h | 9 +++++++- vvp/delay.cc | 23 +++++++++++++++---- vvp/delay.h | 14 +++++++++++- vvp/parse.y | 7 +++++- 17 files changed, 247 insertions(+), 36 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index f050ce33e..357e3db1c 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.359 2007/02/12 01:52:21 steve Exp $" +#ident "$Id: elaborate.cc,v 1.360 2007/03/01 06:19:38 steve Exp $" #endif # include "config.h" @@ -2916,7 +2916,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const return; /* Check for various path types that are not supported. */ - +#if 0 if (conditional) { cerr << get_line() << ": sorry: Conditional specify paths" << " are not supported." << endl; @@ -2924,6 +2924,14 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const << " specify blocks." << endl; des->errors += 1; } +#endif + if (conditional && !condition) { + cerr << get_line() << ": sorry: ifnone specify paths" + << " are not supported." << endl; + cerr << get_line() << ": : Use -g no-specify to ignore" + << " specify blocks." << endl; + des->errors += 1; + } ivl_assert(*this, conditional || (condition==0)); @@ -2981,13 +2989,30 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const break; } + NetNet*condit_sig = 0; + if (conditional) { + ivl_assert(*this, condition); + + NetExpr*tmp = elab_and_eval(des, scope, condition, -1); + ivl_assert(*condition, tmp); + + // FIXME: Look for constant expressions here? + + // Get a net form. + condit_sig = tmp->synthesize(des); + ivl_assert(*condition, condit_sig); + } + /* Create all the various paths from the path specifier. */ typedef std::vector::const_iterator str_vector_iter; for (str_vector_iter cur = dst.begin() ; cur != dst.end() ; cur ++) { if (debug_elaborate) { - cerr << get_line() << ": debug: Path to " << (*cur) << endl; + cerr << get_line() << ": debug: Path to " << (*cur); + if (condit_sig) + cerr << " if " << condit_sig->name(); + cerr << endl; } NetNet*dst_sig = scope->find_signal(*cur); @@ -2999,7 +3024,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const } NetDelaySrc*path = new NetDelaySrc(scope, scope->local_symbol(), - src.size()); + src.size(), condit_sig); path->set_line(*this); switch (ndelays) { @@ -3038,6 +3063,9 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const idx += 1; } + if (condit_sig) + connect(condit_sig->pin(0), path->pin(idx)); + dst_sig->add_delay_path(path); } @@ -3366,6 +3394,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.360 2007/03/01 06:19:38 steve + * Add support for conditional specify delay paths. + * * Revision 1.359 2007/02/12 01:52:21 steve * Parse all specify paths to pform. * diff --git a/ivl.def b/ivl.def index d8f35ee90..9e34244ca 100644 --- a/ivl.def +++ b/ivl.def @@ -109,6 +109,10 @@ ivl_nexus_ptr_sig ivl_parameter_basename ivl_parameter_expr +ivl_path_condit +ivl_path_delay +ivl_path_source + ivl_scope_attr_cnt ivl_scope_attr_val ivl_scope_basename diff --git a/ivl_target.h b/ivl_target.h index 7410c4f37..bfe01f1f7 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.178 2007/02/26 19:49:49 steve Exp $" +#ident "$Id: ivl_target.h,v 1.179 2007/03/01 06:19:38 steve Exp $" #endif # include @@ -387,10 +387,14 @@ 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. */ 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); /* DESIGN * When handed a design (ivl_design_t) there are a few things that you @@ -1768,6 +1772,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.179 2007/03/01 06:19:38 steve + * Add support for conditional specify delay paths. + * * Revision 1.178 2007/02/26 19:49:49 steve * Spelling fixes (larry doolittle) * diff --git a/netlist.cc b/netlist.cc index 97effa90c..7eeaebb3f 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.254 2007/02/20 05:58:36 steve Exp $" +#ident "$Id: netlist.cc,v 1.255 2007/03/01 06:19:38 steve Exp $" #endif # include "config.h" @@ -237,13 +237,21 @@ NetBus::~NetBus() { } -NetDelaySrc::NetDelaySrc(NetScope*s, perm_string n, unsigned npins) -: NetObj(s, n, npins) +NetDelaySrc::NetDelaySrc(NetScope*s, perm_string n, + unsigned npins, bool condit_src) +: NetObj(s, n, npins + (condit_src?1:0)) { + condit_flag_ = false; for (unsigned idx = 0 ; idx < npins ; idx += 1) { pin(idx).set_name(perm_string::literal("I"), idx); pin(idx).set_dir(Link::INPUT); } + + if (condit_src) { + condit_flag_ = true; + pin(npins).set_name(perm_string::literal("COND"), 0); + pin(npins).set_dir(Link::INPUT); + } } NetDelaySrc::~NetDelaySrc() @@ -330,6 +338,43 @@ uint64_t NetDelaySrc::get_delay(unsigned idx) const return transition_delays_[idx]; } +unsigned NetDelaySrc::src_count() const +{ + if (condit_flag_) + return pin_count() - 1; + else + return pin_count(); +} + +Link& NetDelaySrc::src_pin(unsigned idx) +{ + ivl_assert(*this, idx < src_count()); + return pin(idx); +} + +const Link& NetDelaySrc::src_pin(unsigned idx) const +{ + ivl_assert(*this, idx < src_count()); + return pin(idx); +} + +bool NetDelaySrc::is_condit() const +{ + return condit_flag_; +} + +Link& NetDelaySrc::condit_pin() +{ + ivl_assert(*this, condit_flag_); + return pin(pin_count()-1); +} + +const Link& NetDelaySrc::condit_pin() const +{ + ivl_assert(*this, condit_flag_); + return pin(pin_count()-1); +} + NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins) : NetObj(s, n, 1), sig_next_(0), sig_prev_(0), type_(t), port_type_(NOT_A_PORT), data_type_(IVL_VT_NO_TYPE), @@ -2220,6 +2265,9 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.255 2007/03/01 06:19:38 steve + * Add support for conditional specify delay paths. + * * Revision 1.254 2007/02/20 05:58:36 steve * Handle unary minus of real valued expressions. * diff --git a/netlist.h b/netlist.h index ca018b961..4ad593f87 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.369 2007/02/20 05:58:36 steve Exp $" +#ident "$Id: netlist.h,v 1.370 2007/03/01 06:19:38 steve Exp $" #endif /* @@ -379,7 +379,8 @@ class NetNode : public NetObj { class NetDelaySrc : public NetObj { public: - explicit NetDelaySrc(NetScope*s, perm_string n, unsigned npins); + explicit NetDelaySrc(NetScope*s, perm_string n, + unsigned nsrc, bool condit_src); ~NetDelaySrc(); // These functions set the delays from the values in the @@ -401,10 +402,19 @@ class NetDelaySrc : public NetObj { uint64_t get_delay(unsigned pe) const; + unsigned src_count() const; + Link&src_pin(unsigned); + const Link&src_pin(unsigned) const; + + bool is_condit() const; + Link&condit_pin(); + const Link&condit_pin() const; + void dump(ostream&, unsigned ind) const; private: uint64_t transition_delays_[12]; + bool condit_flag_; private: // Not implemented NetDelaySrc(const NetDelaySrc&); @@ -3475,6 +3485,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.370 2007/03/01 06:19:38 steve + * Add support for conditional specify delay paths. + * * Revision 1.369 2007/02/20 05:58:36 steve * Handle unary minus of real valued expressions. * diff --git a/parse.y b/parse.y index 1bd801886..83fe00eaf 100644 --- a/parse.y +++ b/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.228 2007/02/27 06:10:16 steve Exp $" +#ident "$Id: parse.y,v 1.229 2007/03/01 06:19:39 steve Exp $" #endif # include "config.h" @@ -2529,7 +2529,10 @@ specify_item } | K_if '(' expression ')' specify_simple_path_decl ';' { PSpecPath*tmp = $5; - if (tmp) tmp->condition = $3; + if (tmp) { + tmp->conditional = true; + tmp->condition = $3; + } pform_module_specify_path(tmp); } | K_if '(' expression ')' specify_edge_path_decl ';' diff --git a/t-dll-api.cc b/t-dll-api.cc index 183dbaad2..54b5873d1 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.140 2007/01/17 05:00:12 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.141 2007/03/01 06:19:39 steve Exp $" #endif # include "config.h" @@ -1242,6 +1242,12 @@ extern "C" ivl_scope_t ivl_parameter_scope(ivl_parameter_t net) return net->scope; } +extern "C" ivl_nexus_t ivl_path_condit(ivl_delaypath_t obj) +{ + assert(obj); + return obj->condit; +} + extern uint64_t ivl_path_delay(ivl_delaypath_t obj, ivl_path_edge_t edg) { assert(obj); @@ -1934,6 +1940,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.141 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.140 2007/01/17 05:00:12 steve * Dead code for memories in scopes. * diff --git a/t-dll.cc b/t-dll.cc index 63ce0c277..1c5a42028 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.164 2007/01/29 01:52:51 steve Exp $" +#ident "$Id: t-dll.cc,v 1.165 2007/03/01 06:19:39 steve Exp $" #endif # include "config.h" @@ -2153,7 +2153,7 @@ bool dll_target::signal_paths(const NetNet*net) /* Figure out how many paths there really are. */ for (unsigned idx = 0 ; idx < net->delay_paths() ; idx += 1) { const NetDelaySrc*src = net->delay_path(idx); - obj->npath += src->pin_count(); + obj->npath += src->src_count(); } obj->path = new struct ivl_delaypath_s[obj->npath]; @@ -2162,8 +2162,15 @@ bool dll_target::signal_paths(const NetNet*net) for (unsigned idx = 0 ; idx < net->delay_paths() ; idx += 1) { const NetDelaySrc*src = net->delay_path(idx); - for (unsigned pin = 0; pin < src->pin_count(); pin += 1) { - const Nexus*nex = src->pin(pin).nexus(); + /* If this path has a condition, then hook it up. */ + ivl_nexus_t path_condit = 0; + if (src->is_condit()) { + const Nexus*nt = src->condit_pin().nexus(); + path_condit = (ivl_nexus_t) nt->t_cookie(); + } + + for (unsigned pin = 0; pin < src->src_count(); pin += 1) { + const Nexus*nex = src->src_pin(pin).nexus(); if (! nex->t_cookie()) { cerr << src->get_line() << ": internal error: " << "No signal connected to pin " << pin @@ -2172,13 +2179,14 @@ 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; for (unsigned pe = 0 ; pe < 12 ; pe += 1) { obj->path[ptr].delay[pe] = src->get_delay(pe); } ptr += 1; } + } return true; @@ -2189,6 +2197,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.165 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.164 2007/01/29 01:52:51 steve * Clarify the use of ivl_scope_def for not-functions. * diff --git a/t-dll.h b/t-dll.h index d811d0ac1..629a86eef 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.137 2007/01/17 05:00:12 steve Exp $" +#ident "$Id: t-dll.h,v 1.138 2007/03/01 06:19:39 steve Exp $" #endif # include "target.h" @@ -175,6 +175,7 @@ struct dll_target : public target_t, public expr_scan_t { struct ivl_delaypath_s { ivl_nexus_t src; + ivl_nexus_t condit; uint64_t delay[12]; }; @@ -666,6 +667,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.138 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.137 2007/01/17 05:00:12 steve * Dead code for memories in scopes. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 7fdcff493..f1fa0d9dd 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.145 2007/01/29 01:52:51 steve Exp $" +#ident "$Id: stub.c,v 1.146 2007/03/01 06:19:39 steve Exp $" #endif /* @@ -1130,8 +1130,10 @@ static void show_signal(ivl_signal_t net) for (idx = 0 ; idx < ivl_signal_npath(net) ; idx += 1) { 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); fprintf(out, " path %s", ivl_nexus_name(nex)); + if (con) fprintf(out, " (if %s)", ivl_nexus_name(con)); fprintf(out, " %" PRIu64 ",%" PRIu64 ",%" PRIu64 " %" PRIu64 ",%" PRIu64 ",%" PRIu64 " %" PRIu64 ",%" PRIu64 ",%" PRIu64 @@ -1485,6 +1487,9 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.146 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.145 2007/01/29 01:52:51 steve * Clarify the use of ivl_scope_def for not-functions. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 546a3f534..ab7d4c69a 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.153 2007/02/26 19:49:50 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.154 2007/03/01 06:19:39 steve Exp $" #endif # include "vvp_priv.h" @@ -674,12 +674,19 @@ static void draw_modpath(const char*label, const char*driver, unsigned idx; typedef const char*ccharp; ccharp*src_drivers; + ccharp*con_drivers; src_drivers = calloc(ivl_signal_npath(path_sig), sizeof(ccharp)); + con_drivers = calloc(ivl_signal_npath(path_sig), sizeof(ccharp)); for (idx = 0 ; idx < ivl_signal_npath(path_sig) ; idx += 1) { ivl_delaypath_t path = ivl_signal_path(path_sig, idx); ivl_nexus_t src = ivl_path_source(path); + ivl_nexus_t con = ivl_path_condit(path); + src_drivers[idx] = draw_net_input(src); + + if (con) con_drivers[idx] = draw_net_input(con); + else con_drivers[idx] = 0; } fprintf(vvp_out, "%s .modpath %s", label, driver); @@ -691,7 +698,7 @@ static void draw_modpath(const char*label, const char*driver, " (%"PRIu64",%"PRIu64",%"PRIu64 ", %"PRIu64",%"PRIu64",%"PRIu64 ", %"PRIu64",%"PRIu64",%"PRIu64 - ", %"PRIu64",%"PRIu64",%"PRIu64")", + ", %"PRIu64",%"PRIu64",%"PRIu64, ivl_path_delay(path, IVL_PE_01), ivl_path_delay(path, IVL_PE_10), ivl_path_delay(path, IVL_PE_0z), @@ -704,11 +711,18 @@ static void draw_modpath(const char*label, const char*driver, ivl_path_delay(path, IVL_PE_x0), ivl_path_delay(path, IVL_PE_xz), ivl_path_delay(path, IVL_PE_zx)); + + if (con_drivers[idx]) { + fprintf(vvp_out, " ? %s", con_drivers[idx]); + } + + fprintf(vvp_out, ")"); } fprintf(vvp_out, ";\n"); free(src_drivers); + free(con_drivers); } /* @@ -2352,6 +2366,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.154 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.153 2007/02/26 19:49:50 steve * Spelling fixes (larry doolittle) * diff --git a/vvp/README.txt b/vvp/README.txt index d872ad80d..1a81edc1f 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -1,7 +1,7 @@ /* * Copyright (c) 2001 Stephen Williams (steve@icarus.com) * - * $Id: README.txt,v 1.80 2007/01/16 05:44:16 steve Exp $ + * $Id: README.txt,v 1.81 2007/03/01 06:19:39 steve Exp $ */ VVP SIMULATION ENGINE @@ -368,7 +368,7 @@ A module path delay takes data from its input, then a list of module path delays. The for each possible delay set is a trigger that activates the delay. - .modpath , [ () ] ; + .modpath , [ ( [? ]) ] ; ARRAY INDEX STATEMENTS: diff --git a/vvp/compile.cc b/vvp/compile.cc index ef4b91f55..93eb7d793 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.228 2007/02/14 05:58:14 steve Exp $" +#ident "$Id: compile.cc,v 1.229 2007/03/01 06:19:39 steve Exp $" #endif # include "arith.h" @@ -1099,9 +1099,9 @@ vvp_fun_modpath* compile_modpath(char*label, struct symb_s src) return obj; } -void compile_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, + struct symb_s src, + struct numbv_s vals) { vvp_time64_t use_delay[12]; @@ -1120,6 +1120,23 @@ void compile_modpath_src(vvp_fun_modpath*dst, input_connect(net, 0, src.text); dst->add_modpath_src(obj); + return net; +} + +void compile_modpath_src(vvp_fun_modpath*dst, + struct symb_s src, + struct numbv_s vals) +{ + make_modpath_src(dst, src, vals); +} + +void compile_modpath_src(vvp_fun_modpath*dst, + struct symb_s src, + struct numbv_s vals, + struct symb_s condit_src) +{ + vvp_net_t*net = make_modpath_src(dst, src, vals); + input_connect(net, 1, condit_src.text); } /* @@ -1580,6 +1597,9 @@ void compile_param_string(char*label, char*name, char*value) /* * $Log: compile.cc,v $ + * Revision 1.229 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.228 2007/02/14 05:58:14 steve * Add the mov/wr opcode. * diff --git a/vvp/compile.h b/vvp/compile.h index 7f2da0183..827b31986 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.85 2007/01/16 05:44:16 steve Exp $" +#ident "$Id: compile.h,v 1.86 2007/03/01 06:19:39 steve Exp $" #endif # include @@ -166,6 +166,10 @@ extern vvp_fun_modpath* compile_modpath(char*label, struct symb_s src); extern void compile_modpath_src(vvp_fun_modpath*dst, struct symb_s input, struct numbv_s d); +extern void compile_modpath_src(vvp_fun_modpath*dst, + struct symb_s input, + struct numbv_s d, + struct symb_s condit_input); extern void compile_reduce_and(char*label, struct symb_s arg); extern void compile_reduce_or(char*label, struct symb_s arg); @@ -362,6 +366,9 @@ extern void compile_alias_real(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.86 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.85 2007/01/16 05:44:16 steve * Major rework of array handling. Memories are replaced with the * more general concept of arrays. The NetMemory and NetEMemory diff --git a/vvp/delay.cc b/vvp/delay.cc index 447d0dca5..401c4bf76 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.16 2007/01/26 05:15:41 steve Exp $" +#ident "$Id: delay.cc,v 1.17 2007/03/01 06:19:39 steve Exp $" #endif #include "delay.h" @@ -375,6 +375,10 @@ void vvp_fun_modpath::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) /* Select a time delay source that applies. */ vvp_fun_modpath_src*src = 0; for (vvp_fun_modpath_src*cur = src_list_ ; cur ; cur=cur->next_) { + /* Skip paths that are disabled by conditions. */ + if (cur->condition_flag_ == false) + continue; + if (src == 0) { src = cur; } else if (cur->wake_time_ > src->wake_time_) { @@ -425,6 +429,7 @@ vvp_fun_modpath_src::vvp_fun_modpath_src(vvp_time64_t del[12]) next_ = 0; wake_time_ = 0; + condition_flag_ = true; } vvp_fun_modpath_src::~vvp_fun_modpath_src() @@ -433,14 +438,24 @@ vvp_fun_modpath_src::~vvp_fun_modpath_src() void vvp_fun_modpath_src::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) { - if (port.port() != 0) - return; + if (port.port() == 0) { + // The modpath input... + wake_time_ = schedule_simtime(); - wake_time_ = schedule_simtime(); + } else if (port.port() == 1) { + // The modpath condition input... + if (bit.value(0) == BIT4_1) + condition_flag_ = true; + else + condition_flag_ = false; + } } /* * $Log: delay.cc,v $ + * Revision 1.17 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.16 2007/01/26 05:15:41 steve * More literal implementation of inertial delay model. * diff --git a/vvp/delay.h b/vvp/delay.h index c3202664a..5875f066e 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.13 2007/01/26 05:15:41 steve Exp $" +#ident "$Id: delay.h,v 1.14 2007/03/01 06:19:39 steve Exp $" #endif /* @@ -138,6 +138,14 @@ class vvp_fun_delay : public vvp_net_fun_t, private vvp_gen_event_s { void clean_pulse_events_(vvp_time64_t use_delay); }; +/* +* These objects inplement module delay paths. The fun_modpath functor +* is the output of the modpath, and the vvp_fun_modpath_src is the +* source of the modpath. The modpath source tracks events on the +* inputs to enable delays, and the vvp_fun_modpath, when it's time to +* schedule, looks at the associated modpath_src objects for which +* paths are active. +*/ class vvp_fun_modpath; class vvp_fun_modpath_src; @@ -185,6 +193,7 @@ class vvp_fun_modpath_src : public vvp_net_fun_t { vvp_fun_modpath_src*next_; vvp_time64_t wake_time_; + bool condition_flag_; private: vvp_fun_modpath_src(const vvp_fun_modpath_src&); @@ -193,6 +202,9 @@ class vvp_fun_modpath_src : public vvp_net_fun_t { /* * $Log: delay.h,v $ + * Revision 1.14 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.13 2007/01/26 05:15:41 steve * More literal implementation of inertial delay model. * diff --git a/vvp/parse.y b/vvp/parse.y index e72bd9142..5d5bafa22 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.87 2007/01/16 05:44:16 steve Exp $" +#ident "$Id: parse.y,v 1.88 2007/03/01 06:19:39 steve Exp $" #endif # include "parse_misc.h" @@ -746,6 +746,8 @@ modpath_src_list modpath_src : symbol '(' numbers ')' { compile_modpath_src(modpath_dst, $1, $3); } + | symbol '(' numbers '?' symbol ')' + { compile_modpath_src(modpath_dst, $1, $3, $5); } ; udp_table @@ -803,6 +805,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.88 2007/03/01 06:19:39 steve + * Add support for conditional specify delay paths. + * * Revision 1.87 2007/01/16 05:44:16 steve * Major rework of array handling. Memories are replaced with the * more general concept of arrays. The NetMemory and NetEMemory