Permalink
Browse files

parameter keys are per_strings.

  • Loading branch information...
1 parent b5b0226 commit 1295058e5d07be1a473fc4c14f629dec5aec75dc steve committed Feb 20, 2004
Showing with 186 additions and 138 deletions.
  1. +5 −2 Module.cc
  2. +9 −6 Module.h
  3. +14 −5 PExpr.cc
  4. +5 −2 design_dump.cc
  5. +6 −3 elab_expr.cc
  6. +10 −5 elab_pexpr.cc
  7. +8 −5 elab_scope.cc
  8. +10 −12 eval_tree.cc
  9. +7 −4 named.h
  10. +12 −8 net_design.cc
  11. +7 −4 net_expr.cc
  12. +18 −8 net_scope.cc
  13. +6 −3 netlist.cc
  14. +18 −15 netlist.h
  15. +17 −16 parse.y
  16. +12 −9 pform.cc
  17. +6 −3 pform.h
  18. +5 −2 pform_dump.cc
  19. +6 −3 t-dll.cc
  20. +5 −23 t-dll.h
View
@@ -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<PEIdent*>& 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<PProcess*>& 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.
*
View
@@ -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 <list>
@@ -57,7 +57,7 @@ class Module : public LineInfo {
the port. */
public:
struct port_t {
- string name;
+ perm_string name;
svector<PEIdent*> expr;
};
@@ -77,8 +77,8 @@ class Module : public LineInfo {
PExpr*lsb;
bool signed_flag;
};
- map<string,param_expr_t>parameters;
- map<string,param_expr_t>localparams;
+ map<perm_string,param_expr_t>parameters;
+ map<perm_string,param_expr_t>localparams;
/* 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<string> param_names;
+ list<perm_string> 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<PEIdent*>& 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.
*
View
@@ -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<string,Module::param_expr_t>::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<perm_string,Module::param_expr_t>::const_iterator cur;
+ cur = mod->parameters.find(tmp);
if (cur != mod->parameters.end()) return true;
}
- { map<string,Module::param_expr_t>::const_iterator cur;
- cur = mod->localparams.find(path_.peek_name(0));
+ { map<perm_string,Module::param_expr_t>::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.
*
View
@@ -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<string,param_expr_t>::const_iterator pp;
+ map<perm_string,param_expr_t>::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.
*
View
@@ -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<NetEConst*>(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.
*
View
@@ -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 <iostream>
@@ -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
View
@@ -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<string,param_expr_t>::const_iterator mparm_it_t;
+ typedef map<perm_string,param_expr_t>::const_iterator mparm_it_t;
typedef map<hname_t,PExpr*>::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<string,PExpr*>::const_iterator mparm_it_t;
- map<string,PExpr*> replace;
+ typedef map<perm_string,PExpr*>::const_iterator mparm_it_t;
+ map<perm_string,PExpr*> 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<string>::const_iterator cur = mod->param_names.begin();
+ list<perm_string>::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.
*
View
@@ -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,17 +1141,15 @@ NetExpr* NetEParam::eval_tree()
// return the constant value.
if (NetEConst*tmp = dynamic_cast<NetEConst*>(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;
}
if (NetECReal*tmp = dynamic_cast<NetECReal*>(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.
*
Oops, something went wrong.

0 comments on commit 1295058

Please sign in to comment.