From 1295058e5d07be1a473fc4c14f629dec5aec75dc Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 20 Feb 2004 06:22:56 +0000 Subject: [PATCH] parameter keys are per_strings. --- Module.cc | 7 +++++-- Module.h | 15 +++++++++------ PExpr.cc | 19 ++++++++++++++----- design_dump.cc | 7 +++++-- elab_expr.cc | 9 ++++++--- elab_pexpr.cc | 15 ++++++++++----- elab_scope.cc | 13 ++++++++----- eval_tree.cc | 22 ++++++++++------------ named.h | 11 +++++++---- net_design.cc | 20 ++++++++++++-------- net_expr.cc | 11 +++++++---- net_scope.cc | 26 ++++++++++++++++++-------- netlist.cc | 9 ++++++--- netlist.h | 33 ++++++++++++++++++--------------- parse.y | 33 +++++++++++++++++---------------- pform.cc | 21 ++++++++++++--------- pform.h | 9 ++++++--- pform_dump.cc | 7 +++++-- t-dll.cc | 9 ++++++--- t-dll.h | 28 +++++----------------------- 20 files changed, 186 insertions(+), 138 deletions(-) diff --git a/Module.cc b/Module.cc index c80e9cad55..51e031d2c8 100644 --- a/Module.cc +++ b/Module.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: Module.cc,v 1.22 2004/02/18 17:11:54 steve Exp $" +#ident "$Id: Module.cc,v 1.23 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -88,7 +88,7 @@ const svector& Module::get_port(unsigned idx) const return zero; } -unsigned Module::find_port(const string&name) const +unsigned Module::find_port(const char*name) const { assert(name != ""); for (unsigned idx = 0 ; idx < ports.count() ; idx += 1) { @@ -149,6 +149,9 @@ const list& Module::get_behaviors() const /* * $Log: Module.cc,v $ + * Revision 1.23 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.22 2004/02/18 17:11:54 steve * Use perm_strings for named langiage items. * diff --git a/Module.h b/Module.h index 62e4136445..df288d22b2 100644 --- a/Module.h +++ b/Module.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: Module.h,v 1.33 2004/02/18 17:11:54 steve Exp $" +#ident "$Id: Module.h,v 1.34 2004/02/20 06:22:56 steve Exp $" #endif # include @@ -57,7 +57,7 @@ class Module : public LineInfo { the port. */ public: struct port_t { - string name; + perm_string name; svector expr; }; @@ -77,8 +77,8 @@ class Module : public LineInfo { PExpr*lsb; bool signed_flag; }; - mapparameters; - maplocalparams; + mapparameters; + maplocalparams; /* specparams are simpler then other params, in that they have @@ -98,7 +98,7 @@ class Module : public LineInfo { appear in the instantiated module. Therefore a list of names in module-order is needed to pass from a parameter-index to its name. */ - list param_names; + list param_names; /* This is an array of port descriptors, which is in turn a named array of PEident pointers. */ @@ -131,7 +131,7 @@ class Module : public LineInfo { unsigned port_count() const; const svector& get_port(unsigned idx) const; - unsigned find_port(const string&) const; + unsigned find_port(const char*name) const; // Find a wire by name. This is used for connecting gates to // existing wires, etc. @@ -166,6 +166,9 @@ class Module : public LineInfo { /* * $Log: Module.h,v $ + * Revision 1.34 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.33 2004/02/18 17:11:54 steve * Use perm_strings for named langiage items. * diff --git a/PExpr.cc b/PExpr.cc index aac384e8b4..b8912370ec 100644 --- a/PExpr.cc +++ b/PExpr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: PExpr.cc,v 1.33 2003/01/27 05:09:17 steve Exp $" +#ident "$Id: PExpr.cc,v 1.34 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -161,13 +161,19 @@ bool PEIdent::is_constant(Module*mod) const { if (mod == 0) return false; - { map::const_iterator cur; - cur = mod->parameters.find(path_.peek_name(0)); + /* This is a work-around for map not matching < even when + there is a perm_string operator that can do the comprare. + + The real fix is to make the path_ carry perm_strings. */ + perm_string tmp = perm_string::literal(path_.peek_name(0)); + + { map::const_iterator cur; + cur = mod->parameters.find(tmp); if (cur != mod->parameters.end()) return true; } - { map::const_iterator cur; - cur = mod->localparams.find(path_.peek_name(0)); + { map::const_iterator cur; + cur = mod->localparams.find(tmp); if (cur != mod->localparams.end()) return true; } @@ -256,6 +262,9 @@ bool PEUnary::is_constant(Module*m) const /* * $Log: PExpr.cc,v $ + * Revision 1.34 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.33 2003/01/27 05:09:17 steve * Spelling fixes. * diff --git a/design_dump.cc b/design_dump.cc index bfb001aee2..5a7bf18457 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.146 2004/02/18 17:11:54 steve Exp $" +#ident "$Id: design_dump.cc,v 1.147 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -717,7 +717,7 @@ void NetScope::dump(ostream&o) const /* Dump the parameters for this scope. */ { - map::const_iterator pp; + map::const_iterator pp; for (pp = parameters.begin() ; pp != parameters.end() ; pp ++) { o << " parameter "; @@ -1079,6 +1079,9 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.147 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.146 2004/02/18 17:11:54 steve * Use perm_strings for named langiage items. * diff --git a/elab_expr.cc b/elab_expr.cc index 0b782ce3fb..83d9742c08 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_expr.cc,v 1.83 2004/01/21 04:57:40 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.84 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -605,8 +605,8 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope, NetEConstParam if possible. */ NetEConst*ctmp = dynamic_cast(tmp); if (ctmp != 0) { - const char*name - = lex_strings.add(path_.peek_tail_name()); + perm_string name + = lex_strings.make(path_.peek_tail_name()); NetEConstParam*ptmp = new NetEConstParam(found_in, name, ctmp->value()); delete tmp; @@ -977,6 +977,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const /* * $Log: elab_expr.cc,v $ + * Revision 1.84 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.83 2004/01/21 04:57:40 steve * Generate error when missing concatenation operands. * diff --git a/elab_pexpr.cc b/elab_pexpr.cc index 189a420a7a..ba9730e96a 100644 --- a/elab_pexpr.cc +++ b/elab_pexpr.cc @@ -17,12 +17,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_pexpr.cc,v 1.20 2003/05/30 02:55:32 steve Exp $" +#ident "$Id: elab_pexpr.cc,v 1.21 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" # include "PExpr.h" +# include "compiler.h" # include "util.h" # include @@ -136,19 +137,20 @@ NetExpr*PEIdent::elaborate_pexpr(Design*des, NetScope*scope) const if (path.peek_name(0)) pscope = des->find_scope(scope, path); - const NetExpr*ex = pscope->get_parameter(name); + perm_string perm_name = lex_strings.make(name); + delete name; + + const NetExpr*ex = pscope->get_parameter(perm_name); if (ex == 0) { cerr << get_line() << ": error: identifier ``" << path_ << "'' is not a parameter in " << scope->name() << "." << endl; des->errors += 1; - delete name; return 0; } - NetExpr*res = new NetEParam(des, pscope, hname_t(name)); + NetExpr*res = new NetEParam(des, pscope, perm_name); res->set_line(*this); assert(res); - delete name; assert(idx_ == 0); if (msb_ && lsb_) { @@ -229,6 +231,9 @@ NetExpr*PEUnary::elaborate_pexpr (Design*des, NetScope*scope) const /* * $Log: elab_pexpr.cc,v $ + * Revision 1.21 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.20 2003/05/30 02:55:32 steve * Support parameters in real expressions and * as real expressions, and fix multiply and diff --git a/elab_scope.cc b/elab_scope.cc index de98cb2844..1697a69be6 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_scope.cc,v 1.29 2004/02/19 07:06:57 steve Exp $" +#ident "$Id: elab_scope.cc,v 1.30 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -57,7 +57,7 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const // the pform and just place a NetEParam placeholder in the // place of the elaborated expression. - typedef map::const_iterator mparm_it_t; + typedef map::const_iterator mparm_it_t; typedef map::const_iterator hparm_it_t; @@ -308,8 +308,8 @@ void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const // passed. It is built up by the ordered overrides or named // overrides. - typedef map::const_iterator mparm_it_t; - map replace; + typedef map::const_iterator mparm_it_t; + map replace; // Positional parameter overrides are matched to parameter @@ -319,7 +319,7 @@ void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const if (overrides_) { assert(parms_ == 0); - list::const_iterator cur = mod->param_names.begin(); + list::const_iterator cur = mod->param_names.begin(); unsigned idx = 0; for (;;) { if (idx >= overrides_->count()) @@ -549,6 +549,9 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const /* * $Log: elab_scope.cc,v $ + * Revision 1.30 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.29 2004/02/19 07:06:57 steve * LPM, logic and Variables have perm_string names. * diff --git a/eval_tree.cc b/eval_tree.cc index b85239977e..0dcf754187 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: eval_tree.cc,v 1.59 2003/10/31 02:47:11 steve Exp $" +#ident "$Id: eval_tree.cc,v 1.60 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -1124,8 +1124,7 @@ NetExpr* NetEParam::eval_tree() return 0; assert(scope_); - assert(name_.peek_name(1) == 0); - const NetExpr*expr = scope_->get_parameter(name_.peek_name(0)); + const NetExpr*expr = scope_->get_parameter(name_); if (expr == 0) { cerr << get_line() << ": internal error: Unable to match " << "parameter " << name_ << " in scope " @@ -1142,8 +1141,7 @@ NetExpr* NetEParam::eval_tree() // return the constant value. if (NetEConst*tmp = dynamic_cast(nexpr)) { verinum val = tmp->value(); - const char*name = lex_strings.add(name_.peek_name(0)); - NetEConstParam*ptmp = new NetEConstParam(scope_, name, val); + NetEConstParam*ptmp = new NetEConstParam(scope_, name_, val); ptmp->set_line(*this); delete nexpr; return ptmp; @@ -1151,8 +1149,7 @@ NetExpr* NetEParam::eval_tree() if (NetECReal*tmp = dynamic_cast(nexpr)) { verireal val = tmp->value(); - const char*name = lex_strings.add(name_.peek_name(0)); - NetECRealParam*ptmp = new NetECRealParam(scope_, name, val); + NetECRealParam*ptmp = new NetECRealParam(scope_, name_, val); ptmp->set_line(*this); delete nexpr; return ptmp; @@ -1171,7 +1168,7 @@ NetExpr* NetEParam::eval_tree() // The result can be saved as the value of the parameter for // future reference, and return a copy to the caller. - scope_->replace_parameter(name_.peek_name(0), res); + scope_->replace_parameter(name_, res); /* Return as a result a NetEConstParam or NetECRealParam object, depending on the type of the expression. */ @@ -1190,8 +1187,7 @@ NetExpr* NetEParam::eval_tree() assert(tmp); verinum val = tmp->value(); - const char*name = lex_strings.add(name_.peek_name(0)); - NetEConstParam*ptmp = new NetEConstParam(scope_, name, val); + NetEConstParam*ptmp = new NetEConstParam(scope_, name_, val); return ptmp; } @@ -1208,8 +1204,7 @@ NetExpr* NetEParam::eval_tree() assert(tmp); verireal val = tmp->value(); - const char*name = lex_strings.add(name_.peek_name(0)); - NetECRealParam*ptmp = new NetECRealParam(scope_, name, val); + NetECRealParam*ptmp = new NetECRealParam(scope_, name_, val); return ptmp; } @@ -1515,6 +1510,9 @@ NetEConst* NetEUReduce::eval_tree() /* * $Log: eval_tree.cc,v $ + * Revision 1.60 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.59 2003/10/31 02:47:11 steve * NetEUReduce has its own dup_expr method. * diff --git a/named.h b/named.h index 1bca680716..66575dc21e 100644 --- a/named.h +++ b/named.h @@ -1,7 +1,7 @@ #ifndef __named_H #define __named_H /* - * Copyright (c) 2000 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2004 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -19,10 +19,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: named.h,v 1.3 2002/08/12 01:34:59 steve Exp $" +#ident "$Id: named.h,v 1.4 2004/02/20 06:22:56 steve Exp $" #endif -# include +# include "StringHeap.h" /* * There are lots of places where names are attached to objects. This @@ -30,12 +30,15 @@ */ template struct named { - string name; + perm_string name; T parm; }; /* * $Log: named.h,v $ + * Revision 1.4 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.3 2002/08/12 01:34:59 steve * conditional ident string using autoconfig. * diff --git a/net_design.cc b/net_design.cc index e618387b14..46d90084d4 100644 --- a/net_design.cc +++ b/net_design.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: net_design.cc,v 1.43 2004/02/18 17:11:56 steve Exp $" +#ident "$Id: net_design.cc,v 1.44 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -31,6 +31,7 @@ # include "netlist.h" # include "util.h" +# include "compiler.h" # include Design:: Design() @@ -265,26 +266,26 @@ void NetScope::run_defparams(Design*des) NetExpr*val = (*pp).second; hname_t path = (*pp).first; - char*name = path.remove_tail_name(); + char*tmp = path.remove_tail_name(); + perm_string perm_name = lex_strings.make(tmp); + delete[]tmp; /* If there is no path on the name, then the targ_scope is the current scope. */ NetScope*targ_scope = des->find_scope(this, path); if (targ_scope == 0) { cerr << val->get_line() << ": warning: scope of " << - path << "." << name << " not found." << endl; - delete[]name; + path << "." << perm_name << " not found." << endl; continue; } - bool flag = targ_scope->replace_parameter(name, val); + bool flag = targ_scope->replace_parameter(perm_name, val); if (! flag) { cerr << val->get_line() << ": warning: parameter " - << name << " not found in " + << perm_name << " not found in " << targ_scope->name() << "." << endl; } - delete[]name; } } @@ -309,7 +310,7 @@ void NetScope::evaluate_parameters(Design*des) // scanning code. Now the parameter expression can be fully // evaluated, or it cannot be evaluated at all. - typedef map::iterator mparm_it_t; + typedef map::iterator mparm_it_t; for (mparm_it_t cur = parameters.begin() ; cur != parameters.end() ; cur ++) { @@ -617,6 +618,9 @@ void Design::delete_process(NetProcTop*top) /* * $Log: net_design.cc,v $ + * Revision 1.44 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.43 2004/02/18 17:11:56 steve * Use perm_strings for named langiage items. * diff --git a/net_expr.cc b/net_expr.cc index 02a7b579d8..9f0aa7e724 100644 --- a/net_expr.cc +++ b/net_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: net_expr.cc,v 1.21 2003/08/28 04:11:19 steve Exp $" +#ident "$Id: net_expr.cc,v 1.22 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -377,7 +377,7 @@ NetExpr::TYPE NetECReal::expr_type() const return ET_REAL; } -NetECRealParam::NetECRealParam(NetScope*s, const char*n, const verireal&v) +NetECRealParam::NetECRealParam(NetScope*s, perm_string n, const verireal&v) : NetECReal(v), scope_(s), name_(n) { } @@ -386,7 +386,7 @@ NetECRealParam::~NetECRealParam() { } -const char* NetECRealParam::name() const +perm_string NetECRealParam::name() const { return name_; } @@ -402,7 +402,7 @@ NetEParam::NetEParam() { } -NetEParam::NetEParam(Design*d, NetScope*s, const hname_t&n) +NetEParam::NetEParam(Design*d, NetScope*s, perm_string n) : des_(d), scope_(s), name_(n) { } @@ -516,6 +516,9 @@ NetExpr::TYPE NetESFunc::expr_type() const /* * $Log: net_expr.cc,v $ + * Revision 1.22 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.21 2003/08/28 04:11:19 steve * Spelling patch. * diff --git a/net_scope.cc b/net_scope.cc index 65424a9585..4aa451ca16 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: net_scope.cc,v 1.30 2004/02/18 17:11:56 steve Exp $" +#ident "$Id: net_scope.cc,v 1.31 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -80,7 +80,7 @@ NetScope::~NetScope() /* name_ and module_name_ are perm-allocated. */ } -NetExpr* NetScope::set_parameter(const string&key, NetExpr*expr, +NetExpr* NetScope::set_parameter(perm_string key, NetExpr*expr, NetExpr*msb, NetExpr*lsb, bool signed_flag) { param_expr_t&ref = parameters[key]; @@ -95,7 +95,7 @@ NetExpr* NetScope::set_parameter(const string&key, NetExpr*expr, /* * Return false if this creates a new parameter. */ -bool NetScope::replace_parameter(const string&key, NetExpr*expr) +bool NetScope::replace_parameter(perm_string key, NetExpr*expr) { bool flag = true; param_expr_t&ref = parameters[key]; @@ -115,7 +115,7 @@ bool NetScope::replace_parameter(const string&key, NetExpr*expr) return flag; } -NetExpr* NetScope::set_localparam(const string&key, NetExpr*expr) +NetExpr* NetScope::set_localparam(perm_string key, NetExpr*expr) { param_expr_t&ref = localparams[key]; NetExpr* res = ref.expr; @@ -126,15 +126,22 @@ NetExpr* NetScope::set_localparam(const string&key, NetExpr*expr) return res; } -const NetExpr* NetScope::get_parameter(const string&key) const +/* + * NOTE: This method takes a const char* as a key to lookup a + * parameter, because we don't save that pointer. However, due to the + * way the map<> template works, we need to *cheat* and use the + * perm_string::literal method to fake the compiler into doing the + * compare without actually creating a perm_string. + */ +const NetExpr* NetScope::get_parameter(const char* key) const { - map::const_iterator idx; + map::const_iterator idx; - idx = parameters.find(key); + idx = parameters.find(perm_string::literal(key)); if (idx != parameters.end()) return (*idx).second.expr; - idx = localparams.find(key); + idx = localparams.find(perm_string::literal(key)); if (idx != localparams.end()) return (*idx).second.expr; @@ -450,6 +457,9 @@ string NetScope::local_hsymbol() /* * $Log: net_scope.cc,v $ + * Revision 1.31 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.30 2004/02/18 17:11:56 steve * Use perm_strings for named langiage items. * diff --git a/netlist.cc b/netlist.cc index 988a38e004..25ccbc63f4 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.221 2004/02/18 17:11:56 steve Exp $" +#ident "$Id: netlist.cc,v 1.222 2004/02/20 06:22:56 steve Exp $" #endif # include "config.h" @@ -1897,7 +1897,7 @@ bool NetEConst::has_width() const return value_.has_len(); } -NetEConstParam::NetEConstParam(NetScope*s, const char*n, const verinum&v) +NetEConstParam::NetEConstParam(NetScope*s, perm_string n, const verinum&v) : NetEConst(v), scope_(s), name_(n) { } @@ -1906,7 +1906,7 @@ NetEConstParam::~NetEConstParam() { } -const char* NetEConstParam::name() const +perm_string NetEConstParam::name() const { return name_; } @@ -2218,6 +2218,9 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.222 2004/02/20 06:22:56 steve + * parameter keys are per_strings. + * * Revision 1.221 2004/02/18 17:11:56 steve * Use perm_strings for named langiage items. * diff --git a/netlist.h b/netlist.h index a42fc955bb..d0016a4fc2 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.310 2004/02/19 07:06:57 steve Exp $" +#ident "$Id: netlist.h,v 1.311 2004/02/20 06:22:57 steve Exp $" #endif /* @@ -1042,11 +1042,11 @@ class NetEConst : public NetExpr { class NetEConstParam : public NetEConst { public: - explicit NetEConstParam(NetScope*scope, const char*name, + explicit NetEConstParam(NetScope*scope, perm_string name, const verinum&val); ~NetEConstParam(); - const char* name() const; + perm_string name() const; const NetScope*scope() const; virtual void expr_scan(struct expr_scan_t*) const; @@ -1056,7 +1056,7 @@ class NetEConstParam : public NetEConst { private: NetScope*scope_; - const char*name_; + perm_string name_; }; /* @@ -1094,11 +1094,11 @@ class NetECReal : public NetExpr { class NetECRealParam : public NetECReal { public: - explicit NetECRealParam(NetScope*scope, const char*name, + explicit NetECRealParam(NetScope*scope, perm_string name, const verireal&val); ~NetECRealParam(); - const char* name() const; + perm_string name() const; const NetScope*scope() const; virtual void expr_scan(struct expr_scan_t*) const; @@ -1108,7 +1108,7 @@ class NetECRealParam : public NetECReal { private: NetScope*scope_; - const char*name_; + perm_string name_; }; /* @@ -2646,7 +2646,7 @@ class NetEVariable : public NetExpr { class NetEParam : public NetExpr { public: NetEParam(); - NetEParam(class Design*des, NetScope*scope, const hname_t&name); + NetEParam(class Design*des, NetScope*scope, perm_string name); ~NetEParam(); virtual NexusSet* nex_input(); @@ -2661,7 +2661,7 @@ class NetEParam : public NetExpr { private: Design*des_; NetScope*scope_; - hname_t name_; + perm_string name_; }; @@ -3004,16 +3004,16 @@ class NetScope : public Attrib { the scope. The return value from set_parameter is the previous expression, if there was one. */ - NetExpr* set_parameter(const string&name, NetExpr*val, + NetExpr* set_parameter(perm_string name, NetExpr*val, NetExpr*msb, NetExpr*lsb, bool signed_flag); - NetExpr* set_localparam(const string&name, NetExpr*val); - const NetExpr*get_parameter(const string&name) const; + NetExpr* set_localparam(perm_string name, NetExpr*val); + const NetExpr*get_parameter(const char* name) const; /* These are used by defparam elaboration to replace the expression with a new expression, without affecting the range or signed_flag. Return false if the name does not exist. */ - bool replace_parameter(const string&name, NetExpr*val); + bool replace_parameter(perm_string name, NetExpr*val); /* These methods set or access events that live in this scope. */ @@ -3125,8 +3125,8 @@ class NetScope : public Attrib { NetExpr*lsb; bool signed_flag; }; - mapparameters; - maplocalparams; + mapparameters; + maplocalparams; private: TYPE type_; @@ -3315,6 +3315,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.311 2004/02/20 06:22:57 steve + * parameter keys are per_strings. + * * Revision 1.310 2004/02/19 07:06:57 steve * LPM, logic and Variables have perm_string names. * diff --git a/parse.y b/parse.y index cadcf5cd77..b70fae5d3e 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.190 2004/02/18 17:11:57 steve Exp $" +#ident "$Id: parse.y,v 1.191 2004/02/20 06:22:57 steve Exp $" #endif # include "config.h" @@ -278,7 +278,7 @@ attribute_list attribute : IDENTIFIER { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = string($1); + tmp->name = lex_strings.make($1); tmp->parm = 0; delete $1; $$ = tmp; @@ -292,7 +292,7 @@ attribute tmp = 0; } named_pexpr_t*tmp2 = new named_pexpr_t; - tmp2->name = string($1); + tmp2->name = lex_strings.make($1); tmp2->parm = tmp; delete $1; $$ = tmp2; @@ -1799,7 +1799,8 @@ parameter_assign delete tmp; tmp = 0; } else { - pform_set_parameter($1, active_signed, + pform_set_parameter(lex_strings.make($1), + active_signed, active_range, tmp); } delete $1; @@ -1840,7 +1841,7 @@ localparam_assign delete tmp; tmp = 0; } - pform_set_localparam($1, tmp); + pform_set_localparam(lex_strings.make($1), tmp); delete $1; } ; @@ -1907,14 +1908,14 @@ parameter_value_opt parameter_value_byname : '.' IDENTIFIER '(' expression ')' { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = $2; + tmp->name = lex_strings.make($2); tmp->parm = $4; free($2); $$ = tmp; } | '.' IDENTIFIER '(' ')' { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = $2; + tmp->name = lex_strings.make($2); tmp->parm = 0; free($2); $$ = tmp; @@ -1960,7 +1961,7 @@ port | '.' IDENTIFIER '(' port_reference ')' { Module::port_t*tmp = $4; - tmp->name = $2; + tmp->name = lex_strings.make($2); delete $2; $$ = tmp; } @@ -1971,7 +1972,7 @@ port | '{' port_reference_list '}' { Module::port_t*tmp = $2; - tmp->name = ""; + tmp->name = perm_string(); $$ = tmp; } @@ -1980,7 +1981,7 @@ port | '.' IDENTIFIER '(' '{' port_reference_list '}' ')' { Module::port_t*tmp = $5; - tmp->name = $2; + tmp->name = lex_strings.make($2); delete $2; $$ = tmp; } @@ -2027,7 +2028,7 @@ port_reference wtmp->msb_ = $3; wtmp->lsb_ = $5; Module::port_t*ptmp = new Module::port_t; - ptmp->name = ""; + ptmp->name = perm_string(); ptmp->expr = svector(1); ptmp->expr[0] = wtmp; delete $1; @@ -2044,7 +2045,7 @@ port_reference } tmp->msb_ = $3; Module::port_t*ptmp = new Module::port_t; - ptmp->name = ""; + ptmp->name = perm_string(); ptmp->expr = svector(1); ptmp->expr[0] = tmp; delete $1; @@ -2057,7 +2058,7 @@ port_reference PEIdent*wtmp = new PEIdent(hname_t($1)); wtmp->set_file(@1.text); wtmp->set_lineno(@1.first_line); - ptmp->name = $1; + ptmp->name = lex_strings.make($1); ptmp->expr = svector(1); ptmp->expr[0] = wtmp; delete $1; @@ -2084,7 +2085,7 @@ port_reference_list port_name : '.' IDENTIFIER '(' expression ')' { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = $2; + tmp->name = lex_strings.make($2); tmp->parm = $4; delete $2; $$ = tmp; @@ -2092,14 +2093,14 @@ port_name | '.' IDENTIFIER '(' error ')' { yyerror(@4, "error: invalid port connection expression."); named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = $2; + tmp->name = lex_strings.make($2); tmp->parm = 0; delete $2; $$ = tmp; } | '.' IDENTIFIER '(' ')' { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = $2; + tmp->name = lex_strings.make($2); tmp->parm = 0; delete $2; $$ = tmp; diff --git a/pform.cc b/pform.cc index c9352ebeb9..00b681ab81 100644 --- a/pform.cc +++ b/pform.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.cc,v 1.121 2004/02/19 06:57:10 steve Exp $" +#ident "$Id: pform.cc,v 1.122 2004/02/20 06:22:58 steve Exp $" #endif # include "config.h" @@ -208,7 +208,7 @@ void pform_startmodule(const char*name, const char*file, unsigned lineno, if (attr) { for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) { named_pexpr_t*tmp = (*attr)[idx]; - pform_cur_module->attributes[tmp->name] = tmp->parm; + pform_cur_module->attributes[string(tmp->name)] = tmp->parm; } } } @@ -226,7 +226,7 @@ Module::port_t* pform_module_port_reference(char*name, PEIdent*tmp = new PEIdent(hname_t(name)); tmp->set_file(file); tmp->set_lineno(lineno); - ptmp->name = name; + ptmp->name = lex_strings.make(name); ptmp->expr = svector(1); ptmp->expr[0] = tmp; @@ -697,7 +697,7 @@ void pform_makegate(PGBuiltin::Type type, if (attr) { for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) { named_pexpr_t*tmp = (*attr)[idx]; - cur->attributes[tmp->name] = tmp->parm; + cur->attributes[string(tmp->name)] = tmp->parm; } } @@ -975,7 +975,7 @@ void pform_module_define_port(const struct vlltype&li, if (attr) { for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) { named_pexpr_t*tmp = (*attr)[idx]; - cur->attributes[tmp->name] = tmp->parm; + cur->attributes[string(tmp->name)] = tmp->parm; } } pform_cur_module->add_wire(cur); @@ -1035,7 +1035,7 @@ void pform_makewire(const vlltype&li, const char*nm, if (attr) { for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) { named_pexpr_t*tmp = (*attr)[idx]; - cur->attributes[tmp->name] = tmp->parm; + cur->attributes[string(tmp->name)] = tmp->parm; } } @@ -1308,7 +1308,7 @@ void pform_set_reg_idx(const char*name, PExpr*l, PExpr*r) cur->set_memory_idx(l, r); } -void pform_set_parameter(const string&name, bool signed_flag, +void pform_set_parameter(perm_string name, bool signed_flag, svector*range, PExpr*expr) { assert(expr); @@ -1329,7 +1329,7 @@ void pform_set_parameter(const string&name, bool signed_flag, pform_cur_module->param_names.push_back(name); } -void pform_set_localparam(const string&name, PExpr*expr) +void pform_set_localparam(perm_string name, PExpr*expr) { assert(expr); pform_cur_module->localparams[name].expr = expr; @@ -1469,7 +1469,7 @@ PProcess* pform_make_behavior(PProcess::Type type, Statement*st, if (attr) { for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) { named_pexpr_t*tmp = (*attr)[idx]; - pp->attributes[tmp->name] = tmp->parm; + pp->attributes[string(tmp->name)] = tmp->parm; } delete attr; } @@ -1519,6 +1519,9 @@ int pform_parse(const char*path, FILE*file) /* * $Log: pform.cc,v $ + * Revision 1.122 2004/02/20 06:22:58 steve + * parameter keys are per_strings. + * * Revision 1.121 2004/02/19 06:57:10 steve * Memory and Event names use perm_string. * diff --git a/pform.h b/pform.h index bd1eb4126e..ab518720f4 100644 --- a/pform.h +++ b/pform.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.h,v 1.74 2004/02/18 17:11:57 steve Exp $" +#ident "$Id: pform.h,v 1.75 2004/02/20 06:22:58 steve Exp $" #endif # include "netlist.h" @@ -207,11 +207,11 @@ extern void pform_set_attrib(perm_string name, const string&key, extern void pform_set_type_attrib(perm_string name, const string&key, char*value); -extern void pform_set_parameter(const string&name, +extern void pform_set_parameter(perm_string name, bool signed_flag, svector*range, PExpr*expr); -extern void pform_set_localparam(const string&name, PExpr*expr); +extern void pform_set_localparam(perm_string name, PExpr*expr); extern void pform_set_defparam(const hname_t&name, PExpr*expr); /* @@ -283,6 +283,9 @@ extern void pform_dump(ostream&out, Module*mod); /* * $Log: pform.h,v $ + * Revision 1.75 2004/02/20 06:22:58 steve + * parameter keys are per_strings. + * * Revision 1.74 2004/02/18 17:11:57 steve * Use perm_strings for named langiage items. * diff --git a/pform_dump.cc b/pform_dump.cc index 84a9b16799..3d9bfcb8de 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform_dump.cc,v 1.83 2004/02/18 17:11:57 steve Exp $" +#ident "$Id: pform_dump.cc,v 1.84 2004/02/20 06:22:58 steve Exp $" #endif # include "config.h" @@ -726,7 +726,7 @@ void Module::dump(ostream&out) const out << ")" << endl; } - typedef map::const_iterator parm_iter_t; + typedef map::const_iterator parm_iter_t; typedef map::const_iterator parm_hiter_t; for (parm_iter_t cur = parameters.begin() ; cur != parameters.end() ; cur ++) { @@ -881,6 +881,9 @@ void PUdp::dump(ostream&out) const /* * $Log: pform_dump.cc,v $ + * Revision 1.84 2004/02/20 06:22:58 steve + * parameter keys are per_strings. + * * Revision 1.83 2004/02/18 17:11:57 steve * Use perm_strings for named langiage items. * diff --git a/t-dll.cc b/t-dll.cc index 3cec93f0b7..691cd7b137 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.127 2004/02/19 06:57:10 steve Exp $" +#ident "$Id: t-dll.cc,v 1.128 2004/02/20 06:22:58 steve Exp $" #endif # include "config.h" @@ -487,14 +487,14 @@ void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net) scope->param_ = new struct ivl_parameter_s [scope->nparam_]; unsigned idx = 0; - typedef map::const_iterator pit_t; + typedef map::const_iterator pit_t; for (pit_t cur_pit = net->parameters.begin() ; cur_pit != net->parameters.end() ; cur_pit ++) { assert(idx < scope->nparam_); ivl_parameter_t cur_par = scope->param_ + idx; - cur_par->basename = lex_strings.add( (*cur_pit).first.c_str() ); + cur_par->basename = (*cur_pit).first; cur_par->scope = scope; NetExpr*etmp = (*cur_pit).second.expr; @@ -2176,6 +2176,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.128 2004/02/20 06:22:58 steve + * parameter keys are per_strings. + * * Revision 1.127 2004/02/19 06:57:10 steve * Memory and Event names use perm_string. * diff --git a/t-dll.h b/t-dll.h index 54f4aea6ff..8542c0988c 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.111 2004/02/19 07:06:57 steve Exp $" +#ident "$Id: t-dll.h,v 1.112 2004/02/20 06:22:58 steve Exp $" #endif # include "target.h" @@ -488,7 +488,7 @@ struct ivl_memory_s { * these. */ struct ivl_parameter_s { - const char*basename; + perm_string basename; ivl_scope_t scope; ivl_expr_t value; }; @@ -683,6 +683,9 @@ struct ivl_variable_s { /* * $Log: t-dll.h,v $ + * Revision 1.112 2004/02/20 06:22:58 steve + * parameter keys are per_strings. + * * Revision 1.111 2004/02/19 07:06:57 steve * LPM, logic and Variables have perm_string names. * @@ -725,26 +728,5 @@ struct ivl_variable_s { * scope names and system task/function names * into this table. Also, permallocate event * names from the beginning. - * - * Revision 1.98 2003/02/06 16:43:20 steve - * Satisfy declaration requirements of some picky compilers. - * - * Revision 1.97 2003/01/26 21:15:59 steve - * Rework expression parsing and elaboration to - * accommodate real/realtime values and expressions. - * - * Revision 1.96 2002/12/21 00:55:58 steve - * The $time system task returns the integer time - * scaled to the local units. Change the internal - * implementation of vpiSystemTime the $time functions - * to properly account for this. Also add $simtime - * to get the simulation time. - * - * Revision 1.95 2002/10/23 01:47:17 steve - * Fix synth2 handling of aset/aclr signals where - * flip-flops are split by begin-end blocks. - * - * Revision 1.94 2002/09/26 03:18:04 steve - * Generate vvp code for asynch set/reset of NetFF. */ #endif